Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetImplSpecificOptions ¶ added in v0.3.6
GetImplSpecificOptions extract the implementation specific options from Option list, optionally providing a base options with default values. e.g.
myOption := &MyOption{
Field1: "default_value",
}
myOption := model.GetImplSpecificOptions(myOption, opts...)
Types ¶
type CallbackInput ¶
type CallbackInput struct {
// Texts is the texts to be embedded.
Texts []string
// Config is the config for the embedding.
Config *Config
// Extra is the extra information for the callback.
Extra map[string]any
}
CallbackInput is the input for the embedding callback.
func ConvCallbackInput ¶
func ConvCallbackInput(src callbacks.CallbackInput) *CallbackInput
ConvCallbackInput converts the callback input to the embedding callback input.
type CallbackOutput ¶
type CallbackOutput struct {
// Embeddings is the embeddings.
Embeddings [][]float64
// Config is the config for creating the embedding.
Config *Config
// TokenUsage is the token usage for the embedding.
TokenUsage *TokenUsage
// Extra is the extra information for the callback.
Extra map[string]any
}
CallbackOutput is the output for the embedding callback.
func ConvCallbackOutput ¶
func ConvCallbackOutput(src callbacks.CallbackOutput) *CallbackOutput
ConvCallbackOutput converts the callback output to the embedding callback output.
type ComponentExtra ¶
type ComponentExtra struct {
// Config is the config for the embedding.
Config *Config
// TokenUsage is the token usage for the embedding.
TokenUsage *TokenUsage
}
ComponentExtra is the extra information for the embedding.
type Config ¶
type Config struct {
// Model is the model name.
Model string
// EncodingFormat is the encoding format.
EncodingFormat string
}
Config is the config for the embedding.
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option is the call option for Embedder component.
func WrapImplSpecificOptFn ¶ added in v0.3.6
WrapImplSpecificOptFn is the option to wrap the implementation specific option function.
type Options ¶
type Options struct {
// Model is the model name for the embedding.
Model *string
}
Options is the options for the embedding.
func GetCommonOptions ¶
GetCommonOptions extract embedding Options from Option list, optionally providing a base Options with default values. eg.
defaultModelName := "default_model"
embeddingOption := &embedding.Options{
Model: &defaultModelName,
}
embeddingOption := embedding.GetCommonOptions(embeddingOption, opts...)
type TokenUsage ¶
type TokenUsage struct {
// PromptTokens is the number of prompt tokens.
PromptTokens int
// CompletionTokens is the number of completion tokens.
CompletionTokens int
// TotalTokens is the total number of tokens.
TotalTokens int
}
TokenUsage is the token usage for the embedding.