Documentation
¶
Index ¶
- type Agent
- type AgentRunResponse
- type InvokeOption
- type InvokeOptions
- type Memory
- type Option
- func WithAgenticSharedContext(enable bool) Option
- func WithDescription(description string) Option
- func WithID(id string) Option
- func WithInstructions(instructions ...string) Option
- func WithKnowledge(retrieval *rag.Indexer) Option
- func WithLLM(llm *llm.Instance) Option
- func WithMembers(members ...*Agent) Option
- func WithMemory(memory memory.Memory) Option
- func WithMode(mode TeamMode) Option
- func WithModel(model *llm.Instance) Option
- func WithName(name string) Option
- func WithRole(role string) Option
- func WithShareMemberInteractions(enable bool) Option
- func WithStorage(storage storage.Storage) Option
- func WithTools(tools ...any) Option
- type SharedContexts
- type Team
- type TeamMemberInteraction
- type TeamMemory
- func (t *TeamMemory) AddTeamMemberInteractions(ctx context.Context, memberName string, task string, ...) error
- func (t *TeamMemory) GetSharedContext(ctx context.Context) (string, error)
- func (t *TeamMemory) GetTeamMemberInteractions(ctx context.Context) ([]TeamMemberInteraction, error)
- func (t *TeamMemory) SetSharedContext(ctx context.Context, text string) (string, error)
- type TeamMode
- type TeamRunResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// session
SessionID string `json:"session_id"` // 会话ID, for 持久化信息
// basic
ID string `json:"id"` // 唯一标识
Name string `json:"name"`
Role string `json:"role"` // 角色
// for prompt
Description string `json:"description"`
Goals []string `json:"goals"`
Instructions []string `json:"instructions"`
Outputs []string `json:"outputs"`
Tools []any `json:"tools"`
// for team
TeamID string `json:"team_id"` // 团队ID
// contains filtered or unexported fields
}
func (*Agent) Invoke ¶
func (agent *Agent) Invoke(ctx context.Context, task string, opts ...InvokeOption) *AgentRunResponse
concurrent invoke not support
type AgentRunResponse ¶
type AgentRunResponse struct {
Reasoning string `json:"reasoning"`
Answer string `json:"answer"`
ToolCalls []llm.ToolCall `json:"tool_calls"`
Error error
Stream chan *llm.Chunk
}
func (*AgentRunResponse) Completion ¶
func (a *AgentRunResponse) Completion() string
type InvokeOption ¶
type InvokeOption func(*InvokeOptions)
func WithRetries ¶
func WithRetries(retries int) InvokeOption
func WithSessionID ¶ added in v0.0.9
func WithSessionID(sessionID string) InvokeOption
func WithStream ¶
func WithStream(stream bool) InvokeOption
type InvokeOptions ¶
type Option ¶
type Option func(any)
func WithDescription ¶
func WithInstructions ¶
func WithKnowledge ¶ added in v0.0.9
func WithMembers ¶
func WithMemory ¶ added in v0.0.9
func WithStorage ¶ added in v0.0.9
type SharedContexts ¶
type SharedContexts struct {
}
type Team ¶
type Team struct {
Agent
// contains filtered or unexported fields
}
Team A team of agents
func (*Team) DebugAssignTask ¶
func (*Team) Invoke ¶
func (t *Team) Invoke(ctx context.Context, query string, optfuncs ...InvokeOption) *TeamRunResponse
type TeamMemberInteraction ¶
type TeamMemberInteraction struct {
MemberName string
Task string
Response *AgentRunResponse
}
type TeamMemory ¶
func (*TeamMemory) AddTeamMemberInteractions ¶
func (t *TeamMemory) AddTeamMemberInteractions(ctx context.Context, memberName string, task string, response *AgentRunResponse) error
func (*TeamMemory) GetSharedContext ¶
func (t *TeamMemory) GetSharedContext(ctx context.Context) (string, error)
func (*TeamMemory) GetTeamMemberInteractions ¶
func (t *TeamMemory) GetTeamMemberInteractions(ctx context.Context) ([]TeamMemberInteraction, error)
func (*TeamMemory) SetSharedContext ¶
type TeamRunResponse ¶
type TeamRunResponse struct {
sync.RWMutex // for thread safe
Reasoning string `json:"reasoning"`
Answer string `json:"answer"`
ToolCalls []llm.ToolCall `json:"tool_calls"`
Stream chan *llm.Chunk
MemberResponses []*AgentRunResponse
Error error
}
func (*TeamRunResponse) AddMemberResponse ¶
func (t *TeamRunResponse) AddMemberResponse(response *AgentRunResponse)
func (*TeamRunResponse) String ¶
func (t *TeamRunResponse) String() string
Click to show internal directories.
Click to hide internal directories.