Documentation
¶
Index ¶
- type AddMessageResponse
- type AgentExecutor
- type Assistant
- func (a *Assistant) AddMessage(threadID, role, content string) (string, error)
- func (a *Assistant) CreateRun(threadID, instructions string) (string, error)
- func (a *Assistant) CreateThread() (string, error)
- func (a *Assistant) CreateThreadAndRun(messages []Message) (string, error)
- func (a *Assistant) HandleRequiresAction(threadID, runID string, toolCalls []ToolCall) error
- func (a *Assistant) RetrieveThreadMessages(threadID string, instructions string) (string, error)
- type CreateAssistantRequest
- type CreateAssistantResponse
- type CreateRunRequest
- type CreateRunResponse
- type CreateThreadAndRunRequest
- type CreateThreadResponse
- type EchoTool
- type GetThreadMessagesResponse
- type Message
- type Option
- type Thread
- type ToolCall
- type ToolConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddMessageResponse ¶
type AddMessageResponse struct {
ID string `json:"id"`
}
type AgentExecutor ¶
type AgentExecutor struct {
Agent *Assistant
Tools []tools.Tool
// contains filtered or unexported fields
}
AgentExecutor is responsible for executing the agent with the provided tools
func NewAgentExecutor ¶
func NewAgentExecutor(agent *Assistant, tools []tools.Tool) *AgentExecutor
NewAgentExecutor creates a new instance of AgentExecutor
func (*AgentExecutor) HandleToolsExecution ¶
func (ae *AgentExecutor) HandleToolsExecution(threadID, runID string, toolCalls []ToolCall) error
HandleToolsExecution handles the execution of tools when required
type Assistant ¶
func NewAssistant ¶
func NewAssistant(name, instructions, model string, tools []tools.Tool, opts ...Option) (*Assistant, error)
NewAssistant inicializa um novo assistente, opcionalmente com um ID de assistente existente.
func (*Assistant) AddMessage ¶
func (*Assistant) CreateThread ¶
func (*Assistant) CreateThreadAndRun ¶
func (*Assistant) HandleRequiresAction ¶
type CreateAssistantRequest ¶
type CreateAssistantResponse ¶
type CreateRunRequest ¶
type CreateRunResponse ¶
type CreateThreadAndRunRequest ¶ added in v0.0.4
type CreateThreadResponse ¶
type CreateThreadResponse struct {
ID string `json:"id"`
}
type GetThreadMessagesResponse ¶
type GetThreadMessagesResponse struct {
Object string `json:"object"`
Data []struct {
Id string `json:"id"`
Object string `json:"object"`
CreatedAt int `json:"created_at"`
AssistantId *string `json:"assistant_id"`
ThreadId string `json:"thread_id"`
RunId *string `json:"run_id"`
Role string `json:"role"`
Content []struct {
Type string `json:"type"`
Text struct {
Value string `json:"value"`
Annotations []interface{} `json:"annotations"`
} `json:"text"`
} `json:"content"`
Attachments []interface{} `json:"attachments"`
Metadata struct {
} `json:"metadata"`
} `json:"data"`
FirstId string `json:"first_id"`
LastId string `json:"last_id"`
HasMore bool `json:"has_more"`
}
type Option ¶
type Option func(*Assistant)
Option defines the type for functional options to configure the assistant.
func WithAssistantID ¶
WithAssistantID configures the assistant with an existing assistant ID.
type ToolConfig ¶
type ToolConfig struct {
Type string `json:"type"`
Function *llms.FunctionDefinition `json:"function,omitempty"`
}
ToolConfig is the configuration for a tool that can be used by the assistant.
Click to show internal directories.
Click to hide internal directories.