Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ModelGenerator ¶
type ModelGenerator struct {
// contains filtered or unexported fields
}
ModelGenerator 模型生成器
func NewModelGenerator ¶
func NewModelGenerator(client *openai.Client, req *ai.ModelRequest, opts ModelOptions) *ModelGenerator
NewModelGenerator 创建模型生成器
func (*ModelGenerator) Generate ¶
func (g *ModelGenerator) Generate( ctx context.Context, req *ai.ModelRequest, handleChunk core.StreamCallback[*ai.ModelResponseChunk], ) (*ai.ModelResponse, error)
Generate 生成
func (*ModelGenerator) WithMessages ¶
func (g *ModelGenerator) WithMessages(messages []*ai.Message) *ModelGenerator
WithMessages 添加消息到生成器
func (*ModelGenerator) WithTools ¶
func (g *ModelGenerator) WithTools(tools []*ai.ToolDefinition) *ModelGenerator
WithTools 添加工具到生成器
type ModelOptions ¶
type ModelOptions struct {
ai.ModelOptions
// 是否开启思考模式
Reasoning bool
// 开启思考模式的参数
EnableReasoningExtraFields map[string]any
// 关闭思考模式的参数
DisableReasoningExtraFields map[string]any
// 思考内容字段
ReasoningContentField string
}
ModelOptions 模型选项
type OpenAICompatible ¶
type OpenAICompatible struct {
Provider string
BaseURL string
APIKey string
// contains filtered or unexported fields
}
OpenAICompatible OpenAI 兼容模型插件
func (*OpenAICompatible) DefineModel ¶
func (d *OpenAICompatible) DefineModel(g *genkit.Genkit, opts ModelOptions) ai.Model
DefineModel 定义模型
Click to show internal directories.
Click to hide internal directories.