llms

package
v0.0.0-...-eb553c6 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat interface {
	ID() string
	Chat(string, func([]byte) error) error
	ChatRaw(string, func([]byte) error) error
	Stop()
	Print() *ChatData
	Restore(*ChatData)
}

type ChatData

type ChatData struct {
	Messages   []*Message `json:"history"`
	ServerAddr string     `json:"uri"`
	Model      string     `json:"model"`
	ID         string     `json:"id"`
	ApiKey     string     `json:"api_key"`
	Timeout    int64      `json:"timeout"`
	LastUpdate int64      `json:"last_update"`
	MaxContext int        `json:"max_context"`
	ChatType   ChatType   `json:"chat_type"`
}

func (*ChatData) FromJSON

func (cd *ChatData) FromJSON(s string) error

func (*ChatData) ToJSON

func (cd *ChatData) ToJSON() string

type ChatRequest

type ChatRequest struct {
	Messages []*Message `json:"messages"`
	Model    string     `json:"model"`
	Stream   bool       `json:"stream"` // 设置为 false 获取非流式响应
}

func (*ChatRequest) Marshal

func (cr *ChatRequest) Marshal() []byte

type ChatType

type ChatType byte
const (
	Ollama ChatType = iota
	VolcEngine
)

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type Storage

type Storage interface {
	Store(*ChatData) error
	Load() (map[string]*ChatData, error)
	Clear()
	RemoveDead(time.Duration)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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