Documentation
¶
Index ¶
- type Agent
- func (agent *Agent) AddMessage(role roles.Role, content string)
- func (agent *Agent) AddMessages(msgs []messages.Message)
- func (agent *Agent) CancelOperation(operationID string) error
- func (agent *Agent) ExportMessagesToJSON() (string, error)
- func (agent *Agent) GenerateCompletion(userMessages []messages.Message) (*CompletionResult, error)
- func (agent *Agent) GenerateCompletionWithReasoning(userMessages []messages.Message) (*ReasoningResult, error)
- func (agent *Agent) GenerateStreamCompletion(userMessages []messages.Message, callback StreamCallback) (*CompletionResult, error)
- func (agent *Agent) GenerateStreamCompletionWithReasoning(userMessages []messages.Message, reasoningCallback StreamCallback, ...) (*ReasoningResult, error)
- func (agent *Agent) GetContext() context.Context
- func (agent *Agent) GetContextSize() int
- func (agent *Agent) GetHealth() (*HealthStatus, error)
- func (agent *Agent) GetMessages() []messages.Message
- func (agent *Agent) GetModelID() string
- func (agent *Agent) GetModelsInfo() (*ModelsInfo, error)
- func (agent *Agent) GetName() string
- func (agent *Agent) IsHealthy() bool
- func (agent *Agent) Kind() agents.Kind
- func (agent *Agent) ResetMessages()
- func (agent *Agent) ResetOperations() error
- func (agent *Agent) SetContext(ctx context.Context)
- func (agent *Agent) SetToolCallCallback(callback ToolCallCallback)
- func (agent *Agent) StopStream()
- func (agent *Agent) ValidateOperation(operationID string) error
- type CompletionResult
- type HealthStatus
- type ModelsInfo
- type ReasoningResult
- type RemoteAgentOption
- type StreamCallback
- type ToolCallCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent represents a remote chat agent that communicates with a server agent via HTTP
func NewAgent ¶
func NewAgent( ctx context.Context, agentConfig agents.Config, baseURL string, opts ...RemoteAgentOption, ) (*Agent, error)
NewAgent creates a new remote chat agent
func (*Agent) AddMessage ¶
AddMessage adds a message to the conversation history Note: This is a no-op for remote agent as messages are managed server-side
func (*Agent) AddMessages ¶ added in v1.0.4
AddMessages adds multiple messages to the conversation history Note: This is a no-op for remote agent as messages are managed server-side
func (*Agent) CancelOperation ¶
CancelOperation cancels a pending tool call operation on the server
func (*Agent) ExportMessagesToJSON ¶
ExportMessagesToJSON exports the conversation history to JSON
func (*Agent) GenerateCompletion ¶
func (agent *Agent) GenerateCompletion(userMessages []messages.Message) (*CompletionResult, error)
GenerateCompletion sends messages and returns the completion result
func (*Agent) GenerateCompletionWithReasoning ¶
func (agent *Agent) GenerateCompletionWithReasoning(userMessages []messages.Message) (*ReasoningResult, error)
GenerateCompletionWithReasoning sends messages and returns the completion result with reasoning Note: Reasoning is not yet supported by the server API
func (*Agent) GenerateStreamCompletion ¶
func (agent *Agent) GenerateStreamCompletion( userMessages []messages.Message, callback StreamCallback, ) (*CompletionResult, error)
GenerateStreamCompletion sends messages and streams the response via callback
func (*Agent) GenerateStreamCompletionWithReasoning ¶
func (agent *Agent) GenerateStreamCompletionWithReasoning( userMessages []messages.Message, reasoningCallback StreamCallback, responseCallback StreamCallback, ) (*ReasoningResult, error)
GenerateStreamCompletionWithReasoning sends messages and streams both reasoning and response Note: The server doesn't support separate reasoning streams yet
func (*Agent) GetContext ¶ added in v1.2.2
GetContext returns the remote agent's context
func (*Agent) GetContextSize ¶
GetContextSize returns the approximate size of the current context from the server
func (*Agent) GetHealth ¶
func (agent *Agent) GetHealth() (*HealthStatus, error)
GetHealth checks if the server is healthy and reachable
func (*Agent) GetMessages ¶
GetMessages returns all conversation messages from the server
func (*Agent) GetModelID ¶
GetModelID returns the model ID from the server
func (*Agent) GetModelsInfo ¶
func (agent *Agent) GetModelsInfo() (*ModelsInfo, error)
GetModelsInfo returns detailed information about all models used by the server
func (*Agent) IsHealthy ¶
IsHealthy is a convenience method that returns true if the server is healthy
func (*Agent) ResetMessages ¶
func (agent *Agent) ResetMessages()
ResetMessages clears all messages except the system instruction
func (*Agent) ResetOperations ¶
ResetOperations cancels all pending tool call operations on the server
func (*Agent) SetContext ¶ added in v1.2.2
SetContext updates the remote agent's context
func (*Agent) SetToolCallCallback ¶
func (agent *Agent) SetToolCallCallback(callback ToolCallCallback)
SetToolCallCallback sets the callback for tool call notifications
func (*Agent) StopStream ¶
func (agent *Agent) StopStream()
StopStream interrupts the current streaming operation
func (*Agent) ValidateOperation ¶
ValidateOperation validates a pending tool call operation on the server
type CompletionResult ¶
CompletionResult represents the result of a chat completion
type HealthStatus ¶
type HealthStatus struct {
Status string `json:"status"`
}
HealthStatus contains the health status of the server
type ModelsInfo ¶
type ModelsInfo struct {
Status string `json:"status"`
ChatModel string `json:"chat_model"`
EmbeddingsModel string `json:"embeddings_model"`
ToolsModel string `json:"tools_model"`
}
ModelsInfo contains information about the models used by the server
type ReasoningResult ¶
ReasoningResult represents the result of a chat completion with reasoning
type RemoteAgentOption ¶ added in v1.2.9
type RemoteAgentOption func(*Agent)
RemoteAgentOption is a functional option for configuring an Agent during creation
func AfterCompletion ¶ added in v1.2.9
func AfterCompletion(fn func(*Agent)) RemoteAgentOption
AfterCompletion sets a hook that is called after each completion (standard and streaming)
func BeforeCompletion ¶ added in v1.2.9
func BeforeCompletion(fn func(*Agent)) RemoteAgentOption
BeforeCompletion sets a hook that is called before each completion (standard and streaming)
type StreamCallback ¶
StreamCallback is a function called for each chunk of streaming response
type ToolCallCallback ¶
ToolCallCallback is a function called when a tool call is detected