Documentation
¶
Index ¶
- func WithActorStore(store *stores.ActorStore) options.Option[Engine]
- func WithContext(ctx context.Context) options.Option[Engine]
- func WithDB(db *gorm.DB) options.Option[Engine]
- func WithIdentifier(id id.ID, name string) options.Option[Engine]
- func WithInteractionFragmentStore(store *stores.FragmentStore) options.Option[Engine]
- func WithLLMClient(client *llm.LLMClient) options.Option[Engine]
- func WithLogger(logger *logger.Logger) options.Option[Engine]
- func WithManagerOrder(order []manager.ManagerID) options.Option[Engine]
- func WithManagers(_managers ...manager.Manager) options.Option[Engine]
- func WithSessionStore(store *stores.SessionStore) options.Option[Engine]
- type Engine
- func (e *Engine) AddManager(newManager manager.Manager) error
- func (e *Engine) DoesInteractionFragmentExist(fragmentID id.ID) (bool, error)
- func (e *Engine) GenerateResponse(messages []llm.Message, sessionID id.ID, tools ...toolkit.Tool) (*db.Fragment, error)
- func (e *Engine) NewState(actorId, sessionId id.ID, input string) (*state.State, error)
- func (e *Engine) NewStateFromFragment(fragment *db.Fragment) (*state.State, error)
- func (e *Engine) PostProcess(response *db.Fragment, currentState *state.State) error
- func (e *Engine) Process(currentState *state.State) error
- func (e *Engine) StartBackgroundProcesses()
- func (e *Engine) StopBackgroundProcesses()
- func (e *Engine) UpdateState(s *state.State) error
- func (e *Engine) UpsertActor(actorID id.ID, actorName string, assistant bool) error
- func (e *Engine) UpsertInteractionFragment(fragment *db.Fragment) error
- func (e *Engine) UpsertSession(sessionID id.ID) error
- func (e *Engine) ValidateRequiredFields() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithActorStore ¶
func WithActorStore(store *stores.ActorStore) options.Option[Engine]
func WithInteractionFragmentStore ¶
func WithInteractionFragmentStore(store *stores.FragmentStore) options.Option[Engine]
func WithSessionStore ¶
func WithSessionStore(store *stores.SessionStore) options.Option[Engine]
Types ¶
type Engine ¶
type Engine struct {
options.RequiredFields
ID id.ID
Name string
// contains filtered or unexported fields
}
func New ¶
New creates a new Engine instance with the provided options. Returns an error if required fields are missing or if actor creation fails.
func (*Engine) AddManager ¶
AddManager adds a new manager to the runtime. Validates that: 1. The manager ID is not duplicate 2. All manager dependencies are available Returns an error if validation fails.
func (*Engine) DoesInteractionFragmentExist ¶
func (*Engine) GenerateResponse ¶
func (e *Engine) GenerateResponse(messages []llm.Message, sessionID id.ID, tools ...toolkit.Tool) (*db.Fragment, error)
GenerateResponse creates a new response using the LLM: 1. Generates completion from provided messages 2. Creates embedding for the response 3. Builds response fragment with metadata Returns the response fragment and any error encountered.
func (*Engine) NewStateFromFragment ¶
NewState creates a new State instance with the provided options. It initializes an empty state and applies any provided configuration options.
func (*Engine) PostProcess ¶
PostProcess handles the post-processing of a response: 1. Retrieves actor and session information 2. Creates a copy of the response fragment 3. Executes all managers in sequence 4. Stores the processed response Returns an error if any step fails.
func (*Engine) Process ¶
Process handles the processing of a new input through the runtime pipeline: 1. Retrieves actor and session information 2. Creates a copy of the input fragment 3. Executes all managers in parallel 4. Stores the processed input Returns an error if any step fails.
func (*Engine) StartBackgroundProcesses ¶
func (e *Engine) StartBackgroundProcesses()
StartBackgroundProcesses initiates background processes for all managers. Each manager's background process runs in its own goroutine.
func (*Engine) StopBackgroundProcesses ¶
func (e *Engine) StopBackgroundProcesses()
StopBackgroundProcesses terminates background processes for all managers.
func (*Engine) UpdateState ¶
UpdateState applies the provided options and collects manager data