Documentation
¶
Index ¶
- func NewChatModel(opts ...OptionFunc) (model.ToolCallingChatModel, error)
- func NewEmbModel(opts ...OptionFunc) (embedding.Embedder, error)
- func OutMessageEinoToOpenai(msg *schema.Message) *openai2.ChatCompletionResponse
- func OutStreamMessageEinoToOpenai(msg *schema.Message, index int) *openai2.ChatCompletionStreamResponse
- type Option
- type OptionFunc
- func WithAPIKey(apiKey string) OptionFunc
- func WithBaseUrl(baseUrl string) OptionFunc
- func WithDimensions(dimensions int) OptionFunc
- func WithMaxTokens(maxTokens int) OptionFunc
- func WithModel(model string) OptionFunc
- func WithPlatform(platform string) OptionFunc
- func WithReasoningEffortLevel(reasoningEffortLevel openai.ReasoningEffortLevel) OptionFunc
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 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
Click to show internal directories.
Click to hide internal directories.