Documentation
¶
Index ¶
- func NewDelegate(name, version string, connectors map[string]llm.Connector, ...) *delegate
- type ConnectorProbe
- type Manager
- func (m *Manager) Ask(ctx context.Context, request schema.AskRequest, user *auth.UserInfo, ...) (_ *schema.AskResponse, err error)
- func (m *Manager) CallAgent(ctx context.Context, name string, req schema.CallAgentRequest, ...) (result llm.Resource, err error)
- func (m *Manager) CallTool(ctx context.Context, name string, req schema.CallToolRequest, ...) (result llm.Resource, err error)
- func (m *Manager) Chat(ctx context.Context, req schema.ChatRequest, fn opt.StreamFn, ...) (_ *schema.ChatResponse, err error)
- func (m *Manager) CreateConnector(ctx context.Context, req schema.ConnectorInsert, user *auth.UserInfo) (_ *schema.Connector, _ *oidc.BaseConfiguration, _ []string, err error)
- func (m *Manager) CreateCredential(ctx context.Context, req schema.CredentialInsert) (_ *schema.Credential, err error)
- func (m *Manager) CreateProvider(ctx context.Context, req schema.ProviderInsert) (*schema.Provider, error)
- func (m *Manager) CreateSession(ctx context.Context, req schema.SessionInsert, user *auth.UserInfo) (_ *schema.Session, err error)
- func (m *Manager) CreateUsage(ctx context.Context, req schema.UsageInsert) (_ *schema.Usage, err error)
- func (m *Manager) DeleteConnector(ctx context.Context, url string) (_ *schema.Connector, err error)
- func (m *Manager) DeleteModel(ctx context.Context, req schema.DeleteModelRequest, user *auth.UserInfo) (result *schema.Model, err error)
- func (m *Manager) DeleteProvider(ctx context.Context, name string) (*schema.Provider, error)
- func (m *Manager) DeleteSession(ctx context.Context, session uuid.UUID, user *auth.UserInfo) (_ *schema.Session, err error)
- func (m *Manager) DownloadModel(ctx context.Context, req schema.DownloadModelRequest, user *auth.UserInfo, ...) (result *schema.Model, err error)
- func (m *Manager) Embedding(ctx context.Context, request schema.EmbeddingRequest, user *auth.UserInfo) (_ *schema.EmbeddingResponse, err error)
- func (m *Manager) GetAgent(ctx context.Context, name string, user *auth.UserInfo) (result *schema.AgentMeta, err error)
- func (m *Manager) GetConnector(ctx context.Context, url string, user *auth.UserInfo) (_ *schema.Connector, err error)
- func (m *Manager) GetModel(ctx context.Context, req schema.GetModelRequest, user *auth.UserInfo) (_ *schema.Model, err error)
- func (m *Manager) GetProvider(ctx context.Context, name string) (*schema.Provider, error)
- func (m *Manager) GetSession(ctx context.Context, session uuid.UUID, user *auth.UserInfo) (_ *schema.Session, err error)
- func (m *Manager) GetTool(ctx context.Context, name string, user *auth.UserInfo) (result *schema.ToolMeta, err error)
- func (m *Manager) ListAgents(ctx context.Context, req schema.AgentListRequest, user *auth.UserInfo) (result *schema.AgentList, err error)
- func (m *Manager) ListConnectors(ctx context.Context, req schema.ConnectorListRequest, user *auth.UserInfo) (_ *schema.ConnectorList, err error)
- func (m *Manager) ListMessages(ctx context.Context, req schema.MessageListRequest, user *auth.UserInfo) (_ *schema.MessageList, err error)
- func (m *Manager) ListModels(ctx context.Context, req schema.ModelListRequest, user *auth.UserInfo) (_ *schema.ModelList, err error)
- func (m *Manager) ListProviders(ctx context.Context, req schema.ProviderListRequest) (*schema.ProviderList, error)
- func (m *Manager) ListSessions(ctx context.Context, req schema.SessionListRequest, user *auth.UserInfo) (_ *schema.SessionList, err error)
- func (m *Manager) ListTools(ctx context.Context, req schema.ToolListRequest, user *auth.UserInfo) (result *schema.ToolList, err error)
- func (m *Manager) Run(ctx context.Context, logger *slog.Logger) error
- func (m *Manager) SubscribeSession(ctx context.Context, session uuid.UUID, callback SessionFeedCallback, ...) error
- func (m *Manager) SyncProviders(ctx context.Context) ([]string, []string, error)
- func (m *Manager) UpdateConnector(ctx context.Context, url string, meta schema.ConnectorMeta) (_ *schema.Connector, err error)
- func (m *Manager) UpdateProvider(ctx context.Context, name string, meta schema.ProviderMeta) (*schema.Provider, error)
- func (m *Manager) UpdateSession(ctx context.Context, session uuid.UUID, meta schema.SessionMeta, ...) (_ *schema.Session, err error)
- type Opt
- func WithClientOpts(opts ...client.ClientOpt) Opt
- func WithConnector(name string, connector llm.Connector) Opt
- func WithMeter(meter metric.Meter) Opt
- func WithNotificationChannel(name string) Opt
- func WithPassphrase(version uint64, passphrase string) Opt
- func WithPrompts(opts ...llm.Prompt) Opt
- func WithResources(opts ...llm.Resource) Opt
- func WithSchemas(llm, auth string) Opt
- func WithTools(opts ...llm.Tool) Opt
- func WithTracer(tracer trace.Tracer) Opt
- type SessionFeed
- type SessionFeedCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectorProbe ¶
type ConnectorProbe interface {
Probe(ctx context.Context, auth func(err error, config *authclient.Config) error) (*schema.ConnectorState, error)
}
We define the MCP client prober here, so we can get the details of an MCP Server before we insert it into the database. If there is a probe authentication failure, we can return the details of the auth failure to the client so they can fix it before retrying.
type Manager ¶
type Manager struct {
pg.PoolConn
*providerregistry.Registry
toolkit.Toolkit
// contains filtered or unexported fields
}
func (*Manager) Ask ¶
func (m *Manager) Ask(ctx context.Context, request schema.AskRequest, user *auth.UserInfo, fn opt.StreamFn) (_ *schema.AskResponse, err error)
Ask processes a message and returns a response, outside of a session context (stateless). If fn is non-nil, text chunks are streamed to the callback as they arrive.
func (*Manager) CallAgent ¶
func (m *Manager) CallAgent(ctx context.Context, name string, req schema.CallAgentRequest, user *auth.UserInfo) (result llm.Resource, err error)
CallAgent executes an agent by name with the given input, scoped by the user's accessible namespaces.
func (*Manager) CallTool ¶
func (m *Manager) CallTool(ctx context.Context, name string, req schema.CallToolRequest, user *auth.UserInfo) (result llm.Resource, err error)
CallTool executes a tool by name with the given input, scoped by the user's accessible namespaces.
func (*Manager) Chat ¶
func (m *Manager) Chat(ctx context.Context, req schema.ChatRequest, fn opt.StreamFn, user *auth.UserInfo, attachments ...llm.Resource) (_ *schema.ChatResponse, err error)
Chat processes a message within a session context (stateful). If fn is non-nil, text chunks are streamed to the callback as they arrive.
func (*Manager) CreateConnector ¶
func (m *Manager) CreateConnector(ctx context.Context, req schema.ConnectorInsert, user *auth.UserInfo) (_ *schema.Connector, _ *oidc.BaseConfiguration, _ []string, err error)
CreateConnector validates and persists a connector insert request.
func (*Manager) CreateCredential ¶
func (m *Manager) CreateCredential(ctx context.Context, req schema.CredentialInsert) (_ *schema.Credential, err error)
CreateCredential persists an encrypted credential row and returns the public credential shape, excluding passphrase version and encrypted payload.
func (*Manager) CreateProvider ¶
func (m *Manager) CreateProvider(ctx context.Context, req schema.ProviderInsert) (*schema.Provider, error)
CreateProvider validates a provider insert request and returns the persisted provider shape. Database persistence is not wired up yet.
func (*Manager) CreateSession ¶
func (m *Manager) CreateSession(ctx context.Context, req schema.SessionInsert, user *auth.UserInfo) (_ *schema.Session, err error)
CreateSession validates and persists a new session for the authenticated user. If Parent is set, the parent session must exist, belong to the same user, and its generator settings are used as defaults for the child session. If user is nil, it creates a user-less session.
func (*Manager) CreateUsage ¶
func (*Manager) DeleteConnector ¶
DeleteConnector removes the connector for the given URL and returns the deleted connector.
func (*Manager) DeleteModel ¶
func (*Manager) DeleteProvider ¶
DeleteProvider deletes a single provider by name and returns the deleted provider.
func (*Manager) DeleteSession ¶
func (m *Manager) DeleteSession(ctx context.Context, session uuid.UUID, user *auth.UserInfo) (_ *schema.Session, err error)
DeleteSession removes a session by ID and returns the deleted session. If user is non-nil, the session must be owned by that user.
func (*Manager) DownloadModel ¶
func (*Manager) Embedding ¶
func (m *Manager) Embedding(ctx context.Context, request schema.EmbeddingRequest, user *auth.UserInfo) (_ *schema.EmbeddingResponse, err error)
Embedding resolves an embedding-capable model for the user-scoped request and returns one output vector per input string.
func (*Manager) GetAgent ¶
func (m *Manager) GetAgent(ctx context.Context, name string, user *auth.UserInfo) (result *schema.AgentMeta, err error)
GetAgent returns agent metadata by name, scoped by the user's accessible namespaces.
func (*Manager) GetConnector ¶
func (m *Manager) GetConnector(ctx context.Context, url string, user *auth.UserInfo) (_ *schema.Connector, err error)
GetConnector returns the connector for the given URL and, when user is set, scopes access to public connectors or those accessible to the user's groups.
func (*Manager) GetProvider ¶
GetProvider returns a single provider by name.
func (*Manager) GetSession ¶
func (m *Manager) GetSession(ctx context.Context, session uuid.UUID, user *auth.UserInfo) (_ *schema.Session, err error)
GetSession returns a session by ID. If user is non-nil, the session must be owned by that user; otherwise ErrForbidden is returned.
func (*Manager) GetTool ¶
func (m *Manager) GetTool(ctx context.Context, name string, user *auth.UserInfo) (result *schema.ToolMeta, err error)
GetTool returns tool metadata by name, scoped by the user's accessible namespaces.
func (*Manager) ListAgents ¶
func (m *Manager) ListAgents(ctx context.Context, req schema.AgentListRequest, user *auth.UserInfo) (result *schema.AgentList, err error)
ListAgents returns paginated prompt metadata from the current toolkit, exposing prompts externally as agents.
func (*Manager) ListConnectors ¶
func (m *Manager) ListConnectors(ctx context.Context, req schema.ConnectorListRequest, user *auth.UserInfo) (_ *schema.ConnectorList, err error)
ListConnectors lists connectors matching the request and, when user is set, filters results to public connectors or those accessible to the user's groups.
func (*Manager) ListMessages ¶
func (m *Manager) ListMessages(ctx context.Context, req schema.MessageListRequest, user *auth.UserInfo) (_ *schema.MessageList, err error)
ListMessages returns messages for a single session, optionally filtered by request fields. If user is non-nil, the session must be owned by that user.
func (*Manager) ListModels ¶
func (*Manager) ListProviders ¶
func (m *Manager) ListProviders(ctx context.Context, req schema.ProviderListRequest) (*schema.ProviderList, error)
ListProviders returns a list of providers matching the given request parameters.
func (*Manager) ListSessions ¶
func (m *Manager) ListSessions(ctx context.Context, req schema.SessionListRequest, user *auth.UserInfo) (_ *schema.SessionList, err error)
ListSessions returns a paginated list of sessions matching the request. If user is non-nil, only sessions owned by that user are returned.
func (*Manager) ListTools ¶
func (m *Manager) ListTools(ctx context.Context, req schema.ToolListRequest, user *auth.UserInfo) (result *schema.ToolList, err error)
ListTools returns paginated tool metadata from the current toolkit.
func (*Manager) SubscribeSession ¶
func (m *Manager) SubscribeSession(ctx context.Context, session uuid.UUID, callback SessionFeedCallback, user *auth.UserInfo) error
SubscribeSession registers a callback for new persisted messages for a session. The subscription is automatically removed when ctx is canceled.
func (*Manager) SyncProviders ¶
SyncProviders refreshes the in-memory provider registry from the database.
func (*Manager) UpdateConnector ¶
func (m *Manager) UpdateConnector(ctx context.Context, url string, meta schema.ConnectorMeta) (_ *schema.Connector, err error)
UpdateConnector updates the user-editable metadata for the connector and returns the updated connector.
func (*Manager) UpdateProvider ¶
func (m *Manager) UpdateProvider(ctx context.Context, name string, meta schema.ProviderMeta) (*schema.Provider, error)
UpdateProvider updates the writable metadata for a provider by name and returns the updated provider.
func (*Manager) UpdateSession ¶
func (m *Manager) UpdateSession(ctx context.Context, session uuid.UUID, meta schema.SessionMeta, user *auth.UserInfo) (_ *schema.Session, err error)
UpdateSession updates the metadata for a session and returns the updated session. If user is non-nil, the session must be owned by that user. The incoming GeneratorMeta is merged over the existing one (incoming fields win).
type Opt ¶
type Opt func(*manageropt) error
Opt configures a Manager during construction.
func WithClientOpts ¶
WithClientOpts provides unified client options for the LLM model providers and connectors
func WithConnector ¶
WithConnector adds a runtime-local connector to the manager by identifier.
func WithNotificationChannel ¶
WithNotificationChannel sets the PostgreSQL LISTEN/NOTIFY channel used by the provider table change trigger created during bootstrap.
func WithPassphrase ¶
WithPassphrase registers an in-memory storage passphrase for a certificate passphrase version. Versions are uint64 and passphrases must be non-empty.
func WithPrompts ¶
WithPrompts provides unified prompt options for the LLM model providers
func WithResources ¶
WithResources provides unified resource options for the LLM model providers
func WithSchemas ¶
WithSchemas sets the database schema names to use for all queries. If not set the default schemas are used.
func WithTracer ¶
WithTracer sets the OpenTelemetry tracer used for manager spans.
type SessionFeed ¶
func NewSessionFeed ¶
func (*SessionFeed) Subscribe ¶
func (s *SessionFeed) Subscribe(ctx context.Context, session uuid.UUID, callback SessionFeedCallback) error