Documentation
¶
Index ¶
- Constants
- type EmbeddingRequest
- type EmbeddingResponse
- type EmbeddingType
- type JinaEmbeddingFunction
- func (e *JinaEmbeddingFunction) EmbedDocuments(ctx context.Context, documents []string) ([]*types.Embedding, error)
- func (e *JinaEmbeddingFunction) EmbedQuery(ctx context.Context, document string) (*types.Embedding, error)
- func (e *JinaEmbeddingFunction) EmbedRecords(ctx context.Context, records []*types.Record, force bool) error
- type Option
Constants ¶
View Source
const ( EmbeddingTypeFloat EmbeddingType = "float" DefaultBaseAPIEndpoint = "https://api.jina.ai/v1/embeddings" DefaultEmbeddingModel types.EmbeddingModel = "jina-embeddings-v2-base-en" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmbeddingRequest ¶
type EmbeddingRequest struct { Model string `json:"model"` Normalized bool `json:"normalized,omitempty"` EmbeddingType EmbeddingType `json:"embedding_type,omitempty"` Input []map[string]string `json:"input"` }
type EmbeddingResponse ¶
type EmbeddingResponse struct { Model string `json:"model"` Object string `json:"object"` Usage struct { TotalTokens int `json:"total_tokens"` PromptTokens int `json:"prompt_tokens"` } Data []struct { Object string `json:"object"` Index int `json:"index"` Embedding []float32 `json:"embedding"` // TODO what about other embedding types - see cohere for example } }
type EmbeddingType ¶
type EmbeddingType string
type JinaEmbeddingFunction ¶
type JinaEmbeddingFunction struct {
// contains filtered or unexported fields
}
func NewJinaEmbeddingFunction ¶
func NewJinaEmbeddingFunction(opts ...Option) (*JinaEmbeddingFunction, error)
func (*JinaEmbeddingFunction) EmbedDocuments ¶
func (*JinaEmbeddingFunction) EmbedQuery ¶
func (*JinaEmbeddingFunction) EmbedRecords ¶
type Option ¶
type Option func(c *JinaEmbeddingFunction) error
func WithAPIKey ¶
func WithEmbeddingEndpoint ¶
func WithEmbeddingType ¶
func WithEmbeddingType(embeddingType EmbeddingType) Option
WithEmbeddingType sets the type of the embedding to be returned by Jina. The default is float. Right now no other options are supported
func WithEnvAPIKey ¶
func WithEnvAPIKey() Option
func WithModel ¶
func WithModel(model types.EmbeddingModel) Option
func WithNormalized ¶
WithNormalized sets the flag to indicate to Jina whether to normalize (L2 norm) the output embeddings or not. Defaults to true
Click to show internal directories.
Click to hide internal directories.