agent

package
v0.0.0-...-085a19f Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ModuleAgentFactory = fx.Module("agent-factory",
	fx.Provide(
		NewRAGAgentFactory,
	),
)

ModuleAgentFactory is a fx module for the agent factory.

Functions

func DummyTool

func DummyTool() tool.BaseTool

DummyTool is a tool that do nothing

func GetTools

func GetTools(ctx context.Context, ragAgentConfig *RagAgentConfig) ([]tool.BaseTool, error)

GetTools returns a list of tools that can be used by the agent.

func LogCallback

func LogCallback(config *LogCallbackConfig) callbacks.Handler

LogCallback is a callback that logs the input and output of the component.

func NewDDGSearch

func NewDDGSearch(ctx context.Context, config *duckduckgo.Config) (tn tool.BaseTool, err error)

NewDDGSearch returns a new DDGSearch tool

func NewGitCloneFile

func NewGitCloneFile(ctx context.Context) (tn tool.BaseTool, err error)

NewGitCloneFile returns a new GitCloneFile tool

func NewOpenFileTool

func NewOpenFileTool(ctx context.Context) (tn tool.BaseTool, err error)

NewOpenFileTool returns a new OpenFileTool tool

Types

type LogCallbackConfig

type LogCallbackConfig struct {
	Detail bool
	Debug  bool
	Writer io.Writer
}

LogCallbackConfig is the configuration for the log callback.

type RAGAgent

type RAGAgent struct {
	// contains filtered or unexported fields
}

RAGAgent is a RAG agent that uses a chat model to generate a response to a user message.

func (*RAGAgent) Run

func (agent *RAGAgent) Run(ctx context.Context, id string, msg string) (*schema.StreamReader[*schema.Message], error)

Run is a function that run agent and return stream reader

type RagAgentConfig

type RagAgentConfig struct {
	UserID         string
	MaxSteps       int
	ToolDuckduckgo bool
}

RagAgentConfig is the configuration for a RAG agent.

type RagAgentFactory

type RagAgentFactory func(ctx context.Context, config *RagAgentConfig) (*RAGAgent, error)

RagAgentFactory is a factory for a RAG agent.

func NewRAGAgentFactory

func NewRAGAgentFactory(logger *slog.Logger, mem *mem.SimpleMemory, retrieverFactory milvus.MilvusRetrieverFactory, chatTemplate prompt.ChatTemplate, model model.ToolCallingChatModel) RagAgentFactory

NewRAGAgentFactory creates a new RAG agent factory.

Jump to

Keyboard shortcuts

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