Documentation ¶
Overview ¶
Package embedding contains the implementation to create vector embeddings from text using different APIs
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureOpenAIOptions ¶ added in v0.0.26
type AzureOpenAIOptions struct { OpenAIOptions APIVersion string Deployment string }
type Cohere ¶ added in v0.0.39
type Cohere struct {
// contains filtered or unexported fields
}
Cohere is a client for the Cohere API.
func NewCohere ¶ added in v0.0.39
func NewCohere(apiKey string, optFns ...func(o *CohereOptions)) (*Cohere, error)
NewCohere creates a new Cohere instance with the provided API key and options. It returns the initialized Cohere instance or an error if initialization fails.
func NewCohereFromClient ¶ added in v0.0.39
func NewCohereFromClient(client CohereClient, optFns ...func(o *CohereOptions)) (*Cohere, error)
NewCohereFromClient creates a new Cohere instance from an existing Cohere client and options. It returns the initialized Cohere instance.
func (*Cohere) EmbedDocuments ¶ added in v0.0.39
EmbedDocuments embeds a list of documents and returns their embeddings.
type CohereClient ¶ added in v0.0.39
type CohereClient interface {
Embed(opts cohere.EmbedOptions) (*cohere.EmbedResponse, error)
}
CohereClient is an interface for the Cohere client.
type CohereOptions ¶ added in v0.0.39
type CohereOptions struct { // Model name to use. Model string // Truncate embeddings that are too long from start or end ("NONE"|"START"|"END") Truncate string }
CohereOptions contains options for configuring the Cohere instance.
type Fake ¶
type Fake struct {
Size int
}
func (*Fake) EmbedDocuments ¶
EmbedDocuments embeds a list of documents and returns their embeddings.
type OpenAI ¶ added in v0.0.6
type OpenAI struct {
// contains filtered or unexported fields
}
func NewAzureOpenAI ¶ added in v0.0.26
func NewAzureOpenAI(apiKey, baseURL string, optFns ...func(o *AzureOpenAIOptions)) (*OpenAI, error)
func NewOpenAI ¶ added in v0.0.6
func NewOpenAI(apiKey string, optFns ...func(o *OpenAIOptions)) (*OpenAI, error)
func NewOpenAIFromClient ¶ added in v0.0.38
func NewOpenAIFromClient(client *openai.Client, optFns ...func(o *OpenAIOptions)) (*OpenAI, error)
func (*OpenAI) EmbedDocuments ¶ added in v0.0.6
EmbedDocuments embeds a list of documents and returns their embeddings.
type OpenAIOptions ¶ added in v0.0.6
type OpenAIOptions struct { // Model name to use. ModelName string EmbeddingContextLength int // Maximum number of texts to embed in each batch ChunkSize int // BaseURL is the base URL of the OpenAI service. BaseURL string // OrgID is the organization ID for accessing the OpenAI service. OrgID string }
type Palm ¶ added in v0.0.38
type Palm struct {
// contains filtered or unexported fields
}
Palm is a client for the Palm embedding service.
func NewPalm ¶ added in v0.0.38
func NewPalm(client PalmClient, optFns ...func(o *PalmOptions)) *Palm
NewPalm creates a new instance of the Palm client.
func (*Palm) EmbedDocuments ¶ added in v0.0.38
EmbedDocuments embeds a list of documents and returns their embeddings.
type PalmClient ¶ added in v0.0.38
type PalmClient interface {
EmbedText(context.Context, *generativelanguagepb.EmbedTextRequest, ...gax.CallOption) (*generativelanguagepb.EmbedTextResponse, error)
}
PalmClient is an interface for the Palm client.
type PalmOptions ¶ added in v0.0.38
type PalmOptions struct {
ModelName string
}
PalmOptions contains options for configuring the Palm client.