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]) GenerateStructuredData(userMessages []messages.Message) (response *Output, finishReason string, err error)
- func (agent *Agent[Output]) GetConversationHistoryJSON() (string, error)
- func (agent *Agent[Output]) GetLastRequestContextLength() int
- func (agent *Agent[Output]) GetLastRequestJSON() (string, error)
- func (agent *Agent[Output]) GetLastRequestMetadata() base.RequestMetadata
- func (agent *Agent[Output]) GetLastResponseJSON() (string, error)
- func (agent *Agent[Output]) GetLastResponseMetadata() base.ResponseMetadata
- func (agent *Agent[Output]) GetMessages() []messages.Message
- func (agent *Agent[Output]) GetModelID() string
- func (agent *Agent[Output]) GetName() string
- func (agent *Agent[Output]) GetTotalTokensUsed() int
- func (agent *Agent[Output]) Kind() agents.Kind
- func (agent *Agent[Output]) ResetMessages()
- func (agent *Agent[Output]) ResetTelemetry()
- func (agent *Agent[Output]) SetTelemetryCallback(callback base.TelemetryCallback)
- 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]) 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]) GetConversationHistoryJSON ¶ added in v1.0.2
GetConversationHistoryJSON returns the entire conversation history as JSON
func (*Agent[Output]) GetLastRequestContextLength ¶ added in v1.0.2
GetLastRequestContextLength returns the context length of the last request
func (*Agent[Output]) GetLastRequestJSON ¶ added in v1.0.2
GetLastRequestJSON returns the last request sent to the LLM as JSON
func (*Agent[Output]) GetLastRequestMetadata ¶ added in v1.0.2
func (agent *Agent[Output]) GetLastRequestMetadata() base.RequestMetadata
GetLastRequestMetadata returns metadata about the last request
func (*Agent[Output]) GetLastResponseJSON ¶ added in v1.0.2
GetLastResponseJSON returns the last response received from the LLM as JSON
func (*Agent[Output]) GetLastResponseMetadata ¶ added in v1.0.2
func (agent *Agent[Output]) GetLastResponseMetadata() base.ResponseMetadata
GetLastResponseMetadata returns metadata about the last response
func (*Agent[Output]) GetMessages ¶ added in v0.0.8
GetMessages returns all conversation messages
func (*Agent[Output]) GetModelID ¶ added in v0.0.7
func (*Agent[Output]) GetTotalTokensUsed ¶ added in v1.0.2
GetTotalTokensUsed returns the total number of tokens used since the agent was created
func (*Agent[Output]) ResetMessages ¶
func (agent *Agent[Output]) ResetMessages()
ResetMessages clears all messages except the system instruction
func (*Agent[Output]) ResetTelemetry ¶ added in v1.0.2
func (agent *Agent[Output]) ResetTelemetry()
ResetTelemetry resets all telemetry counters and stored data
func (*Agent[Output]) SetTelemetryCallback ¶ added in v1.0.2
func (agent *Agent[Output]) SetTelemetryCallback(callback base.TelemetryCallback)
SetTelemetryCallback sets a callback for receiving telemetry events in real-time
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