Jina AI and Zilliz Cloud Integration
Jina AI and Zilliz Cloud integrate to power semantic search and retrieval applications, combining Jina AI's cutting-edge embedding models and rerankers with Zilliz Cloud's high-performance vector database for efficient multilingual, multimodal, and code similarity search at scale.
Use this integration for FreeWhat is Jina AI
Jina AI, founded in 2020 in Berlin, is a pioneering AI company focused on revolutionizing the future of artificial intelligence through its search foundation. Specializing in multimodal AI, Jina AI's cutting-edge embeddings boast top-tier performance with an 8192 token-length model ideal for comprehensive data representation. Offering multilingual support and seamless integration with leading platforms, their Search Foundation comprises embeddings, rerankers, prompt operations, and infrastructure components designed to enhance search experiences.
By integrating with Zilliz Cloud (fully managed Milvus), Jina AI's embeddings are added to the PyMilvus model library, simplifying developer workflows by enabling efficient storage and search of Jina's high-performance embeddings through a fully managed vector database, powering applications like semantic search, cross-lingual content discovery, code navigation, and retrieval-augmented generation at scale.
Benefits of the Jina AI + Zilliz Cloud Integration
- Seamless PyMilvus integration: Jina AI's embeddings are integrated directly into the PyMilvus model library via
JinaEmbeddingFunction, reducing additional tool requirements and simplifying the developer workflow. - Multilingual and bilingual support: Jina AI offers bilingual models for German-English and Chinese-English translations, with Zilliz Cloud efficiently storing and retrieving these cross-lingual embeddings for global search applications.
- Code embedding support: Jina AI's code embedding model supports English and 30 popular programming languages, enabling code navigation, review, and documentation search backed by Zilliz Cloud's vector storage.
- Flexible embedding dimensions:
jina-embeddings-v3supports flexible embedding sizes (32, 64, 128, 256, 512, 768, 1024), allowing truncation to fit application needs while Zilliz Cloud handles storage and retrieval efficiently. - Reranking for enhanced retrieval: Jina AI's rerankers further improve retrieval quality after initial vector search in Zilliz Cloud, scoring query-document relevance for more accurate results.
- Seamless PyMilvus integration: Jina AI's embeddings are integrated directly into the PyMilvus model library via
How the Integration Works
Jina AI serves as the embedding and reranking layer, converting text, multilingual content, and code into high-dimensional vector embeddings using models like
jina-embeddings-v3. It provides separate task types for documents (retrieval.passage) and queries (retrieval.query) to optimize retrieval accuracy, plus rerankers likejina-reranker-v1-base-enfor refining search results.Zilliz Cloud serves as the vector database layer, storing and indexing the embeddings generated by Jina AI's models. It provides high-performance similarity search with low latency, enabling fast retrieval of the most relevant results from large collections of text, multilingual, and code embeddings.
Together, Jina AI and Zilliz Cloud create an end-to-end semantic search solution: documents are embedded using Jina AI's models via
JinaEmbeddingFunctionand stored in Zilliz Cloud. When a user submits a query, Jina AI embeds the query text, Zilliz Cloud performs similarity search to find the closest matches, and optionally Jina AI's reranker refines the results for higher relevance — all through a streamlined PyMilvus workflow.Step-by-Step Guide
1. Install Required Packages
$ pip install -U pymilvus $ pip install "pymilvus[model]"2. General-Purpose Embedding
Use Jina AI's core embedding model for semantic search and content classification:
from pymilvus.model.dense import JinaEmbeddingFunction jina_api_key = "<YOUR_JINA_API_KEY>" ef = JinaEmbeddingFunction( "jina-embeddings-v3", jina_api_key, task="retrieval.passage", dimensions=1024 ) query = "what is information retrieval?" doc = "Information retrieval is the process of finding relevant information from a large collection of data or documents." qvecs = ef.encode_queries([query]) # This method uses `retrieval.query` as the task dvecs = ef.encode_documents([doc]) # This method uses `retrieval.passage` as the task3. Bilingual Embeddings
Use Jina AI's bilingual models for cross-lingual content discovery:
from pymilvus.model.dense import JinaEmbeddingFunction jina_api_key = "<YOUR_JINA_API_KEY>" ef = JinaEmbeddingFunction("jina-embeddings-v2-base-de", jina_api_key) query = "what is information retrieval?" doc = "Information Retrieval ist der Prozess, relevante Informationen aus einer großen Sammlung von Daten oder Dokumenten zu finden." qvecs = ef.encode_queries([query]) dvecs = ef.encode_documents([doc])4. Code Embeddings
Use Jina AI's code embedding model supporting English and 30 popular programming languages:
from pymilvus.model.dense import JinaEmbeddingFunction jina_api_key = "<YOUR_JINA_API_KEY>" ef = JinaEmbeddingFunction("jina-embeddings-v2-base-code", jina_api_key) query = "function to calculate average in Python." doc = """ def calculate_average(numbers): total = sum(numbers) count = len(numbers) return total / count """ qvecs = ef.encode_queries([query]) dvecs = ef.encode_documents([doc])5. Semantic Search with Jina & Milvus
Combine Jina AI embeddings with Milvus vector database to perform semantic search:
from pymilvus.model.dense import JinaEmbeddingFunction from pymilvus import MilvusClient jina_api_key = "<YOUR_JINA_API_KEY>" DIMENSION = 1024 ef = JinaEmbeddingFunction( "jina-embeddings-v3", jina_api_key, task="retrieval.passage", dimensions=DIMENSION, ) doc = [ "In 1950, Alan Turing published his seminal paper, 'Computing Machinery and Intelligence,' proposing the Turing Test as a criterion of intelligence, a foundational concept in the philosophy and development of artificial intelligence.", "The Dartmouth Conference in 1956 is considered the birthplace of artificial intelligence as a field; here, John McCarthy and others coined the term 'artificial intelligence' and laid out its basic goals.", "In 1951, British mathematician and computer scientist Alan Turing also developed the first program designed to play chess, demonstrating an early example of AI in game strategy.", "The invention of the Logic Theorist by Allen Newell, Herbert A. Simon, and Cliff Shaw in 1955 marked the creation of the first true AI program, which was capable of solving logic problems, akin to proving mathematical theorems.", ] dvecs = ef.encode_documents(doc) data = [ {"id": i, "vector": dvecs[i], "text": doc[i], "subject": "history"} for i in range(len(dvecs)) ] milvus_client = MilvusClient("./milvus_jina_demo.db") COLLECTION_NAME = "demo_collection" if milvus_client.has_collection(collection_name=COLLECTION_NAME): milvus_client.drop_collection(collection_name=COLLECTION_NAME) milvus_client.create_collection(collection_name=COLLECTION_NAME, dimension=DIMENSION) res = milvus_client.insert(collection_name=COLLECTION_NAME, data=data) print(res["insert_count"])As for the argument of
MilvusClient: Setting theurias a local file, e.g../milvus.db, is the most convenient method, as it automatically utilizes Milvus Lite to store all data in this file. If you have large scale of data, you can set up a more performant Milvus server on Docker or Kubernetes. If you want to use Zilliz Cloud, the fully managed cloud service for Milvus, adjust theuriandtoken, which correspond to the Public Endpoint and API Key in Zilliz Cloud.Perform semantic search by generating vector embedding for the query:
queries = "What event in 1956 marked the official birth of artificial intelligence as a discipline?" qvecs = ef.encode_queries([queries]) res = milvus_client.search( collection_name=COLLECTION_NAME, data=[qvecs[0]], limit=3, output_fields=["text", "subject"], )[0] for result in res: print(result)6. Jina Reranker
Use Jina AI's rerankers to further enhance retrieval quality after searching using embeddings:
from pymilvus.model.reranker import JinaRerankFunction jina_api_key = "<YOUR_JINA_API_KEY>" rf = JinaRerankFunction("jina-reranker-v1-base-en", jina_api_key) query = "What event in 1956 marked the official birth of artificial intelligence as a discipline?" documents = [ "In 1950, Alan Turing published his seminal paper, 'Computing Machinery and Intelligence,' proposing the Turing Test as a criterion of intelligence, a foundational concept in the philosophy and development of artificial intelligence.", "The Dartmouth Conference in 1956 is considered the birthplace of artificial intelligence as a field; here, John McCarthy and others coined the term 'artificial intelligence' and laid out its basic goals.", "In 1951, British mathematician and computer scientist Alan Turing also developed the first program designed to play chess, demonstrating an early example of AI in game strategy.", "The invention of the Logic Theorist by Allen Newell, Herbert A. Simon, and Cliff Shaw in 1955 marked the creation of the first true AI program, which was capable of solving logic problems, akin to proving mathematical theorems.", ] rf(query, documents)Learn More
- Integrate Milvus with Jina AI — Official Milvus tutorial for integrating with Jina AI
- Jina AI Embed in Milvus — Milvus documentation on Jina AI embedding functions
- Jina AI Rerankers in Milvus — Milvus documentation on Jina AI reranker functions
- Training Text Embeddings with Jina AI — Zilliz blog on training text embeddings with Jina AI
- What Are Rerankers and How They Enhance Information Retrieval — Zilliz tutorial on rerankers