dsc

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package dsc provides deepseek client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceResponse

type BalanceResponse struct {
	IsAvailable  bool                `json:"is_available"`
	BalanceInfos []map[string]string `json:"balance_infos"`
}

type ChatRequest

type ChatRequest struct {
	Model     string             `json:"model"`
	Messages  []toolcall.Message `json:"messages"`
	Tools     []toolcall.Tool    `json:"tools,omitempty"`
	Stream    bool               `json:"stream"`
	MaxTokens int                `json:"max_tokens,omitempty"`
}

ChatRequest 扩展,支持 tools

type ChatResponse

type ChatResponse struct {
	ID      string   `json:"id"`
	Choices []Choice `json:"choices"`
}

ChatResponse 响应

type Choice

type Choice struct {
	Message      toolcall.Message `json:"message"`
	FinishReason string           `json:"finish_reason"`
}

type Client

type Client interface {
	Models() (*ModelsResponse, error)
	Balance() (*BalanceResponse, error)
	FIM(ctx context.Context, prompt, suffix string, maxTokens int, temperature float64) (*FIMResponse, error)
	Chat(ctx context.Context, messages []toolcall.Message, tools []toolcall.Tool) (*ChatResponse, error)
}

func NewClient

func NewClient(apiKey, baseURL string) Client

type Deepseek

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

func (*Deepseek) Balance

func (c *Deepseek) Balance() (*BalanceResponse, error)

Balance 获取余额信息

func (*Deepseek) Chat

func (c *Deepseek) Chat(ctx context.Context, messages []toolcall.Message, tools []toolcall.Tool) (*ChatResponse, error)

Chat 发送聊天请求

func (*Deepseek) FIM

func (c *Deepseek) FIM(ctx context.Context, prompt, suffix string, maxTokens int, temperature float64) (*FIMResponse, error)

FIM 实现填充中间代码功能

func (*Deepseek) Models

func (c *Deepseek) Models() (*ModelsResponse, error)

Models 获取模型列表

type FIMChoice

type FIMChoice struct {
	Text string `json:"text"`
}

type FIMRequest

type FIMRequest struct {
	Model       string  `json:"model"`
	Prompt      string  `json:"prompt"`
	Suffix      string  `json:"suffix,omitempty"`
	MaxTokens   int     `json:"max_tokens,omitempty"`
	Temperature float64 `json:"temperature,omitempty"`
}

type FIMResponse

type FIMResponse struct {
	ID      string      `json:"id"`
	Choices []FIMChoice `json:"choices"`
}

type Model

type Model struct {
	ID      string `json:"id"`
	Object  string `json:"object"`
	OwnedBy string `json:"owned_by"`
}

type ModelsResponse

type ModelsResponse struct {
	Object string  `json:"object"`
	Data   []Model `json:"data"`
}

Source Files

  • client.go
  • dsc.go
  • dsc_chat.go
  • dsc_chat_stream.go

Jump to

Keyboard shortcuts

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