Merge pull request #449 from topoteretes/feature/cog-186-run-cognee-on-windows

Feature/cog 186 run cognee on windows
This commit is contained in:
Vasilije 2025-01-17 14:16:37 +01:00 committed by GitHub
commit ffa3c2daa0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 62 additions and 27 deletions

View file

@ -258,13 +258,13 @@ pip install cognee
| Name | Type | Current state | Known Issues | | Name | Type | Current state (Mac/Linux) | Known Issues | Current state (Windows) | Known Issues |
|----------|--------------------|-------------------|--------------| |----------|--------------------|---------------------------|--------------|-------------------------|--------------|
| Qdrant | Vector | Stable ✅ | | | Qdrant | Vector | Stable ✅ | | Unstable ❌ | |
| Weaviate | Vector | Stable ✅ | | | Weaviate | Vector | Stable ✅ | | Unstable ❌ | |
| LanceDB | Vector | Stable ✅ | | | LanceDB | Vector | Stable ✅ | | Stable ✅ | |
| Neo4j | Graph | Stable ✅ | | | Neo4j | Graph | Stable ✅ | | Stable ✅ | |
| NetworkX | Graph | Stable ✅ | | | NetworkX | Graph | Stable ✅ | | Stable ✅ | |
| FalkorDB | Vector/Graph | Unstable ❌ | | | FalkorDB | Vector/Graph | Stable ✅ | | Unstable ❌ | |
| PGVector | Vector | Stable ✅ | | | PGVector | Vector | Stable ✅ | | Unstable ❌ | |
| Milvus | Vector | Stable ✅ | | | Milvus | Vector | Stable ✅ | | Unstable ❌ | |

View file

@ -152,7 +152,9 @@ class LanceDBAdapter(VectorDBInterface):
connection = await self.get_connection() connection = await self.get_connection()
collection = await connection.open_table(collection_name) collection = await connection.open_table(collection_name)
results = await collection.vector_search(query_vector).to_pandas() collection_size = await collection.count_rows()
results = await collection.vector_search(query_vector).limit(collection_size).to_pandas()
result_values = list(results.to_dict("index").values()) result_values = list(results.to_dict("index").values())
@ -250,9 +252,16 @@ class LanceDBAdapter(VectorDBInterface):
) )
async def prune(self): async def prune(self):
# Clean up the database if it was set up as temporary connection = await self.get_connection()
collection_names = await connection.table_names()
for collection_name in collection_names:
collection = await connection.open_table(collection_name)
await collection.delete("id IS NOT NULL")
await connection.drop_table(collection_name)
if self.url.startswith("/"): if self.url.startswith("/"):
LocalStorage.remove_all(self.url) # Remove the temporary directory and files inside LocalStorage.remove_all(self.url)
def get_data_point_schema(self, model_type): def get_data_point_schema(self, model_type):
return copy_model( return copy_model(

View file

@ -204,4 +204,9 @@ if __name__ == "__main__":
"retriever": retrieve, "retriever": retrieve,
} }
asyncio.run(main(steps_to_enable)) loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(main(steps_to_enable))
finally:
loop.run_until_complete(loop.shutdown_asyncgens())

View file

@ -69,4 +69,9 @@ async def main():
if __name__ == "__main__": if __name__ == "__main__":
setup_logging(logging.ERROR) setup_logging(logging.ERROR)
asyncio.run(main()) loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(main())
finally:
loop.run_until_complete(loop.shutdown_asyncgens())

View file

@ -1,9 +1,11 @@
import os import os
import asyncio import asyncio
import pathlib import pathlib
import logging
import cognee import cognee
from cognee.api.v1.search import SearchType from cognee.api.v1.search import SearchType
from cognee.shared.utils import setup_logging
# Prerequisites: # Prerequisites:
# 1. Copy `.env.template` and rename it to `.env`. # 1. Copy `.env.template` and rename it to `.env`.
@ -45,4 +47,10 @@ async def main():
if __name__ == "__main__": if __name__ == "__main__":
asyncio.run(main()) setup_logging(logging.ERROR)
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(main())
finally:
loop.run_until_complete(loop.shutdown_asyncgens())

View file

@ -1,6 +1,8 @@
import asyncio import asyncio
import cognee import cognee
import logging
from cognee.api.v1.search import SearchType from cognee.api.v1.search import SearchType
from cognee.shared.utils import setup_logging
# Prerequisites: # Prerequisites:
# 1. Copy `.env.template` and rename it to `.env`. # 1. Copy `.env.template` and rename it to `.env`.
@ -66,4 +68,10 @@ async def main():
if __name__ == "__main__": if __name__ == "__main__":
asyncio.run(main()) setup_logging(logging.ERROR)
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(main())
finally:
loop.run_until_complete(loop.shutdown_asyncgens())