httpclient

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func New(url string, opts ...client.ClientOpt) (*Client, error)

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

func (c *Client) Channel(ctx context.Context, session uuid.UUID, callback ChannelCallback) error

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

func (c *Client) DeleteConnector(ctx context.Context, rawURL string) (*schema.Connector, error)

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

func (c *Client) DeleteProvider(ctx context.Context, name string) (*schema.Provider, error)

DeleteProvider deletes a single provider by name and returns the deleted provider.

func (*Client) DeleteSession

func (c *Client) DeleteSession(ctx context.Context, id uuid.UUID) (*schema.Session, error)

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

Embedding generates embedding vectors for the given text inputs.

func (*Client) GetAgent

func (c *Client) GetAgent(ctx context.Context, name string) (*schema.AgentMeta, error)

GetAgent returns metadata for a specific agent by name.

func (*Client) GetConnector

func (c *Client) GetConnector(ctx context.Context, rawURL string) (*schema.Connector, error)

GetConnector returns a connector by URL.

func (*Client) GetModel

func (c *Client) GetModel(ctx context.Context, req schema.GetModelRequest) (*schema.Model, error)

GetModel retrieves a specific model, optionally scoped to a provider.

func (*Client) GetProvider

func (c *Client) GetProvider(ctx context.Context, name string) (*schema.Provider, error)

GetProvider returns a single provider by name.

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context, id uuid.UUID) (*schema.Session, error)

GetSession returns a session by ID.

func (*Client) GetTool

func (c *Client) GetTool(ctx context.Context, name string) (*schema.ToolMeta, error)

GetTool returns metadata for a specific tool by name.

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.

func (*Client) UpdateProvider

func (c *Client) UpdateProvider(ctx context.Context, name string, req schema.ProviderMeta) (*schema.Provider, error)

UpdateProvider patches the writable metadata for a provider by name.

func (*Client) UpdateSession

func (c *Client) UpdateSession(ctx context.Context, id uuid.UUID, meta schema.SessionMeta) (*schema.Session, error)

UpdateSession patches the metadata for a session by ID and returns the updated session.

Jump to

Keyboard shortcuts

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