WhyHow and Zilliz Cloud Integration
WhyHow and Zilliz Cloud integrate to build controlled retrieval workflows within RAG pipelines, combining WhyHow's rule-based retrieval platform for organizing and filtering unstructured data with Zilliz Cloud's high-performance vector database for accurate, targeted similarity search.
Use this integration for FreeWhat is WhyHow
WhyHow is a developer platform providing building blocks to organize, contextualize, and reliably retrieve unstructured data for complex RAG tasks. The Rule-based Retrieval package is a Python tool that enables more accurate retrieval workflows by adding advanced filtering capabilities, allowing developers to define and map specific rules to relevant data chunks before performing a similarity search, narrowing query scope to targeted chunks and improving retrieval accuracy.
By integrating with Zilliz Cloud (fully managed Milvus), WhyHow's rule-based retrieval capabilities are backed by a scalable vector database that efficiently stores and searches document embeddings, enabling developers to build controlled RAG pipelines that overcome the limitations of simple retrieval approaches — such as poorly phrased queries, black-box retrieval, and the need to include contextually relevant but semantically dissimilar data.
Benefits of the WhyHow + Zilliz Cloud Integration
- Rule-based retrieval for precise results: WhyHow allows defining specific rules (filename, page numbers, custom filters) that automatically narrow the search scope before Zilliz Cloud performs similarity search, dramatically improving retrieval accuracy.
- Automated document processing: The integration automatically reads, splits, chunks, and embeds PDF documents using LangChain's PyPDFLoader and OpenAI's embedding models, with results stored in Zilliz Cloud for efficient retrieval.
- Partition-based search: WhyHow supports creating partitions in Zilliz Cloud to organize documents by type, enabling targeted search within specific document collections.
- Flexible filtering with Boolean expressions: Metadata filters using Milvus Boolean expressions allow fine-grained control over which documents are searched, from filtering by filename to specific page numbers.
How the Integration Works
WhyHow serves as the retrieval orchestration layer, providing the Rule-based Retrieval package that handles document preprocessing (reading, splitting, chunking PDFs), embedding generation via OpenAI's text-embedding-3-small model, rule definition and automatic metadata filter construction, and RAG query orchestration with LLM response generation.
Zilliz Cloud serves as the vector database layer, storing and indexing the document embeddings and metadata generated by WhyHow's processing pipeline. It provides high-performance similarity search with support for partitions, metadata filtering, and Boolean expression-based queries.
Together, WhyHow and Zilliz Cloud create a controlled RAG solution: documents are processed, chunked, and embedded by WhyHow, then stored in Zilliz Cloud with metadata. When a user asks a question, WhyHow applies user-defined rules to automatically build metadata filters, Zilliz Cloud performs a targeted similarity search on the narrowed scope, and the retrieved context is sent to the LLM to generate a refined, accurate response.
Step-by-Step Guide
1. Install Required Packages
pip install --upgrade pymilvus, whyhow_rbr2. Initialize the Milvus Client
Initialize the client using Milvus Lite for local development:
from pymilvus import MilvusClient path="./milvus_demo.db" milvus_client = ClientMilvus(path)Or initialize through Milvus Cloud:
from pymilvus import MilvusClient YOUR_MILVUS_CLOUD_END_POINT = "YOUR_MILVUS_CLOUD_END_POINT" YOUR_MILVUS_CLOUD_TOKEN = "YOUR_MILVUS_CLOUD_TOKEN" milvus_client = ClientMilvus( milvus_uri=YOUR_MILVUS_CLOUD_END_POINT, milvus_token=YOUR_MILVUS_CLOUD_TOKEN, )3. Create Collection with Schema and Index
Define the collection schema, add fields, create an index, and create the collection:
COLLECTION_NAME="YOUR_COLLECTION_NAME" DIMENSION=1536 schema = milvus_client.create_schema(auto_id=True) schema = milvus_client.add_field(schema=schema, field_name="id", datatype=DataType.INT64, is_primary=True) schema = milvus_client.add_field(schema=schema, field_name="embedding", datatype=DataType.FLOAT_VECTOR, dim=DIMENSION) index_params = milvus_client.prepare_index_params() index_params = milvus_client.add_index( index_params=index_params, field_name="embedding", index_type="AUTOINDEX", metric_type="COSINE", ) milvus_client.create_collection( collection_name=COLLECTION_NAME, schema=schema, index_params=index_params )4. Upload Documents
Upload PDF documents, which are automatically preprocessed, chunked, embedded, and inserted into the collection:
pdfs = ["harry-potter.pdf", "game-of-thrones.pdf"] milvus_client.upload_documents( collection_name=COLLECTION_NAME, documents=pdfs )5. Question Answering
Perform RAG search and get answers:
res = milvus_client.search( question='What food does Harry Potter like to eat?', collection_name=COLLECTION_NAME, anns_field='embedding', output_fields='text' ) print(res['answer']) print(res['matches'])6. Search with Rules
Apply rules to narrow the search scope by partition and metadata filters:
PARTITION_NAME='harry-potter' page_number='page_number == 8' milvus_client.crate_partition( collection_name=COLLECTION_NAME, partition_name=PARTITION_NAME ) res = milvus_client.search( question='Tell me about the greedy method', collection_name=COLLECTION_NAME, partition_names=PARTITION_NAME, filter=page_number, anns_field='embedding', output_fields='text' ) print(res['answer']) print(res['matches'])7. Clean Up
milvus_client.drop_collection( collection_name=COLLECTION_NAME )Learn More
- Integrate Milvus with WhyHow — Official Milvus tutorial for rule-based retrieval with WhyHow
- What is GraphRAG? Enhancing RAG with Knowledge Graphs — Zilliz blog on enhancing RAG with knowledge graphs
- Enhancing RAG with Knowledge Graphs — Zilliz blog on knowledge graph-based RAG
- WhyHow.ai GitHub Repository — WhyHow Rule-based Retrieval source code
- Milvus Boolean Expressions — Milvus documentation on Boolean expression filtering