Compare commits

...
Sign in to create a new pull request.

6 commits

Author SHA1 Message Date
vasilije
b70ab1321b added logging utils 2025-05-19 14:49:12 +02:00
vasilije
801b50755b Merge branch 'dev' of github.com:topoteretes/cognee into dev 2025-05-19 13:40:06 +02:00
vasilije
f842f68b9e resolve conflicts 2025-05-19 13:25:38 +02:00
vasilije
a5b28983bd merge done 2025-05-19 13:22:52 +02:00
Vasilije
b1b4ae3d5f
fix: Add baseline overview (#832)
<!-- .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.
2025-05-16 14:41:50 +02:00
Boris
0aac93e9c4
Merge dev to main (#827)
<!-- .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.

---------

Co-authored-by: vasilije <vas.markovic@gmail.com>
Co-authored-by: Igor Ilic <30923996+dexters1@users.noreply.github.com>
Co-authored-by: Vasilije <8619304+Vasilije1990@users.noreply.github.com>
Co-authored-by: Igor Ilic <igorilic03@gmail.com>
Co-authored-by: Hande <159312713+hande-k@users.noreply.github.com>
Co-authored-by: Matea Pesic <80577904+matea16@users.noreply.github.com>
Co-authored-by: hajdul88 <52442977+hajdul88@users.noreply.github.com>
Co-authored-by: Daniel Molnar <soobrosa@gmail.com>
Co-authored-by: Diego Baptista Theuerkauf <34717973+diegoabt@users.noreply.github.com>
2025-05-15 13:15:49 +02:00
8 changed files with 27 additions and 60 deletions

View file

@ -97,7 +97,7 @@ git push origin feature/your-feature-name
2. Create a Pull Request:
- 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
## 5. 📜 Developer Certificate of Origin (DCO)

View file

@ -8,7 +8,7 @@ requires-python = ">=3.10"
dependencies = [
# 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,docs]==0.1.40",
"cognee[postgres,codegraph,gemini,huggingface]==0.1.40",
"fastmcp>=1.0",
"mcp==1.5.0",
"uv>=0.6.3",

View file

@ -178,18 +178,10 @@ class MilvusAdapter(VectorDBInterface):
):
from pymilvus import MilvusException, exceptions
if limit <= 0:
return []
client = self.get_milvus_client()
if query_text is None and query_vector is None:
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:
query_vector = query_vector or (await self.embed_data([query_text]))[0]
@ -216,19 +208,12 @@ class MilvusAdapter(VectorDBInterface):
)
for result in results[0]
]
except exceptions.CollectionNotExistException:
logger.warning(
f"Collection '{collection_name}' not found (exception) in MilvusAdapter.search; returning []."
)
return []
except exceptions.CollectionNotExistException as error:
raise CollectionNotFoundError(
f"Collection '{collection_name}' does not exist!"
) from error
except MilvusException as e:
# Catch other Milvus errors that are "collection not found" (paranoid safety)
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}")
logger.error(f"Error during search in collection '{collection_name}': {str(e)}")
raise e
async def batch_search(

View file

@ -159,24 +159,12 @@ class QDrantAdapter(VectorDBInterface):
query_vector: Optional[List[float]] = None,
limit: int = 15,
with_vector: bool = False,
) -> List[ScoredResult]:
):
from qdrant_client.http.exceptions import UnexpectedResponse
if query_text is None and query_vector is None:
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:
client = self.get_qdrant_client()

View file

@ -113,7 +113,7 @@ class WeaviateAdapter(VectorDBInterface):
# )
else:
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(
uuid=data_point.uuid,
vector=data_point.vector,

View file

@ -4,6 +4,7 @@ import threading
import logging
import structlog
import traceback
import platform
from datetime import datetime
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
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):
"""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
cleanup_old_logs(LOGS_DIR, MAX_LOG_FILES)
# Return a configured logger
return structlog.get_logger(name if name else __name__)
# Get a configured logger and log system information
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():

View file

@ -136,27 +136,6 @@ Repository = "https://github.com/topoteretes/cognee"
requires = ["hatchling"]
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]
line-length = 100
exclude = [

2
uv.lock generated
View file

@ -860,7 +860,7 @@ wheels = [
[[package]]
name = "cognee"
version = "0.1.40"
version = "0.1.39"
source = { editable = "." }
dependencies = [
{ name = "aiofiles" },