Documentation
¶
Overview ¶
Package jina wraps Jina AI's native embedding and reranking APIs. Embedding supports the dense float subset of current v5, v4, v3, CLIP, and code embedding models that maps losslessly to core/embedding.
Jina-specific knobs that don't fit the generic surface — task type ("retrieval.query" / "retrieval.passage" / "text-matching" / "classification" / "separation"), late chunking, embedding_type (float / int8 / uint8 / binary / ubinary quantization), normalization — are reached through EmbeddingRequestExtensionKey and [EmbeddingRequest].
Jina's /embeddings dialect partially overlaps OpenAI's but uses "dimensions" rather than "output_dimension" and exposes the task-conditioning field; this package implements embedding.Model directly against the native API. Reranking returns indices into the caller-owned document batch rather than provider-owned document copies.
Rerank scores. Jina's OpenAPI schema describes relevance_score as a number with "Higher is more relevant" and declares no minimum, maximum or normalization, so this package does not claim one: the value is passed to rerank.Score, whose contract is [0, 1], and a score outside that range fails the call by name rather than being rescaled onto the bound.
See https://jina.ai/embeddings/ for the full reference.
Index ¶
Constants ¶
const ( Provider = "Jina" EmbeddingRequestExtensionKey = "jina/embedding_request" DefaultBaseURL = "https://api.jina.ai/v1" )
Exported identifiers keep provider-owned names and defaults out of caller literals.
const ( ModelEmbeddingsV5TextNano = "jina-embeddings-v5-text-nano" ModelEmbeddingsV5TextSmall = "jina-embeddings-v5-text-small" ModelEmbeddingsV5OmniNano = "jina-embeddings-v5-omni-nano" ModelEmbeddingsV5OmniSmall = "jina-embeddings-v5-omni-small" ModelEmbeddingsV4 = "jina-embeddings-v4" ModelEmbeddingsV3 = "jina-embeddings-v3" ModelEmbeddingsV2BaseEN = "jina-embeddings-v2-base-en" ModelClipV2 = "jina-clip-v2" ModelColbertV2 = "jina-colbert-v2" ModelRerankerV35 = "jina-reranker-v3.5" ModelRerankerV3 = "jina-reranker-v3" ModelRerankerM0 = "jina-reranker-m0" )
See https://jina.ai/embeddings/ for the current catalog.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmbeddingModel ¶
type EmbeddingModel struct {
// contains filtered or unexported fields
}
EmbeddingModel implements the Core embedding contract with Jina.
func NewEmbeddingModel ¶
func NewEmbeddingModel(_ context.Context, config EmbeddingModelConfig) (*EmbeddingModel, error)
NewEmbeddingModel rejects an invalid provider binding before the first embedding call.
type EmbeddingModelConfig ¶
type EmbeddingModelConfig struct {
APIKey string
DefaultOptions embedding.Options
BaseURL string
HTTPClient *http.Client
}
EmbeddingModelConfig binds provider access and defaults shared by every embedding call.
func (EmbeddingModelConfig) Validate ¶
func (e EmbeddingModelConfig) Validate() error
type RerankModel ¶ added in v0.12.0
type RerankModel struct {
// contains filtered or unexported fields
}
RerankModel implements the Core reranking contract with Jina.
func NewRerankModel ¶ added in v0.12.0
func NewRerankModel(_ context.Context, config RerankModelConfig) (*RerankModel, error)
NewRerankModel rejects an invalid provider binding before the first reranking call.
type RerankModelConfig ¶ added in v0.12.0
type RerankModelConfig struct {
APIKey string
DefaultOptions rerank.Options
BaseURL string
HTTPClient *http.Client
}
RerankModelConfig binds provider access and defaults shared by every reranking call.
func (RerankModelConfig) Validate ¶ added in v0.12.0
func (r RerankModelConfig) Validate() error