model

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChatModel

func NewChatModel(opts ...OptionFunc) (model.ToolCallingChatModel, error)

func NewEmbModel

func NewEmbModel(opts ...OptionFunc) (embedding.Embedder, error)

func OutMessageEinoToOpenai

func OutMessageEinoToOpenai(msg *schema.Message) *openai2.ChatCompletionResponse

OutMessageEinoToOpenai 将 Eino 的 schema.Message 转换为 OpenAI 的 ChatCompletionResponse 该方法用于将模型返回的消息转换为 OpenAI API 格式的响应 参数:

  • msg: Eino schema.Message 对象,包含模型返回的消息内容

返回:

  • *openai2.ChatCompletionResponse: OpenAI 格式的聊天完成响应对象

func OutStreamMessageEinoToOpenai

func OutStreamMessageEinoToOpenai(msg *schema.Message, index int) *openai2.ChatCompletionStreamResponse

OutStreamMessageEinoToOpenai 将 schema.Message 转换为 ChatCompletionStreamResponse 这是一个辅助方法,用于在流式处理中将每个消息块转换为 OpenAI 格式 参数:

  • msg: schema.Message 对象
  • index: 当前消息在流中的索引

返回:

  • *openai2.ChatCompletionStreamResponse: OpenAI 格式的流式响应块

Types

type Option

type Option struct {
	Platform   string
	Model      string
	BaseUrl    string
	APIKey     string `json:"apiKey"`
	Dimensions int
	MaxTokens  int

	//openai参数
	ReasoningEffortLevel openai.ReasoningEffortLevel
}

type OptionFunc

type OptionFunc func(option *Option)

func WithAPIKey

func WithAPIKey(apiKey string) OptionFunc

func WithBaseUrl

func WithBaseUrl(baseUrl string) OptionFunc

func WithDimensions

func WithDimensions(dimensions int) OptionFunc

func WithMaxTokens

func WithMaxTokens(maxTokens int) OptionFunc

func WithModel

func WithModel(model string) OptionFunc

func WithPlatform

func WithPlatform(platform string) OptionFunc

func WithReasoningEffortLevel

func WithReasoningEffortLevel(reasoningEffortLevel openai.ReasoningEffortLevel) OptionFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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