Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b70ab1321b | ||
|
|
801b50755b | ||
|
|
f842f68b9e | ||
|
|
a5b28983bd | ||
|
|
b1b4ae3d5f | ||
|
|
0aac93e9c4 |
8 changed files with 27 additions and 60 deletions
|
|
@ -97,7 +97,7 @@ git push origin feature/your-feature-name
|
||||||
|
|
||||||
2. Create a Pull Request:
|
2. Create a Pull Request:
|
||||||
- Go to the [**cognee** repository](https://github.com/topoteretes/cognee)
|
- Go to the [**cognee** repository](https://github.com/topoteretes/cognee)
|
||||||
- Click "Compare & Pull Request" and open a PR against dev branch
|
- Click "Compare & Pull Request"
|
||||||
- Fill in the PR template with details about your changes
|
- Fill in the PR template with details about your changes
|
||||||
|
|
||||||
## 5. 📜 Developer Certificate of Origin (DCO)
|
## 5. 📜 Developer Certificate of Origin (DCO)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
# For local cognee repo usage remove comment bellow and add absolute path to cognee
|
# For local cognee repo usage remove comment bellow and add absolute path to cognee
|
||||||
#"cognee[postgres,codegraph,gemini,huggingface] @ file:/Users/<username>/Desktop/cognee",
|
#"cognee[postgres,codegraph,gemini,huggingface] @ file:/Users/<username>/Desktop/cognee",
|
||||||
"cognee[postgres,codegraph,gemini,huggingface,docs]==0.1.40",
|
"cognee[postgres,codegraph,gemini,huggingface]==0.1.40",
|
||||||
"fastmcp>=1.0",
|
"fastmcp>=1.0",
|
||||||
"mcp==1.5.0",
|
"mcp==1.5.0",
|
||||||
"uv>=0.6.3",
|
"uv>=0.6.3",
|
||||||
|
|
|
||||||
|
|
@ -178,18 +178,10 @@ class MilvusAdapter(VectorDBInterface):
|
||||||
):
|
):
|
||||||
from pymilvus import MilvusException, exceptions
|
from pymilvus import MilvusException, exceptions
|
||||||
|
|
||||||
if limit <= 0:
|
|
||||||
return []
|
|
||||||
client = self.get_milvus_client()
|
client = self.get_milvus_client()
|
||||||
if query_text is None and query_vector is None:
|
if query_text is None and query_vector is None:
|
||||||
raise ValueError("One of query_text or query_vector must be provided!")
|
raise ValueError("One of query_text or query_vector must be provided!")
|
||||||
|
|
||||||
if not client.has_collection(collection_name=collection_name):
|
|
||||||
logger.warning(
|
|
||||||
f"Collection '{collection_name}' not found in MilvusAdapter.search; returning []."
|
|
||||||
)
|
|
||||||
return []
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
query_vector = query_vector or (await self.embed_data([query_text]))[0]
|
query_vector = query_vector or (await self.embed_data([query_text]))[0]
|
||||||
|
|
||||||
|
|
@ -216,19 +208,12 @@ class MilvusAdapter(VectorDBInterface):
|
||||||
)
|
)
|
||||||
for result in results[0]
|
for result in results[0]
|
||||||
]
|
]
|
||||||
except exceptions.CollectionNotExistException:
|
except exceptions.CollectionNotExistException as error:
|
||||||
logger.warning(
|
raise CollectionNotFoundError(
|
||||||
f"Collection '{collection_name}' not found (exception) in MilvusAdapter.search; returning []."
|
f"Collection '{collection_name}' does not exist!"
|
||||||
)
|
) from error
|
||||||
return []
|
|
||||||
except MilvusException as e:
|
except MilvusException as e:
|
||||||
# Catch other Milvus errors that are "collection not found" (paranoid safety)
|
logger.error(f"Error during search in collection '{collection_name}': {str(e)}")
|
||||||
if "collection not found" in str(e).lower() or "schema" in str(e).lower():
|
|
||||||
logger.warning(
|
|
||||||
f"Collection '{collection_name}' not found (MilvusException) in MilvusAdapter.search; returning []."
|
|
||||||
)
|
|
||||||
return []
|
|
||||||
logger.error(f"Error searching Milvus collection '{collection_name}': {e}")
|
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
async def batch_search(
|
async def batch_search(
|
||||||
|
|
|
||||||
|
|
@ -159,24 +159,12 @@ class QDrantAdapter(VectorDBInterface):
|
||||||
query_vector: Optional[List[float]] = None,
|
query_vector: Optional[List[float]] = None,
|
||||||
limit: int = 15,
|
limit: int = 15,
|
||||||
with_vector: bool = False,
|
with_vector: bool = False,
|
||||||
) -> List[ScoredResult]:
|
):
|
||||||
from qdrant_client.http.exceptions import UnexpectedResponse
|
from qdrant_client.http.exceptions import UnexpectedResponse
|
||||||
|
|
||||||
if query_text is None and query_vector is None:
|
if query_text is None and query_vector is None:
|
||||||
raise InvalidValueError(message="One of query_text or query_vector must be provided!")
|
raise InvalidValueError(message="One of query_text or query_vector must be provided!")
|
||||||
|
|
||||||
if limit <= 0:
|
|
||||||
return []
|
|
||||||
|
|
||||||
if not await self.has_collection(collection_name):
|
|
||||||
logger.warning(
|
|
||||||
f"Collection '{collection_name}' not found in QdrantAdapter.search; returning []."
|
|
||||||
)
|
|
||||||
return []
|
|
||||||
|
|
||||||
if query_vector is None:
|
|
||||||
query_vector = (await self.embed_data([query_text]))[0]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = self.get_qdrant_client()
|
client = self.get_qdrant_client()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ class WeaviateAdapter(VectorDBInterface):
|
||||||
# )
|
# )
|
||||||
else:
|
else:
|
||||||
data_point: DataObject = data_points[0]
|
data_point: DataObject = data_points[0]
|
||||||
if await collection.data.exists(data_point.uuid):
|
if collection.data.exists(data_point.uuid):
|
||||||
return await collection.data.update(
|
return await collection.data.update(
|
||||||
uuid=data_point.uuid,
|
uuid=data_point.uuid,
|
||||||
vector=data_point.vector,
|
vector=data_point.vector,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import threading
|
||||||
import logging
|
import logging
|
||||||
import structlog
|
import structlog
|
||||||
import traceback
|
import traceback
|
||||||
|
import platform
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
@ -36,6 +37,11 @@ LOGS_DIR.mkdir(exist_ok=True) # Create logs dir if it doesn't exist
|
||||||
# Maximum number of log files to keep
|
# Maximum number of log files to keep
|
||||||
MAX_LOG_FILES = 10
|
MAX_LOG_FILES = 10
|
||||||
|
|
||||||
|
# Version information
|
||||||
|
PYTHON_VERSION = platform.python_version()
|
||||||
|
STRUCTLOG_VERSION = structlog.__version__
|
||||||
|
OS_INFO = f"{platform.system()} {platform.release()} ({platform.version()})"
|
||||||
|
|
||||||
|
|
||||||
class PlainFileHandler(logging.FileHandler):
|
class PlainFileHandler(logging.FileHandler):
|
||||||
"""A custom file handler that writes simpler plain text log entries."""
|
"""A custom file handler that writes simpler plain text log entries."""
|
||||||
|
|
@ -326,8 +332,17 @@ def setup_logging(log_level=None, name=None):
|
||||||
# Clean up old log files, keeping only the most recent ones
|
# Clean up old log files, keeping only the most recent ones
|
||||||
cleanup_old_logs(LOGS_DIR, MAX_LOG_FILES)
|
cleanup_old_logs(LOGS_DIR, MAX_LOG_FILES)
|
||||||
|
|
||||||
# Return a configured logger
|
# Get a configured logger and log system information
|
||||||
return structlog.get_logger(name if name else __name__)
|
logger = structlog.get_logger(name if name else __name__)
|
||||||
|
logger.info(
|
||||||
|
"Logging initialized",
|
||||||
|
python_version=PYTHON_VERSION,
|
||||||
|
structlog_version=STRUCTLOG_VERSION,
|
||||||
|
os_info=OS_INFO
|
||||||
|
)
|
||||||
|
|
||||||
|
# Return the configured logger
|
||||||
|
return logger
|
||||||
|
|
||||||
|
|
||||||
def get_log_file_location():
|
def get_log_file_location():
|
||||||
|
|
|
||||||
|
|
@ -136,27 +136,6 @@ Repository = "https://github.com/topoteretes/cognee"
|
||||||
requires = ["hatchling"]
|
requires = ["hatchling"]
|
||||||
build-backend = "hatchling.build"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
[tool.hatch.build]
|
|
||||||
exclude = [
|
|
||||||
"/bin",
|
|
||||||
"/dist",
|
|
||||||
"/.data",
|
|
||||||
"/.github",
|
|
||||||
"/alembic",
|
|
||||||
"/distributed",
|
|
||||||
"/deployment",
|
|
||||||
"/cognee-mcp",
|
|
||||||
"/cognee-frontend",
|
|
||||||
"/examples",
|
|
||||||
"/helm",
|
|
||||||
"/licenses",
|
|
||||||
"/logs",
|
|
||||||
"/notebooks",
|
|
||||||
"/profiling",
|
|
||||||
"/tests",
|
|
||||||
"/tools",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 100
|
line-length = 100
|
||||||
exclude = [
|
exclude = [
|
||||||
|
|
|
||||||
2
uv.lock
generated
2
uv.lock
generated
|
|
@ -860,7 +860,7 @@ wheels = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cognee"
|
name = "cognee"
|
||||||
version = "0.1.40"
|
version = "0.1.39"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "aiofiles" },
|
{ name = "aiofiles" },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue