Documentation
¶
Index ¶
- func ResolvePendingTool(ctx context.Context, session *copilot.Session, requestID, result string) error
- type Client
- func (c *Client) CreateSession(ctx context.Context, cfg *copilot.SessionConfig) (*copilot.Session, error)
- func (c *Client) ListModels(ctx context.Context) ([]copilot.ModelInfo, error)
- func (c *Client) NewChatSession(ctx context.Context, model, systemMessage string, streaming bool) (*copilot.Session, error)
- func (c *Client) NewChatSessionWithTools(ctx context.Context, model, systemMessage string, streaming bool, ...) (*copilot.Session, error)
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolvePendingTool ¶ added in v0.4.0
func ResolvePendingTool(ctx context.Context, session *copilot.Session, requestID, result string) error
ResolvePendingTool delivers a result for a pending external tool call on a live session. A declaration-only tool (nil handler) leaves the model's call pending — surfaced as a *copilot.ExternalToolRequestedData carrying a RequestID — instead of running a handler. Calling this resolves that exact pending call from outside any handler, letting the original agent loop continue to its final answer. This is the mechanism behind faithful OpenAI tool round-trips ("session parking"): the turn-1 session is kept alive and its pending call is resolved on turn-2 with the client-supplied result.
requestID comes from the ExternalToolRequestedData event captured on turn-1.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Copilot SDK client with lifecycle management.
func (*Client) CreateSession ¶
func (c *Client) CreateSession(ctx context.Context, cfg *copilot.SessionConfig) (*copilot.Session, error)
CreateSession creates a new Copilot session with the given configuration.
func (*Client) ListModels ¶
ListModels returns the available models from the Copilot CLI.
func (*Client) NewChatSession ¶ added in v0.2.0
func (c *Client) NewChatSession(ctx context.Context, model, systemMessage string, streaming bool) (*copilot.Session, error)
NewChatSession creates a new Copilot chat session with common defaults. This is a convenience method that both OpenAI and Ollama handlers can use without depending on each other's types.
func (*Client) NewChatSessionWithTools ¶ added in v0.4.0
func (c *Client) NewChatSessionWithTools(ctx context.Context, model, systemMessage string, streaming bool, tools []copilot.Tool) (*copilot.Session, error)
NewChatSessionWithTools is like NewChatSession but also exposes caller-defined tools to the model. When tools is non-empty, only those tools are made available (built-in agentic tools stay disabled); when it is empty the behavior is identical to NewChatSession.