fix: Remove weaviate (#1139)

<!-- .github/pull_request_template.md -->

## Description
<!-- Provide a clear description of the changes in this PR -->

## DCO Affirmation
I affirm that all code in every commit of this pull request conforms to
the terms of the Topoteretes Developer Certificate of Origin.
This commit is contained in:
Vasilije 2025-07-23 19:34:35 +02:00 committed by GitHub
parent 4740f87947
commit daa4e9acc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 11 additions and 290 deletions

View file

@ -33,10 +33,7 @@ on:
required: false required: false
QDRANT_API_KEY: QDRANT_API_KEY:
required: false required: false
WEAVIATE_API_URL:
required: false
WEAVIATE_API_KEY:
required: false
POSTGRES_PASSWORD: POSTGRES_PASSWORD:
required: false required: false
NEO4J_API_URL: NEO4J_API_URL:
@ -116,38 +113,7 @@ jobs:
run: | run: |
poetry run python examples/database_examples/kuzu_example.py poetry run python examples/database_examples/kuzu_example.py
run-db-example-weaviate:
name: "Weaviate DB Example Test"
runs-on: ubuntu-22.04
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'weaviate') }}
steps:
- name: Check out
uses: actions/checkout@v4
- name: Cognee Setup
uses: ./.github/actions/cognee_setup
with:
python-version: ${{ inputs.python-version }}
- name: Install Weaviate extra
run: |
poetry install -E weaviate
- name: Run Weaviate Example
env:
ENV: dev
LLM_MODEL: ${{ secrets.LLM_MODEL }}
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
VECTOR_DB_URL: ${{ secrets.WEAVIATE_API_URL }}
VECTOR_DB_KEY: ${{ secrets.WEAVIATE_API_KEY }}
run: |
poetry run python examples/database_examples/weaviate_example.py
run-db-example-qdrant: run-db-example-qdrant:
name: "Qdrant DB Example Test" name: "Qdrant DB Example Test"

View file

@ -11,11 +11,6 @@ on:
type: string type: string
default: "all" default: "all"
description: "Which vector databases to test (comma-separated list or 'all')" description: "Which vector databases to test (comma-separated list or 'all')"
secrets:
WEAVIATE_API_URL:
required: false
WEAVIATE_API_KEY:
required: false
jobs: jobs:
run-kuzu-tests: run-kuzu-tests:

View file

@ -11,11 +11,6 @@ on:
type: string type: string
default: "all" default: "all"
description: "Which vector databases to test (comma-separated list or 'all')" description: "Which vector databases to test (comma-separated list or 'all')"
secrets:
WEAVIATE_API_URL:
required: false
WEAVIATE_API_KEY:
required: false
jobs: jobs:
run-kuzu-lance-sqlite-search-tests: run-kuzu-lance-sqlite-search-tests:

View file

@ -9,10 +9,7 @@ on:
default: "all" default: "all"
description: "Which vector databases to test (comma-separated list or 'all')" description: "Which vector databases to test (comma-separated list or 'all')"
secrets: secrets:
WEAVIATE_API_URL:
required: false
WEAVIATE_API_KEY:
required: false
POSTGRES_PASSWORD: POSTGRES_PASSWORD:
required: false required: false
@ -61,39 +58,6 @@ jobs:
# EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} # EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
# run: poetry run python ./cognee/tests/test_chromadb.py # run: poetry run python ./cognee/tests/test_chromadb.py
run-weaviate-tests:
name: Weaviate Tests
runs-on: ubuntu-22.04
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'weaviate') }}
steps:
- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cognee Setup
uses: ./.github/actions/cognee_setup
with:
python-version: ${{ inputs.python-version }}
- name: Install specific db dependency
run: |
poetry install -E weaviate
- name: Run Weaviate Tests
env:
ENV: 'dev'
LLM_MODEL: ${{ secrets.LLM_MODEL }}
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
VECTOR_DB_URL: ${{ secrets.WEAVIATE_API_URL }}
VECTOR_DB_KEY: ${{ secrets.WEAVIATE_API_KEY }}
run: poetry run python ./cognee/tests/test_weaviate.py
run_qdrant_integration_test: run_qdrant_integration_test:
name: Qdrant Tests name: Qdrant Tests

View file

@ -31,7 +31,7 @@ COPY README.md pyproject.toml uv.lock entrypoint.sh ./
# Install the project's dependencies using the lockfile and settings # Install the project's dependencies using the lockfile and settings
RUN --mount=type=cache,target=/root/.cache/uv \ RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --extra debug --extra api --extra postgres --extra weaviate --extra qdrant --extra neo4j --extra llama-index --extra gemini --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-install-project --no-dev --no-editable uv sync --extra debug --extra api --extra postgres --extra qdrant --extra neo4j --extra llama-index --extra gemini --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-install-project --no-dev --no-editable
# Copy Alembic configuration # Copy Alembic configuration
COPY alembic.ini /app/alembic.ini COPY alembic.ini /app/alembic.ini
@ -41,7 +41,7 @@ COPY alembic/ /app/alembic
# Installing separately from its dependencies allows optimal layer caching # Installing separately from its dependencies allows optimal layer caching
COPY ./cognee /app/cognee COPY ./cognee /app/cognee
RUN --mount=type=cache,target=/root/.cache/uv \ RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --extra debug --extra api --extra postgres --extra weaviate --extra qdrant --extra neo4j --extra llama-index --extra gemini --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-dev --no-editable uv sync --extra debug --extra api --extra postgres --extra qdrant --extra neo4j --extra llama-index --extra gemini --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-dev --no-editable
FROM python:3.12-slim-bookworm FROM python:3.12-slim-bookworm

View file

@ -19,7 +19,7 @@ def create_vector_engine(
for each provider, raising an EnvironmentError if any are missing, or ImportError if the for each provider, raising an EnvironmentError if any are missing, or ImportError if the
ChromaDB package is not installed. ChromaDB package is not installed.
Supported providers include: Weaviate, Qdrant, pgvector, FalkorDB, ChromaDB, and Supported providers include: Qdrant, pgvector, FalkorDB, ChromaDB, and
LanceDB. LanceDB.
Parameters: Parameters:
@ -30,7 +30,7 @@ def create_vector_engine(
providers. providers.
- vector_db_key (str): The API key or access token for the vector database instance. - vector_db_key (str): The API key or access token for the vector database instance.
- vector_db_provider (str): The name of the vector database provider to use (e.g., - vector_db_provider (str): The name of the vector database provider to use (e.g.,
'weaviate', 'qdrant'). 'qdrant', 'pgvector').
Returns: Returns:
-------- --------
@ -48,15 +48,7 @@ def create_vector_engine(
embedding_engine=embedding_engine, embedding_engine=embedding_engine,
) )
if vector_db_provider == "weaviate": if vector_db_provider == "qdrant":
from .weaviate_db import WeaviateAdapter
if not (vector_db_url and vector_db_key):
raise EnvironmentError("Missing requred Weaviate credentials!")
return WeaviateAdapter(vector_db_url, vector_db_key, embedding_engine=embedding_engine)
elif vector_db_provider == "qdrant":
if not (vector_db_url and vector_db_key): if not (vector_db_url and vector_db_key):
raise EnvironmentError("Missing requred Qdrant credentials!") raise EnvironmentError("Missing requred Qdrant credentials!")

View file

@ -43,10 +43,6 @@ def get_settings() -> SettingsDict:
llm_config = get_llm_config() llm_config = get_llm_config()
vector_dbs = [ vector_dbs = [
{
"value": "weaviate",
"label": "Weaviate",
},
{ {
"value": "qdrant", "value": "qdrant",
"label": "Qdrant", "label": "Qdrant",

View file

@ -6,7 +6,7 @@ from cognee.infrastructure.databases.vector import get_vectordb_config
class VectorDBConfig(BaseModel): class VectorDBConfig(BaseModel):
url: str url: str
api_key: str api_key: str
provider: Union[Literal["lancedb"], Literal["qdrant"], Literal["weaviate"], Literal["pgvector"]] provider: Union[Literal["lancedb"], Literal["qdrant"], Literal["pgvector"]]
async def save_vector_db_config(vector_db_config: VectorDBConfig): async def save_vector_db_config(vector_db_config: VectorDBConfig):

View file

@ -1,94 +0,0 @@
import os
import pathlib
import cognee
from cognee.infrastructure.files.storage import get_storage_config
from cognee.modules.search.operations import get_history
from cognee.modules.users.methods import get_default_user
from cognee.shared.logging_utils import get_logger
from cognee.modules.search.types import SearchType
logger = get_logger()
async def main():
cognee.config.set_vector_db_provider("weaviate")
data_directory_path = str(
pathlib.Path(
os.path.join(pathlib.Path(__file__).parent, ".data_storage/test_weaviate")
).resolve()
)
cognee.config.data_root_directory(data_directory_path)
cognee_directory_path = str(
pathlib.Path(
os.path.join(pathlib.Path(__file__).parent, ".cognee_system/test_weaviate")
).resolve()
)
cognee.config.system_root_directory(cognee_directory_path)
await cognee.prune.prune_data()
await cognee.prune.prune_system(metadata=True)
dataset_name = "cs_explanations"
explanation_file_path = os.path.join(
pathlib.Path(__file__).parent, "test_data/Natural_language_processing.txt"
)
await cognee.add([explanation_file_path], dataset_name)
text = """A quantum computer is a computer that takes advantage of quantum mechanical phenomena.
At small scales, physical matter exhibits properties of both particles and waves, and quantum computing leverages this behavior, specifically quantum superposition and entanglement, using specialized hardware that supports the preparation and manipulation of quantum states.
Classical physics cannot explain the operation of these quantum devices, and a scalable quantum computer could perform some calculations exponentially faster (with respect to input size scaling) than any modern "classical" computer. In particular, a large-scale quantum computer could break widely used encryption schemes and aid physicists in performing physical simulations; however, the current state of the technology is largely experimental and impractical, with several obstacles to useful applications. Moreover, scalable quantum computers do not hold promise for many practical tasks, and for many important tasks quantum speedups are proven impossible.
The basic unit of information in quantum computing is the qubit, similar to the bit in traditional digital electronics. Unlike a classical bit, a qubit can exist in a superposition of its two "basis" states. When measuring a qubit, the result is a probabilistic output of a classical bit, therefore making quantum computers nondeterministic in general. If a quantum computer manipulates the qubit in a particular way, wave interference effects can amplify the desired measurement results. The design of quantum algorithms involves creating procedures that allow a quantum computer to perform calculations efficiently and quickly.
Physically engineering high-quality qubits has proven challenging. If a physical qubit is not sufficiently isolated from its environment, it suffers from quantum decoherence, introducing noise into calculations. Paradoxically, perfectly isolating qubits is also undesirable because quantum computations typically need to initialize qubits, perform controlled qubit interactions, and measure the resulting quantum states. Each of those operations introduces errors and suffers from noise, and such inaccuracies accumulate.
In principle, a non-quantum (classical) computer can solve the same computational problems as a quantum computer, given enough time. Quantum advantage comes in the form of time complexity rather than computability, and quantum complexity theory shows that some quantum algorithms for carefully selected tasks require exponentially fewer computational steps than the best known non-quantum algorithms. Such tasks can in theory be solved on a large-scale quantum computer whereas classical computers would not finish computations in any reasonable amount of time. However, quantum speedup is not universal or even typical across computational tasks, since basic tasks such as sorting are proven to not allow any asymptotic quantum speedup. Claims of quantum supremacy have drawn significant attention to the discipline, but are demonstrated on contrived tasks, while near-term practical use cases remain limited.
"""
await cognee.add([text], dataset_name)
await cognee.cognify([dataset_name])
from cognee.infrastructure.databases.vector import get_vector_engine
vector_engine = get_vector_engine()
random_node = (await vector_engine.search("Entity_name", "Quantum computer"))[0]
random_node_name = random_node.payload["text"]
search_results = await cognee.search(
query_text=random_node_name, query_type=SearchType.INSIGHTS
)
assert len(search_results) != 0, "The search results list is empty."
print("\n\nExtracted sentences are:\n")
for result in search_results:
print(f"{result}\n")
search_results = await cognee.search(query_type=SearchType.CHUNKS, query_text=random_node_name)
assert len(search_results) != 0, "The search results list is empty."
print("\n\nExtracted chunks are:\n")
for result in search_results:
print(f"{result}\n")
search_results = await cognee.search(
query_type=SearchType.SUMMARIES, query_text=random_node_name
)
assert len(search_results) != 0, "Query related summaries don't exist."
print("\nExtracted summaries are:\n")
for result in search_results:
print(f"{result}\n")
user = await get_default_user()
history = await get_history(user.id)
assert len(history) == 6, "Search history is not correct."
await cognee.prune.prune_data()
data_root_directory = get_storage_config()["data_root_directory"]
assert not os.path.isdir(data_root_directory), "Local data files are not deleted"
await cognee.prune.prune_system(metadata=True)
collections = await get_vector_engine().client.collections.list_all()
assert len(collections) == 0, "Weaviate vector database is not empty"
if __name__ == "__main__":
import asyncio
asyncio.run(main())

View file

@ -3,7 +3,7 @@ FROM python:3.11-slim
# Define Poetry extras to install # Define Poetry extras to install
ARG POETRY_EXTRAS="\ ARG POETRY_EXTRAS="\
# Storage & Databases \ # Storage & Databases \
postgres weaviate qdrant neo4j falkordb kuzu \ postgres qdrant neo4j falkordb kuzu \
# Notebooks & Interactive Environments \ # Notebooks & Interactive Environments \
notebook \ notebook \
# LLM & AI Frameworks \ # LLM & AI Frameworks \

View file

@ -1,92 +0,0 @@
import os
import pathlib
import asyncio
import cognee
from cognee.modules.search.types import SearchType
async def main():
"""
Example script demonstrating how to use Cognee with Weaviate
This example:
1. Configures Cognee to use Weaviate as vector database
2. Sets up data directories
3. Adds sample data to Cognee
4. Processes (cognifies) the data
5. Performs different types of searches
"""
# Set up Weaviate credentials in .env file and get the values from environment variables
weaviate_url = os.getenv("VECTOR_DB_URL")
weaviate_key = os.getenv("VECTOR_DB_KEY")
# Configure Weaviate as the vector database provider
cognee.config.set_vector_db_config(
{
"vector_db_url": weaviate_url, # Set your Weaviate Endpoint
"vector_db_key": weaviate_key, # Set your Weaviate API key
"vector_db_provider": "weaviate", # Specify Weaviate as provider
}
)
# Set up data directories for storing documents and system files
# You should adjust these paths to your needs
current_dir = pathlib.Path(__file__).parent
data_directory_path = str(current_dir / "data_storage")
cognee.config.data_root_directory(data_directory_path)
cognee_directory_path = str(current_dir / "cognee_system")
cognee.config.system_root_directory(cognee_directory_path)
# Clean any existing data (optional)
await cognee.prune.prune_data()
await cognee.prune.prune_system(metadata=True)
# Create a dataset
dataset_name = "weaviate_example"
# Add sample text to the dataset
sample_text = """Weaviate is an open-source vector database that stores both objects and vectors.
It enables vector search with GraphQL-based filtering capabilities.
Weaviate can be deployed in the cloud, on-premise, or embedded in your application.
It allows users to search through vectors using different algorithms and metrics.
Weaviate supports various modules for text2vec transformations, including BERT, OpenAI, and other models.
It can index data in multiple ways and offers features like semantic search, classification, and contextualization."""
# Add the sample text to the dataset
await cognee.add([sample_text], dataset_name)
# Process the added document to extract knowledge
await cognee.cognify([dataset_name])
# Now let's perform some searches
# 1. Search for insights related to "Weaviate"
insights_results = await cognee.search(query_type=SearchType.INSIGHTS, query_text="Weaviate")
print("\nInsights about Weaviate:")
for result in insights_results:
print(f"- {result}")
# 2. Search for text chunks related to "vector search"
chunks_results = await cognee.search(
query_type=SearchType.CHUNKS, query_text="vector search", datasets=[dataset_name]
)
print("\nChunks about vector search:")
for result in chunks_results:
print(f"- {result}")
# 3. Get graph completion related to databases
graph_completion_results = await cognee.search(
query_type=SearchType.GRAPH_COMPLETION, query_text="database"
)
print("\nGraph completion for databases:")
for result in graph_completion_results:
print(f"- {result}")
# Clean up (optional)
# await cognee.prune.prune_data()
# await cognee.prune.prune_system(metadata=True)
if __name__ == "__main__":
asyncio.run(main())

View file

@ -74,8 +74,7 @@ ignore_missing_imports=true
[mypy-prometheus_client.*] [mypy-prometheus_client.*]
ignore_missing_imports=true ignore_missing_imports=true
[mypy-weaviate.*]
ignore_missing_imports=true
[mypy-psycopg2cffi.*] [mypy-psycopg2cffi.*]
ignore_missing_imports=true ignore_missing_imports=true

View file

@ -70,7 +70,7 @@ api = [
distributed = [ distributed = [
"modal>=1.0.5,<2.0.0", "modal>=1.0.5,<2.0.0",
] ]
weaviate = ["weaviate-client>=4.9.6,<5.0.0"]
qdrant = ["qdrant-client>=1.14.2,<2"] qdrant = ["qdrant-client>=1.14.2,<2"]
neo4j = ["neo4j>=5.28.0,<6"] neo4j = ["neo4j>=5.28.0,<6"]
postgres = [ postgres = [