Documentation
¶
Index ¶
- type AgentConfig
- type AgentStatus
- type ChatResponse
- type Client
- func (c *Client) ChatAIResponse(agentName string, messages []InputMessage) (string, error)
- func (c *Client) CreateAgent(config *AgentConfig) error
- func (c *Client) DeleteAgent(name string) error
- func (c *Client) ExportAgent(name string) (*AgentConfig, error)
- func (c *Client) GetAIResponse(request *RequestBody) (*ResponseBody, error)
- func (c *Client) GetAgentConfig(name string) (*AgentConfig, error)
- func (c *Client) ListAgents() ([]string, error)
- func (c *Client) Notify(agentName, message string) error
- func (c *Client) PauseAgent(name string) error
- func (c *Client) SendMessage(agentName, message string) error
- func (c *Client) SetTimeout(timeout time.Duration)
- func (c *Client) SimpleAIResponse(agentName, input string) (string, error)
- func (c *Client) StartAgent(name string) error
- func (c *Client) UpdateAgentConfig(name string, config *AgentConfig) error
- type ContentItem
- type InputFunctionToolCallOutput
- type InputMessage
- type Message
- type MessageContentItem
- type RequestBody
- type ResponseBase
- type ResponseBody
- type ResponseFunctionToolCall
- type ResponseMessage
- type ResponseType
- type Tool
- type ToolChoice
- type UserLocation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentConfig ¶
type AgentConfig struct {
Name string `json:"name"`
Actions []string `json:"actions,omitempty"`
Connectors []string `json:"connectors,omitempty"`
PromptBlocks []string `json:"prompt_blocks,omitempty"`
InitialPrompt string `json:"initial_prompt,omitempty"`
Parallel bool `json:"parallel,omitempty"`
EnableReasoning bool `json:"enable_reasoning,omitempty"`
}
AgentConfig represents the configuration for an agent
type AgentStatus ¶
type AgentStatus struct {
Status string `json:"status"`
}
AgentStatus represents the status of an agent
type ChatResponse ¶
type ChatResponse struct {
Response string `json:"response"`
}
ChatResponse represents a response from the agent
type Client ¶
Client represents a client for the LocalAGI API
func (*Client) ChatAIResponse ¶
func (c *Client) ChatAIResponse(agentName string, messages []InputMessage) (string, error)
ChatAIResponse sends chat messages to the AI model
func (*Client) CreateAgent ¶
func (c *Client) CreateAgent(config *AgentConfig) error
CreateAgent creates a new agent with the given configuration
func (*Client) DeleteAgent ¶
DeleteAgent removes an agent
func (*Client) ExportAgent ¶
func (c *Client) ExportAgent(name string) (*AgentConfig, error)
ExportAgent exports an agent configuration
func (*Client) GetAIResponse ¶
func (c *Client) GetAIResponse(request *RequestBody) (*ResponseBody, error)
GetAIResponse sends a request to the AI model and returns the response
func (*Client) GetAgentConfig ¶
func (c *Client) GetAgentConfig(name string) (*AgentConfig, error)
GetAgentConfig retrieves the configuration for a specific agent
func (*Client) ListAgents ¶
ListAgents returns a list of all agents
func (*Client) PauseAgent ¶
PauseAgent pauses an agent
func (*Client) SendMessage ¶
SendMessage sends a message to an agent
func (*Client) SetTimeout ¶
SetTimeout sets the HTTP client timeout
func (*Client) SimpleAIResponse ¶
SimpleAIResponse is a helper function to get a simple text response from the AI
func (*Client) StartAgent ¶
StartAgent starts a paused agent
func (*Client) UpdateAgentConfig ¶
func (c *Client) UpdateAgentConfig(name string, config *AgentConfig) error
UpdateAgentConfig updates the configuration for an existing agent
type ContentItem ¶
type ContentItem struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
ImageURL string `json:"image_url,omitempty"`
}
ContentItem represents an item in a content array
type InputMessage ¶
type InputMessage struct {
Type string `json:"type"`
Role string `json:"role"`
Content any `json:"content"`
}
InputMessage represents a user input message
type Message ¶
type Message struct {
Message string `json:"message"`
}
Message represents a chat message
type MessageContentItem ¶
MessageContentItem represents a content item in a message
type RequestBody ¶
type RequestBody struct {
Model string `json:"model"`
Input any `json:"input"`
Temperature *float64 `json:"temperature,omitempty"`
Tools []Tool `json:"tools,omitempty"`
ToolChoice *ToolChoice `json:"tool_choice"`
MaxTokens *int `json:"max_output_tokens,omitempty"`
}
RequestBody represents the message request to the AI model
type ResponseBase ¶
type ResponseBase json.RawMessage
func (*ResponseBase) ToFunctionToolCall ¶
func (r *ResponseBase) ToFunctionToolCall() (msg ResponseFunctionToolCall, err error)
func (*ResponseBase) ToMessage ¶
func (r *ResponseBase) ToMessage() (msg ResponseMessage, err error)
func (*ResponseBase) UnmarshalJSON ¶
func (r *ResponseBase) UnmarshalJSON(data []byte) error
type ResponseBody ¶
type ResponseBody struct {
CreatedAt int64 `json:"created_at"`
Status string `json:"status"`
Error any `json:"error,omitempty"`
Output []ResponseBase `json:"output"`
Tools []Tool `json:"tools"`
}
ResponseBody represents the response from the AI model
type ResponseMessage ¶
type ResponseMessage struct {
Type string `json:"type"`
Status string `json:"status"`
Role string `json:"role"`
Content []MessageContentItem `json:"content"`
}
ResponseMessage represents a message in the response
type ResponseType ¶
type ResponseType string
const ( ResponseTypeFunctionToolCall ResponseType = "function_call" ResponseTypeMessage ResponseType = "message" )
type Tool ¶
type Tool struct {
Type string `json:"type"`
// Function tool fields (used when type == "function")
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Parameters *jsonschema.Definition `json:"parameters,omitempty"`
// Web search tool fields (used when type == "web_search_preview" etc.)
SearchContextSize *string `json:"search_context_size,omitempty"`
UserLocation *UserLocation `json:"user_location,omitempty"`
}