crewserver

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompletionRequest

type CompletionRequest = serverbase.CompletionRequest

Re-export types from serverbase for backward compatibility

type CrewServerAgent

type CrewServerAgent struct {
	*serverbase.BaseServerAgent
	// contains filtered or unexported fields
}

CrewServerAgent wraps BaseServerAgent with crew-specific functionality

func NewAgent

func NewAgent(
	ctx context.Context,
	agentCrew map[string]*chat.Agent,
	selectedAgentId string,
	port string,
	matchAgentIdToTopicFn func(string) string,
	executeFn func(string, string) (string, error),
) (*CrewServerAgent, error)

NewAgent creates a new crew server agent

func (*CrewServerAgent) AddChatAgentToCrew

func (agent *CrewServerAgent) AddChatAgentToCrew(id string, chatAgent *chat.Agent) error

AddChatAgentToCrew adds a new chat agent to the crew

func (*CrewServerAgent) AddMessage

func (agent *CrewServerAgent) AddMessage(role roles.Role, content string)

AddMessage adds a message to the conversation history

func (*CrewServerAgent) CompressChatAgentContext

func (agent *CrewServerAgent) CompressChatAgentContext() (int, error)

CompressChatAgentContext compresses the chat agent context.

func (*CrewServerAgent) CompressChatAgentContextIfOverLimit

func (agent *CrewServerAgent) CompressChatAgentContextIfOverLimit() (int, error)

CompressChatAgentContextIfOverLimit compresses the chat agent context if it exceeds the size limit.

func (*CrewServerAgent) DetectTopicThenGetAgentId

func (ca *CrewServerAgent) DetectTopicThenGetAgentId(query string) (string, error)

DetectTopicThenSetCurrentAgent sets the current active chat agent based on the detected topic from the query. query -> user message

func (*CrewServerAgent) ExportMessagesToJSON

func (agent *CrewServerAgent) ExportMessagesToJSON() (string, error)

ExportMessagesToJSON exports the conversation history to JSON

func (*CrewServerAgent) GenerateCompletion

func (agent *CrewServerAgent) GenerateCompletion(userMessages []messages.Message) (*chat.CompletionResult, error)

GenerateCompletion sends messages and returns the completion result

func (*CrewServerAgent) GenerateCompletionWithReasoning

func (agent *CrewServerAgent) GenerateCompletionWithReasoning(userMessages []messages.Message) (*chat.ReasoningResult, error)

GenerateCompletionWithReasoning sends messages and returns the completion result with reasoning

func (*CrewServerAgent) GenerateStreamCompletion

func (agent *CrewServerAgent) GenerateStreamCompletion(
	userMessages []messages.Message,
	callback chat.StreamCallback,
) (*chat.CompletionResult, error)

GenerateStreamCompletion sends messages and streams the response via callback

func (*CrewServerAgent) GenerateStreamCompletionWithReasoning

func (agent *CrewServerAgent) GenerateStreamCompletionWithReasoning(
	userMessages []messages.Message,
	reasoningCallback chat.StreamCallback,
	responseCallback chat.StreamCallback,
) (*chat.ReasoningResult, error)

GenerateStreamCompletionWithReasoning sends messages and streams both reasoning and response

func (*CrewServerAgent) GetChatAgents

func (agent *CrewServerAgent) GetChatAgents() map[string]*chat.Agent

GetChatAgents returns the map of chat agents

func (*CrewServerAgent) GetCompressorAgent

func (agent *CrewServerAgent) GetCompressorAgent() *compressor.Agent

GetCompressorAgent returns the compressor agent

func (*CrewServerAgent) GetContextSize

func (agent *CrewServerAgent) GetContextSize() int

GetContextSize returns the approximate size of the current context

func (*CrewServerAgent) GetContextSizeLimit

func (agent *CrewServerAgent) GetContextSizeLimit() int

GetContextSizeLimit returns the context size limit for compression

func (*CrewServerAgent) GetMaxSimilarities

func (agent *CrewServerAgent) GetMaxSimilarities() int

GetMaxSimilarities returns the maximum number of similar documents to retrieve

func (*CrewServerAgent) GetMessages

func (agent *CrewServerAgent) GetMessages() []messages.Message

GetMessages returns all conversation messages

func (*CrewServerAgent) GetModelID

func (agent *CrewServerAgent) GetModelID() string

GetModelID returns the model ID

func (*CrewServerAgent) GetName

func (agent *CrewServerAgent) GetName() string

GetName returns the agent name

func (*CrewServerAgent) GetOrchestratorAgent added in v1.0.0

func (agent *CrewServerAgent) GetOrchestratorAgent() *structured.Agent[agents.Intent]

GetOrchestratorAgent returns the orchestrator agent

func (*CrewServerAgent) GetPort

func (agent *CrewServerAgent) GetPort() string

GetPort returns the HTTP port

func (*CrewServerAgent) GetRagAgent

func (agent *CrewServerAgent) GetRagAgent() *rag.Agent

GetRagAgent returns the RAG agent

func (*CrewServerAgent) GetSimilarityLimit

func (agent *CrewServerAgent) GetSimilarityLimit() float64

GetSimilarityLimit returns the similarity limit for document retrieval

func (*CrewServerAgent) GetToolsAgent

func (agent *CrewServerAgent) GetToolsAgent() *tools.Agent

GetToolsAgent returns the tools agent

func (*CrewServerAgent) Kind

func (agent *CrewServerAgent) Kind() agents.Kind

Kind returns the agent type

func (*CrewServerAgent) RemoveChatAgentFromCrew

func (agent *CrewServerAgent) RemoveChatAgentFromCrew(id string) error

RemoveChatAgentFromCrew removes a chat agent from the crew

func (*CrewServerAgent) ResetMessages

func (agent *CrewServerAgent) ResetMessages()

ResetMessages clears all messages except the system instruction

func (*CrewServerAgent) SetChatAgents

func (agent *CrewServerAgent) SetChatAgents(chatAgents map[string]*chat.Agent)

SetChatAgents sets the map of chat agents

func (*CrewServerAgent) SetCompressorAgent

func (agent *CrewServerAgent) SetCompressorAgent(compressorAgent *compressor.Agent)

SetCompressorAgent sets the compressor agent

func (*CrewServerAgent) SetContextSizeLimit

func (agent *CrewServerAgent) SetContextSizeLimit(limit int)

SetContextSizeLimit sets the context size limit for compression

func (*CrewServerAgent) SetExecuteFunction

func (agent *CrewServerAgent) SetExecuteFunction(fn func(string, string) (string, error))

SetExecuteFunction allows the user to set a custom execute function

func (*CrewServerAgent) SetMaxSimilarities

func (agent *CrewServerAgent) SetMaxSimilarities(n int)

SetMaxSimilarities sets the maximum number of similar documents to retrieve

func (*CrewServerAgent) SetOrchestratorAgent

func (agent *CrewServerAgent) SetOrchestratorAgent(orchestratorAgent *structured.Agent[agents.Intent])

SetOrchestratorAgent sets the orchestrator agent

func (*CrewServerAgent) SetPort

func (agent *CrewServerAgent) SetPort(port string)

SetPort sets the HTTP port

func (*CrewServerAgent) SetRagAgent

func (agent *CrewServerAgent) SetRagAgent(ragAgent *rag.Agent)

SetRagAgent sets the RAG agent

func (*CrewServerAgent) SetSimilarityLimit

func (agent *CrewServerAgent) SetSimilarityLimit(limit float64)

SetSimilarityLimit sets the similarity limit for document retrieval

func (*CrewServerAgent) SetToolsAgent

func (agent *CrewServerAgent) SetToolsAgent(toolsAgent *tools.Agent)

SetToolsAgent sets the tools agent

func (*CrewServerAgent) StartServer

func (agent *CrewServerAgent) StartServer() error

StartServer starts the HTTP server with all routes

func (*CrewServerAgent) StopStream

func (agent *CrewServerAgent) StopStream()

StopStream interrupts the current streaming operation

type MemoryResponse

type MemoryResponse = serverbase.MemoryResponse

Re-export types from serverbase for backward compatibility

type OperationRequest

type OperationRequest = serverbase.OperationRequest

Re-export types from serverbase for backward compatibility

type PendingOperation

type PendingOperation = serverbase.PendingOperation

Re-export types from serverbase for backward compatibility

type TokensResponse

type TokensResponse = serverbase.TokensResponse

Re-export types from serverbase for backward compatibility

type ToolCallNotification

type ToolCallNotification = serverbase.ToolCallNotification

Re-export types from serverbase for backward compatibility

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL