Weaviate Vector Search
The WeaviateVectorSearchTool
is designed to search a Weaviate vector database for semantically similar documents.
WeaviateVectorSearchTool
Description
The WeaviateVectorSearchTool
is specifically crafted for conducting semantic searches within documents stored in a Weaviate vector database. This tool allows you to find semantically similar documents to a given query, leveraging the power of vector embeddings for more accurate and contextually relevant search results.
Weaviate is a vector database that stores and queries vector embeddings, enabling semantic search capabilities.
Installation
To incorporate this tool into your project, you need to install the Weaviate client:
Steps to Get Started
To effectively use the WeaviateVectorSearchTool
, follow these steps:
- Package Installation: Confirm that the
crewai[tools]
andweaviate-client
packages are installed in your Python environment. - Weaviate Setup: Set up a Weaviate cluster. You can follow the Weaviate documentation for instructions.
- API Keys: Obtain your Weaviate cluster URL and API key.
- OpenAI API Key: Ensure you have an OpenAI API key set in your environment variables as
OPENAI_API_KEY
.
Example
The following example demonstrates how to initialize the tool and execute a search:
Parameters
The WeaviateVectorSearchTool
accepts the following parameters:
- collection_name: Required. The name of the collection to search within.
- weaviate_cluster_url: Required. The URL of the Weaviate cluster.
- weaviate_api_key: Required. The API key for the Weaviate cluster.
- limit: Optional. The number of results to return. Default is
3
. - vectorizer: Optional. The vectorizer to use. If not provided, it will use
text2vec_openai
with thenomic-embed-text
model. - generative_model: Optional. The generative model to use. If not provided, it will use OpenAI’s
gpt-4o
.
Advanced Configuration
You can customize the vectorizer and generative model used by the tool:
Preloading Documents
You can preload your Weaviate database with documents before using the tool:
Agent Integration Example
Here’s how to integrate the WeaviateVectorSearchTool
with a CrewAI agent:
Conclusion
The WeaviateVectorSearchTool
provides a powerful way to search for semantically similar documents in a Weaviate vector database. By leveraging vector embeddings, it enables more accurate and contextually relevant search results compared to traditional keyword-based searches. This tool is particularly useful for applications that require finding information based on meaning rather than exact matches.
Was this page helpful?