Skip to main content
Version: V1.1.0

Jina AI

Jina AI provides embedding models for semantic search and related retrieval tasks. seekdb provides a JinaEmbeddingFunction wrapper (powered by LiteLLM) to generate Jina embeddings and use them with seekdb collections.

tip

Using Jina AI service requires you to follow Jina AI's pricing rules and may incur corresponding fees. Before proceeding, please visit their official website or refer to relevant documentation to confirm and accept their pricing standards. If you do not agree, please do not proceed.

Dependencies and authentication

JinaEmbeddingFunction calls the Jina embedding API via LiteLLM. In practice, you typically need:

  • A Jina API key with access to the embedding models you plan to use
  • Python packages: pyseekdb and litellm

Authentication is usually provided via environment variables (by default, JINA_API_KEY). If you use a different environment variable name, set api_key_env.

Example: create a Jina embedding function

  • Basic usage

    from pyseekdb.utils.embedding_functions import JinaEmbeddingFunction

    ef = JinaEmbeddingFunction(model_name="jina-embeddings-v2-base-en")
  • Multilingual model

    from pyseekdb.utils.embedding_functions import JinaEmbeddingFunction

    ef = JinaEmbeddingFunction(model_name="jina-embeddings-v2-base-multilingual")
  • Use a custom API key environment variable (api_key_env)

    from pyseekdb.utils.embedding_functions import JinaEmbeddingFunction

    ef = JinaEmbeddingFunction(
    model_name="jina-embeddings-v2-base-en",
    api_key_env="JINA_API_KEY",
    )

Parameters

  • model_name: Jina embedding model name.
  • api_key_env: the environment variable name holding your Jina API key (default: JINA_API_KEY).