deepseek

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultModel = "deepseek-v4-flash"
)
View Source
const ProviderName = "deepseek"

ProviderName is the registry key under which this client registers.

Variables

This section is empty.

Functions

func Factory

func Factory(cfg llm.APIConfig, model string, opts ...llm.Option) (llm.Client, error)

Factory adapts New into a llm.ClientFactory. Registered into pkg/llm.DefaultRegistry() by pkg/llm/builtins; downstream apps that want to register DeepSeek on a non-default registry can call this directly.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements llm.Client backed by DeepSeek's OpenAI-compatible chat API.

func New

func New(cfg llm.APIConfig, model string, opts ...llm.Option) *Client

New builds a DeepSeek client from provider config and applies the given options. Options can be re-applied at runtime via Apply.

func (*Client) Apply

func (c *Client) Apply(opts ...llm.Option)

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, messages []llm.Message, toolSet []tools.Tool) (llm.Response, error)

func (*Client) Model

func (c *Client) Model() string

func (*Client) Name

func (c *Client) Name() string

Name provider name

func (*Client) SetModel

func (c *Client) SetModel(m string)

func (*Client) Stream

func (c *Client) Stream(ctx context.Context, messages []llm.Message, toolSet []tools.Tool, sink llm.ChunkSink) (llm.Response, error)

Stream is the chunked variant of Complete. It opens a streaming SSE connection to DeepSeek's chat endpoint, forwards each delta to sink as a Chunk, and returns the fully-assembled Response (content, thinking, tool calls, usage) once the server emits its terminal data: [DONE] frame.

On context cancellation the underlying request transport aborts; the scanner loop honors ctx.Err() between reads and returns llm.ErrInterrupted in that case so the agent's interrupt path treats it like any other cancelled completion.

Jump to

Keyboard shortcuts

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