Documentation
¶
Index ¶
- type ChannelCallback
- type Client
- func (c *Client) Ask(ctx context.Context, req schema.AskRequest, streamFn opt.StreamFn) (*schema.AskResponse, error)
- func (c *Client) CallAgent(ctx context.Context, name string, req schema.CallAgentRequest) (llm.Resource, error)
- func (c *Client) CallTool(ctx context.Context, name string, req schema.CallToolRequest) (llm.Resource, error)
- func (c *Client) Channel(ctx context.Context, session uuid.UUID, callback ChannelCallback) error
- func (c *Client) Chat(ctx context.Context, req schema.ChatRequest, streamFn opt.StreamFn) (*schema.ChatResponse, error)
- func (c *Client) CreateConnector(ctx context.Context, req schema.ConnectorInsert) (*schema.Connector, error)
- func (c *Client) CreateProvider(ctx context.Context, req schema.ProviderInsert) (*schema.Provider, error)
- func (c *Client) CreateSession(ctx context.Context, req schema.SessionInsert) (*schema.Session, error)
- func (c *Client) DeleteConnector(ctx context.Context, rawURL string) (*schema.Connector, error)
- func (c *Client) DeleteModel(ctx context.Context, req schema.DeleteModelRequest) (*schema.Model, error)
- func (c *Client) DeleteProvider(ctx context.Context, name string) (*schema.Provider, error)
- func (c *Client) DeleteSession(ctx context.Context, id uuid.UUID) (*schema.Session, error)
- func (c *Client) DownloadModel(ctx context.Context, req schema.DownloadModelRequest, ...) (*schema.Model, error)
- func (c *Client) Embedding(ctx context.Context, req schema.EmbeddingRequest) (*schema.EmbeddingResponse, error)
- func (c *Client) GetAgent(ctx context.Context, name string) (*schema.AgentMeta, error)
- func (c *Client) GetConnector(ctx context.Context, rawURL string) (*schema.Connector, error)
- func (c *Client) GetModel(ctx context.Context, req schema.GetModelRequest) (*schema.Model, error)
- func (c *Client) GetProvider(ctx context.Context, name string) (*schema.Provider, error)
- func (c *Client) GetSession(ctx context.Context, id uuid.UUID) (*schema.Session, error)
- func (c *Client) GetTool(ctx context.Context, name string) (*schema.ToolMeta, error)
- func (c *Client) ListAgents(ctx context.Context, req schema.AgentListRequest) (*schema.AgentList, error)
- func (c *Client) ListConnectors(ctx context.Context, req schema.ConnectorListRequest) (*schema.ConnectorList, error)
- func (c *Client) ListMessages(ctx context.Context, session uuid.UUID, req schema.MessageListRequest) (*schema.MessageList, error)
- func (c *Client) ListModels(ctx context.Context, req schema.ModelListRequest) (*schema.ModelList, error)
- func (c *Client) ListProviders(ctx context.Context, req schema.ProviderListRequest) (*schema.ProviderList, error)
- func (c *Client) ListSessions(ctx context.Context, req schema.SessionListRequest) (*schema.SessionList, error)
- func (c *Client) ListTools(ctx context.Context, req schema.ToolListRequest) (*schema.ToolList, error)
- func (c *Client) UpdateConnector(ctx context.Context, rawURL string, req schema.ConnectorMeta) (*schema.Connector, error)
- func (c *Client) UpdateProvider(ctx context.Context, name string, req schema.ProviderMeta) (*schema.Provider, error)
- func (c *Client) UpdateSession(ctx context.Context, id uuid.UUID, meta schema.SessionMeta) (*schema.Session, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelCallback ¶
type ChannelCallback func(context.Context, client.JSONStream) error
ChannelCallback is the low-level callback used to drive the session channel. This is intentionally a thin wrapper over the underlying NDJSON stream so the channel can be used as a debug endpoint while the higher-level protocol is in flux.
type Client ¶
type Client struct {
*authclient.Client
}
Client is an LLM HTTP client that wraps the base HTTP client and provides typed methods for interacting with the LLM API.
func New ¶
New creates a new LLM HTTP client with the given base URL and options. The url parameter should point to the LLM API endpoint, e.g. "http://localhost:8084/api".
func (*Client) Ask ¶
func (c *Client) Ask(ctx context.Context, req schema.AskRequest, streamFn opt.StreamFn) (*schema.AskResponse, error)
Ask sends a stateless ask request and returns the final response. When streamFn is non-nil, the request is made as an SSE stream and streamed delta events are dispatched to the callback before the final result is returned.
func (*Client) CallAgent ¶
func (c *Client) CallAgent(ctx context.Context, name string, req schema.CallAgentRequest) (llm.Resource, error)
CallAgent executes an agent and returns the raw result as an llm.Resource.
func (*Client) CallTool ¶
func (c *Client) CallTool(ctx context.Context, name string, req schema.CallToolRequest) (llm.Resource, error)
CallTool executes a tool and returns the raw result as an llm.Resource.
func (*Client) Channel ¶
Channel opens a bidirectional NDJSON stream for an existing session.
The callback receives the raw stream so callers can send and receive frames directly while the session channel protocol is still evolving.
func (*Client) Chat ¶
func (c *Client) Chat(ctx context.Context, req schema.ChatRequest, streamFn opt.StreamFn) (*schema.ChatResponse, error)
Chat sends a stateful chat request and returns the final response. When streamFn is non-nil, the request is made as an SSE stream and streamed delta events are dispatched to the callback before the final result is returned.
func (*Client) CreateConnector ¶
func (c *Client) CreateConnector(ctx context.Context, req schema.ConnectorInsert) (*schema.Connector, error)
CreateConnector creates a new connector with the given insert data.
func (*Client) CreateProvider ¶
func (c *Client) CreateProvider(ctx context.Context, req schema.ProviderInsert) (*schema.Provider, error)
CreateProvider creates a new provider with the given insert data.
func (*Client) CreateSession ¶
func (c *Client) CreateSession(ctx context.Context, req schema.SessionInsert) (*schema.Session, error)
CreateSession creates a new session with the given insert data.
func (*Client) DeleteConnector ¶
DeleteConnector deletes a connector and returns the deleted connector.
func (*Client) DeleteModel ¶
func (c *Client) DeleteModel(ctx context.Context, req schema.DeleteModelRequest) (*schema.Model, error)
DeleteModel deletes a specific model and returns the deleted model.
func (*Client) DeleteProvider ¶
DeleteProvider deletes a single provider by name and returns the deleted provider.
func (*Client) DeleteSession ¶
DeleteSession deletes a session by ID and returns the deleted session.
func (*Client) DownloadModel ¶
func (c *Client) DownloadModel(ctx context.Context, req schema.DownloadModelRequest, progressFn opt.ProgressFn) (*schema.Model, error)
DownloadModel downloads a model using the given request. When progressFn is non-nil, the request is made as an SSE stream and the callback is invoked for progress events.
func (*Client) Embedding ¶
func (c *Client) Embedding(ctx context.Context, req schema.EmbeddingRequest) (*schema.EmbeddingResponse, error)
Embedding generates embedding vectors for the given text inputs.
func (*Client) GetConnector ¶
GetConnector returns a connector by URL.
func (*Client) GetProvider ¶
GetProvider returns a single provider by name.
func (*Client) GetSession ¶
GetSession returns a session by ID.
func (*Client) ListAgents ¶
func (c *Client) ListAgents(ctx context.Context, req schema.AgentListRequest) (*schema.AgentList, error)
ListAgents returns externally exposed agents matching the given request parameters.
func (*Client) ListConnectors ¶
func (c *Client) ListConnectors(ctx context.Context, req schema.ConnectorListRequest) (*schema.ConnectorList, error)
ListConnectors returns connectors matching the given request parameters.
func (*Client) ListMessages ¶
func (c *Client) ListMessages(ctx context.Context, session uuid.UUID, req schema.MessageListRequest) (*schema.MessageList, error)
ListMessages returns a paginated list of messages for the given session.
func (*Client) ListModels ¶
func (c *Client) ListModels(ctx context.Context, req schema.ModelListRequest) (*schema.ModelList, error)
ListModels returns a list of models matching the given request parameters.
func (*Client) ListProviders ¶
func (c *Client) ListProviders(ctx context.Context, req schema.ProviderListRequest) (*schema.ProviderList, error)
ListProviders returns a list of providers matching the given request parameters.
func (*Client) ListSessions ¶
func (c *Client) ListSessions(ctx context.Context, req schema.SessionListRequest) (*schema.SessionList, error)
ListSessions returns a paginated list of sessions matching the request.
func (*Client) ListTools ¶
func (c *Client) ListTools(ctx context.Context, req schema.ToolListRequest) (*schema.ToolList, error)
ListTools returns tools matching the given request parameters.
func (*Client) UpdateConnector ¶
func (c *Client) UpdateConnector(ctx context.Context, rawURL string, req schema.ConnectorMeta) (*schema.Connector, error)
UpdateConnector patches connector metadata for the given URL.