oai

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

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

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 模型选项

func (*ModelOptions) Complete

func (opts *ModelOptions) Complete()

Complete 使用默认值补全参数

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 定义模型

func (*OpenAICompatible) Init

func (d *OpenAICompatible) Init(_ context.Context) []api.Action

Init 初始化插件

func (*OpenAICompatible) Name

func (d *OpenAICompatible) Name() string

Name 返回插件名

Jump to

Keyboard shortcuts

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