Documentation
¶
Index ¶
- Variables
- func ToolAddToPrompts(t ToolApi, prompts ...PromptApi)
- type A
- type AgentAPI
- type AgentBase
- func (a *AgentBase) BaseDBReadyEnd(e *am.Event)
- func (a *AgentBase) BaseDBSavingEnter(e *am.Event) bool
- func (a *AgentBase) BaseDBSavingState(e *am.Event)
- func (a *AgentBase) BaseDBStartingState(e *am.Event)
- func (a *AgentBase) BuildOffer() string
- func (a *AgentBase) CheckingOfferRefsEnter(e *am.Event) bool
- func (a *AgentBase) CheckingOfferRefsState(e *am.Event)
- func (a *AgentBase) ConfigBase() *shared.Config
- func (a *AgentBase) Err(msg string, err error, args ...any)
- func (a *AgentBase) Gemini() []*GeminiClient
- func (a *AgentBase) Hist() (amhist.MemoryApi, error)
- func (a *AgentBase) HistBBolt() *amhistbb.Memory
- func (a *AgentBase) HistMem() *amhist.Memory
- func (a *AgentBase) HistSQLite() *amhistg.Memory
- func (a *AgentBase) HistoryDBReadyEnd(e *am.Event)
- func (a *AgentBase) HistoryDBStartingState(e *am.Event)
- func (a *AgentBase) HistoryStates() am.S
- func (a *AgentBase) Init(agentImpl AgentAPI, cfg *shared.Config, logArgs am.LogArgsMapperFn, groups any, ...) error
- func (a *AgentBase) InterruptedState(e *am.Event)
- func (a *AgentBase) Log(txt string, args ...any)
- func (a *AgentBase) Logger() *slog.Logger
- func (a *AgentBase) Mach() *am.Machine
- func (a *AgentBase) MsgEnter(e *am.Event) bool
- func (a *AgentBase) OpenAI() []*OpenAIClient
- func (a *AgentBase) Output(txt string, from shared.From) am.Result
- func (a *AgentBase) PromptEnd(e *am.Event)
- func (a *AgentBase) PromptEnter(e *am.Event) bool
- func (a *AgentBase) PromptState(e *am.Event)
- func (a *AgentBase) QueriesBase() *sqlc.Queries
- func (a *AgentBase) RequestingExit(e *am.Event) bool
- func (a *AgentBase) RequestingLLMEnd(e *am.Event)
- func (a *AgentBase) RequestingLLMEnter(e *am.Event) bool
- func (a *AgentBase) RequestingLLMExit(e *am.Event) bool
- func (a *AgentBase) RequestingToolEnd(e *am.Event)
- func (a *AgentBase) RequestingToolEnter(e *am.Event) bool
- func (a *AgentBase) RequestingToolExit(e *am.Event) bool
- func (a *AgentBase) ResumeState(e *am.Event)
- func (a *AgentBase) SetMach(m *am.Machine)
- func (a *AgentBase) Start() am.Result
- func (a *AgentBase) StartEnter(e *am.Event) bool
- func (a *AgentBase) StartState(e *am.Event)
- func (a *AgentBase) Stop(disposeCtx context.Context) am.Result
- type AgentInit
- type Document
- type GeminiClient
- type OpenAIClient
- type Prompt
- func (p *Prompt[P, R]) AddDoc(doc *Document)
- func (p *Prompt[P, R]) AddTool(tool ToolApi)
- func (p *Prompt[P, R]) Conversation() (*instrc.Conversation, string)
- func (p *Prompt[P, R]) Exec(e *am.Event, params P) (*R, error)
- func (p *Prompt[P, R]) GenSysPrompt() string
- func (p *Prompt[P, R]) HistClean()
- type PromptApi
- type PromptMsg
- type PromptSchemaless
- type S
- type Tool
- type ToolApi
Constants ¶
This section is empty.
Variables ¶
var ( ErrHistNil = errors.New("history is nil") ErrNoAI = errors.New("no AI provider configured") )
var ParseArgs = shared.ParseArgs
var Pass = shared.Pass
Functions ¶
func ToolAddToPrompts ¶
Types ¶
type AgentAPI ¶ added in v0.2.0
type AgentAPI interface {
Output(txt string, from shared.From) am.Result
Mach() *am.Machine
Hist() (amhist.MemoryApi, error)
HistMem() *amhist.Memory
HistSQLite() *amhistg.Memory
HistBBolt() *amhistbb.Memory
ConfigBase() *shared.Config
OpenAI() []*OpenAIClient
Gemini() []*GeminiClient
Start() am.Result
Stop(disposeCtx context.Context) am.Result
Log(msg string, args ...any)
Err(msg string, err error, args ...any)
Logger() *slog.Logger
QueriesBase() *sqlc.Queries
HistoryStates() am.S
}
AgentAPI is the top-level public API for all agents to implement.
type AgentBase ¶ added in v0.4.0
type AgentBase struct {
*am.ExceptionHandler
*ssam.DisposedHandlers
// UserInput is a prompt submitted the user, owned by [schema.AgentBaseStatesDef.Prompt].
UserInput string
// OfferList is a list of choices for the user.
// TODO atomic?
OfferList []string
// Messages
Msgs []*shared.Msg
// contains filtered or unexported fields
}
func (*AgentBase) BaseDBReadyEnd ¶ added in v0.4.0
func (*AgentBase) BaseDBSavingEnter ¶ added in v0.4.0
func (*AgentBase) BaseDBSavingState ¶ added in v0.4.0
func (*AgentBase) BaseDBStartingState ¶ added in v0.4.0
func (*AgentBase) BuildOffer ¶ added in v0.4.0
func (*AgentBase) CheckingOfferRefsEnter ¶ added in v0.4.0
func (*AgentBase) CheckingOfferRefsState ¶ added in v0.4.0
func (*AgentBase) ConfigBase ¶ added in v0.4.0
func (*AgentBase) Gemini ¶ added in v0.4.0
func (a *AgentBase) Gemini() []*GeminiClient
func (*AgentBase) HistSQLite ¶ added in v0.4.0
func (*AgentBase) HistoryDBReadyEnd ¶ added in v0.4.0
func (*AgentBase) HistoryDBStartingState ¶ added in v0.4.0
func (*AgentBase) HistoryStates ¶ added in v0.4.0
func (*AgentBase) Init ¶ added in v0.4.0
func (a *AgentBase) Init( agentImpl AgentAPI, cfg *shared.Config, logArgs am.LogArgsMapperFn, groups any, states am.States, args any, ) error
Init initializes the AgentLLM and returns an error. It does not block.
func (*AgentBase) InterruptedState ¶ added in v0.4.0
func (*AgentBase) Log ¶ added in v0.4.0
Log will push a log entry to Logger as Info() and optionally the machine log with SECAI_LOG_AM. Log accepts the same convention of arguments as slog.Info.
func (*AgentBase) OpenAI ¶ added in v0.4.0
func (a *AgentBase) OpenAI() []*OpenAIClient
func (*AgentBase) Output ¶ added in v0.4.0
Output is a sugar for adding a schema.AgentBaseStatesDef.Msg mutation.
func (*AgentBase) PromptState ¶ added in v0.4.0
func (*AgentBase) QueriesBase ¶ added in v0.4.0
func (*AgentBase) RequestingExit ¶ added in v0.4.0
func (*AgentBase) RequestingLLMEnd ¶ added in v0.4.0
func (*AgentBase) RequestingLLMEnter ¶ added in v0.4.0
func (*AgentBase) RequestingLLMExit ¶ added in v0.4.0
func (*AgentBase) RequestingToolEnd ¶ added in v0.4.0
func (*AgentBase) RequestingToolEnter ¶ added in v0.4.0
func (*AgentBase) RequestingToolExit ¶ added in v0.4.0
func (*AgentBase) ResumeState ¶ added in v0.4.0
func (*AgentBase) Start ¶ added in v0.4.0
Start is a sugar for adding a schema.AgentBaseStatesDef.Start mutation.
func (*AgentBase) StartState ¶ added in v0.4.0
type AgentInit ¶ added in v0.4.0
type AgentInit interface {
Init(
agentImpl AgentAPI, cfg *shared.Config, logArgs am.LogArgsMapperFn, groups any, states am.States, args any,
) error
}
AgentInit is an init func for extendable agents (non-top level ones).
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func NewDocument ¶
func (*Document) AddToPrompts ¶ added in v0.2.0
type GeminiClient ¶ added in v0.4.0
type GeminiClient struct {
Cfg *shared.ConfigAIGemini
C *instr.InstructorGoogle
}
type OpenAIClient ¶ added in v0.4.0
type OpenAIClient struct {
Cfg *shared.ConfigAIOpenAI
C *instr.InstructorOpenAI
}
type Prompt ¶
type Prompt[P any, R any] struct { Conditions string Steps string Result string SchemaParams P SchemaResult R State string A AgentAPI // number of previous messages to include HistoryMsgLen int Msgs []*PromptMsg // contains filtered or unexported fields }
func (*Prompt[P, R]) AddTool ¶
AddTool registers a SECAI TOOL which then exports it's documents into the system prompt. This is different from an AI tool.
func (*Prompt[P, R]) Conversation ¶ added in v0.4.0
func (p *Prompt[P, R]) Conversation() (*instrc.Conversation, string)
Conversation will create a conversation with history and system prompt, return sys prompt on the side.
func (*Prompt[P, R]) GenSysPrompt ¶ added in v0.4.0
GenSysPrompt generates a system prompt.
type PromptSchemaless ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agent_llm is a base agent extended with common LLM prompts.
|
Package agent_llm is a base agent extended with common LLM prompts. |
|
schema
Package schema contains a stateful schema-v2 for AgentLLM.
|
Package schema contains a stateful schema-v2 for AgentLLM. |
|
examples
|
|
|
cook
Package cook is a recipe-choosing and cooking agent with a gen-ai character.
|
Package cook is a recipe-choosing and cooking agent with a gen-ai character. |
|
cook/cmd
command
|
|
|
cook/scripts/gen_sql_schema
command
|
|
|
research
Package deepresearch is a port of atomic-agents/deepresearch to secai.
|
Package deepresearch is a port of atomic-agents/deepresearch to secai. |
|
research/cmd
command
|
|
|
Package schema contains a stateful schema-v2 for AgentBase, Mem, and Tool.
|
Package schema contains a stateful schema-v2 for AgentBase, Mem, and Tool. |
|
scripts
|
|
|
gen_sql_schema
command
|
|
|
tools
|
|

