Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enable ¶
func Enable(apiKey, modelName, baseURL, actionName string) sdk.ClientOption
Enable returns a ClientOption that wires the OpenAI provider. usage: client.New(..., openai.Enable("key", "gpt-4o", "", "my_action"))
Types ¶
type Config ¶
type Config struct {
APIKey string
BaseURL string // Crucial for Ollama/LocalAI/OpenRouter support
}
Config holds connection parameters.
type LLM ¶
type LLM struct {
// contains filtered or unexported fields
}
LLM is an OpenAI-compatible LLM implementation. It wraps the Genkit plugin to provide core.TextGenerator interface.
func NewLLM ¶
NewLLM creates a new OpenAI LLM client. If baseURL is empty, it defaults to OpenAI's API. If modelName is empty, it defaults to "gpt-3.5-turbo".
type OpenAIEmbedder ¶
type OpenAIEmbedder struct {
// contains filtered or unexported fields
}
OpenAIEmbedder implements core.Embedder using OpenAI's embedding API.
func NewEmbedder ¶
func NewEmbedder(apiKey, baseURL, modelName string) (*OpenAIEmbedder, error)
NewEmbedder creates a new embedder using OpenAI. Default model: "text-embedding-3-small" (1536 dimensions) Supported models: "text-embedding-3-small", "text-embedding-3-large", "text-embedding-ada-002"
func (*OpenAIEmbedder) Dimension ¶
func (e *OpenAIEmbedder) Dimension() int
Dimension returns the vector size for the configured model. Known models as of 2025-05:
text-embedding-3-small → 1536 text-embedding-3-large → 3072 text-embedding-ada-002 → 1536
Returns 0 for unknown models so callers can fail explicitly rather than silently mismatching dimensions.
func (*OpenAIEmbedder) EmbedBatch ¶
EmbedBatch generates vectors for multiple strings.