flock

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Name         string                   `json:"name"`
	Model        string                   `json:"model"`
	OllamaUrl    string                   `json:"ollama_url"`
	Instructions interface{}              `json:"instructions"` // Can be string or function returning string
	Functions    map[string]AgentFunction `json:"functions"`
	//ToolChoice   *string         `json:"tool_choice,omitempty"`
	//ParallelToolCalls bool            `json:"parallel_tool_calls"`
	Options llm.Options
}

Agent represents an AI agent with its configuration

func (*Agent) GetInstructions

func (a *Agent) GetInstructions(contextVars map[string]interface{}) string

GetInstructions returns the current instructions as a string, using the provided context variables

func (*Agent) SetInstructions

func (a *Agent) SetInstructions(instructions interface{}) error

SetInstructions sets the instructions for the agent

type AgentFunction

type AgentFunction func(interface{}) (interface{}, error)

type InstructionFunc

type InstructionFunc func(map[string]interface{}) string

InstructionFunc represents a function that takes context variables and returns a string

type Orchestrator

type Orchestrator struct {
}

Orchestrator represents an API client for running agents

func (*Orchestrator) Run

func (c *Orchestrator) Run(agent Agent, messages []llm.Message, contextVars map[string]interface{}) (Response, error)

Run executes the agent with the given messages and context variables

func (*Orchestrator) RunStream

func (c *Orchestrator) RunStream(agent Agent, messages []llm.Message, contextVars map[string]interface{}, onChunk func(llm.Answer) error) (Response, error)

TODO: Some refactoring ...

func (*Orchestrator) RunWithTools

func (c *Orchestrator) RunWithTools(agent Agent, messages []llm.Message, contextVars map[string]interface{}, tools []llm.Tool, execute bool) (Response, error)

type Response

type Response struct {
	Messages         []llm.Message          `json:"messages"`
	Agent            Agent                  `json:"agent,omitempty"`
	ContextVariables map[string]interface{} `json:"context_variables"`
}

Response represents the response from running an agent

func (*Response) GetLastMessage

func (r *Response) GetLastMessage() llm.Message

Function to get the last message of Response.Messages

Jump to

Keyboard shortcuts

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