Documentation
¶
Index ¶
- func StructToJSONSchema(t reflect.Type) map[string]any
- type Agent
- func (agent *Agent[Output]) AddMessage(role roles.Role, content string)
- func (agent *Agent[Output]) AddMessages(msgs []messages.Message)
- func (agent *Agent[Output]) ExportMessagesToJSON() (string, error)
- func (agent *Agent[Output]) GenerateStructuredData(userMessages []messages.Message) (response *Output, finishReason string, err error)
- func (agent *Agent[Output]) GetConfig() agents.Config
- func (agent *Agent[Output]) GetContext() context.Context
- func (agent *Agent[Output]) GetLastRequestJSON() (string, error)
- func (agent *Agent[Output]) GetLastRequestRawJSON() string
- func (agent *Agent[Output]) GetLastResponseJSON() (string, error)
- func (agent *Agent[Output]) GetLastResponseRawJSON() string
- func (agent *Agent[Output]) GetMessages() []messages.Message
- func (agent *Agent[Output]) GetModelConfig() models.Config
- func (agent *Agent[Output]) GetModelID() string
- func (agent *Agent[Output]) GetName() string
- func (agent *Agent[Output]) Kind() agents.Kind
- func (agent *Agent[Output]) ResetMessages()
- func (agent *Agent[Output]) SetConfig(config agents.Config)
- func (agent *Agent[Output]) SetContext(ctx context.Context)
- func (agent *Agent[Output]) SetModelConfig(config models.Config)
- type AgentOption
- type BaseAgent
- type StructuredResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Agent ¶
type Agent[Output any] struct { // contains filtered or unexported fields }
Agent represents a simplified structured data agent that hides OpenAI SDK details
func NewAgent ¶
func NewAgent[Output any]( ctx context.Context, agentConfig agents.Config, modelConfig models.Config, ) (*Agent[Output], error)
NewAgent creates a new simplified structured data agent
func (*Agent[Output]) AddMessage ¶ added in v0.0.9
func (*Agent[Output]) AddMessages ¶ added in v1.0.4
AddMessages adds multiple messages to the conversation history
func (*Agent[Output]) ExportMessagesToJSON ¶ added in v1.1.2
func (*Agent[Output]) GenerateStructuredData ¶
func (agent *Agent[Output]) GenerateStructuredData(userMessages []messages.Message) (response *Output, finishReason string, err error)
Generate sends messages and returns structured data
func (*Agent[Output]) GetContext ¶ added in v1.2.2
GetContext returns the agent's context
func (*Agent[Output]) GetLastRequestJSON ¶ added in v1.0.2
func (*Agent[Output]) GetLastRequestRawJSON ¶ added in v1.1.2
func (*Agent[Output]) GetLastResponseJSON ¶ added in v1.0.2
func (*Agent[Output]) GetLastResponseRawJSON ¶ added in v1.1.2
func (*Agent[Output]) GetMessages ¶ added in v0.0.8
GetMessages returns all conversation messages
func (*Agent[Output]) GetModelConfig ¶ added in v1.0.8
GetModelConfig returns the model configuration
func (*Agent[Output]) GetModelID ¶ added in v0.0.7
func (*Agent[Output]) ResetMessages ¶
func (agent *Agent[Output]) ResetMessages()
ResetMessages clears all messages except the system instruction
func (*Agent[Output]) SetContext ¶ added in v1.2.2
SetContext updates the agent's context
func (*Agent[Output]) SetModelConfig ¶ added in v1.0.8
SetModelConfig updates the model configuration Note: This updates the stored config but doesn't regenerate the internal OpenAI params For most parameters to take effect, create a new agent with the new config
type AgentOption ¶
type BaseAgent ¶
BaseAgent wraps the shared base.Agent for structured output functionality
func NewBaseAgent ¶
func NewBaseAgent[Output any]( ctx context.Context, agentConfig agents.Config, modelConfig openai.ChatCompletionNewParams, options ...AgentOption[Output], ) (structuredAgent *BaseAgent[Output], err error)
func (*BaseAgent[Output]) GenerateStructuredData ¶
func (agent *BaseAgent[Output]) GenerateStructuredData(messages []openai.ChatCompletionMessageParamUnion) (response *Output, finishReason string, err error)
type StructuredResult ¶
StructuredResult represents the result of structured data generation