deepseek

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

deepseek implements an API client for Deepseek's LLM https://api-docs.deepseek.com/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
	*impl.ModelCache
}

func New

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

Create a new client

func (*Client) ListModels

func (deepseek *Client) ListModels(ctx context.Context) ([]Model, error)

ListModels returns all the models

func (*Client) Model

func (deepseek *Client) Model(ctx context.Context, name string) llm.Model

Return a model by name, or nil if not found. Panics on error.

func (*Client) Models

func (deepseek *Client) Models(ctx context.Context) ([]llm.Model, error)

Return the models

func (Client) Name

func (Client) Name() string

Return the name of the agent

type Completion

type Completion struct {
	Index   uint64   `json:"index"`
	Message *Message `json:"message"`
	Delta   *Message `json:"delta,omitempty"` // For streaming
	Reason  string   `json:"finish_reason,omitempty"`
}

Completion Variation

func (Completion) String

func (c Completion) String() string

type Completions

type Completions []Completion

Completion choices

func (Completions) Attachment

func (c Completions) Attachment(index int) *llm.Attachment

Return attachment content for a specific completion

func (Completions) Choice

func (c Completions) Choice(index int) llm.Completion

Return message for a specific completion

func (Completions) Num

func (c Completions) Num() int

Return the number of completions

func (Completions) Role

func (c Completions) Role() string

Return the role of the completion

func (Completions) Text

func (c Completions) Text(index int) string

Return the text content for a specific completion

func (Completions) ToolCalls

func (c Completions) ToolCalls(index int) []llm.ToolCall

Return the current session tool calls given the completion index. Will return nil if no tool calls were returned.

type Message

type Message struct {
	RoleContent
}

Message with text or object content

func (*Message) Attachment

func (message *Message) Attachment(index int) *llm.Attachment

No attachments

func (*Message) Choice

func (message *Message) Choice(index int) llm.Completion

Return the completion

func (Message) Num

func (Message) Num() int

Return the number of completions

func (*Message) Role

func (message *Message) Role() string

Return the current session role

func (*Message) Text

func (message *Message) Text(index int) string

Return the text for the last completion

func (*Message) ToolCalls

func (message *Message) ToolCalls(index int) []llm.ToolCall

No tool calls

type Metrics

type Metrics struct {
	PromptTokens       uint64 `json:"prompt_tokens,omitempty"`
	CompletionTokens   uint64 `json:"completion_tokens,omitempty"`
	TotalTokens        uint64 `json:"total_tokens,omitempty"`
	PromptTokenDetails struct {
		CachedTokens uint64 `json:"cached_tokens,omitempty"`
		AudioTokens  uint64 `json:"audio_tokens,omitempty"`
	} `json:"prompt_tokens_details,omitempty"`
	CompletionTokenDetails struct {
		ReasoningTokens          uint64 `json:"reasoning_tokens,omitempty"`
		AcceptedPredictionTokens uint64 `json:"accepted_prediction_tokens,omitempty"`
		RejectedPredictionTokens uint64 `json:"rejected_prediction_tokens,omitempty"`
	} `json:"completion_tokens_details,omitempty"`
}

Metrics

func (Metrics) String

func (m Metrics) String() string

type Model

type Model struct {
	Name    string `json:"id"`
	Type    string `json:"object"`
	OwnedBy string `json:"owned_by"`
}

type Response

type Response struct {
	Id                string `json:"id"`
	Type              string `json:"object"`
	Created           uint64 `json:"created"`
	Model             string `json:"model"`
	SystemFingerprint string `json:"system_fingerprint"`
	ServiceTier       string `json:"service_tier"`
	Completions       `json:"choices"`
	*Metrics          `json:"usage,omitempty"`
}

Completion Response

func (Response) String

func (r Response) String() string

type RoleContent

type RoleContent struct {
	Role    string `json:"role,omitempty"`    // assistant, user, tool, system
	Content string `json:"content,omitempty"` // string
}

Jump to

Keyboard shortcuts

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