Skip to content

BrainAPI is a knowledge graph–powered AI memory layer that transforms unstructured data into structured knowledge, enabling intelligent search, recommendations, and contextual memory for AI agents and applications.

feat(ingestion): improved kg ingestion pipeline

Christian31966822d947
diff --git a/.env.example b/.env.example
index 337112b..6570596 100644
--- a/.env.example
+++ b/.env.example
@@ -4,11 +4,16 @@ AZURE_LARGE_LLM_MODEL="gpt-4o"
AZURE_LARGE_LLM_API_VERSION="2024-12-01-preview"
AZURE_LARGE_LLM_ENDPOINT="https://yourproject.openai.azure.com"
AZURE_LLM_SUBSCRIPTION_KEY="xyz"
+GCP_EXTRA_SMALL_LLM_MODEL="gemini-2.5-flash-lite"
+GCP_SMALL_LLM_MODEL="gemini-2.5-flash"
+GCP_PROJECT_ID="your-project-id"
+GCP_CREDENTIALS_PATH=".path-to-credentials-file.json"
# Embedding envs
# The following are just examples of the adapter implementation, you can have completely different envs
AZURE_EMBEDDING_FULL_ENDPOINT="https://yourproject.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
AZURE_EMBEDDING_KEY="xyz"
+EMBEDDINGS_SMALL_MODEL="paraphrase-multilingual-MiniLM-L12-v2"
# Cache envs
# The following are just examples of the adapter implementation, you can have completely different envs
diff --git a/.gitignore b/.gitignore
index 2a0da12..28809a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,9 @@ dist
common.egg-info
.venv
.env.development
-venv/
\ No newline at end of file
+venv/
+README.md
+READMEP.md
+tmp
+gcp_credentials.json
+.favorites.json
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 6ec4254..ae3f494 100644
--- a/Makefile
+++ b/Makefile
@@ -50,21 +50,27 @@ start-api:
stop-api:
pkill -f uvicorn
-DEBUG_ENVS := LANGCHAIN_DEBUG="true" LANGCHAIN_VERBOSE="true" DEBUG="true"
+DEBUG_ENVS := LANGCHAIN_DEBUG="true" LANGCHAIN_VERBOSE="true" DEBUG="true" ENV="development"
start-all:
- @if [ "$$DEBUG" = "true" ]; then \
+ @if [ "$(filter debug,$(MAKECMDGOALS))" = "debug" ] || [ "$$DEBUG" = "true" ]; then \
echo "DEBUG mode enabled"; \
- export $(DEBUG_ENVS); \
+ $(MAKE) start-milvus DEBUG=true & \
+ $(MAKE) start-rabbitmq DEBUG=true & \
+ $(MAKE) start-redis DEBUG=true & \
+ $(MAKE) start-neo4j DEBUG=true & \
+ $(MAKE) start-mongo DEBUG=true & \
+ $(MAKE) start-api DEBUG=true & \
+ bash -c "export $(DEBUG_ENVS) && poetry run celery -A src.workers.app worker --loglevel=info --pool=threads --concurrency=10"; \
+ else \
+ $(MAKE) start-milvus & \
+ $(MAKE) start-rabbitmq & \
+ $(MAKE) start-redis & \
+ $(MAKE) start-neo4j & \
+ $(MAKE) start-mongo & \
+ $(MAKE) start-api & \
+ poetry run celery -A src.workers.app worker --loglevel=info --pool=threads --concurrency=10; \
fi
- export ENV=development
- make start-milvus &
- make start-rabbitmq &
- make start-redis &
- make start-neo4j &
- make start-mongo &
- make start-api &
- @bash -c "if [ "$$DEBUG" = "true" ]; then export $(DEBUG_ENVS) && poetry run celery -A src.workers.app worker --loglevel=info; else poetry run celery -A src.workers.app worker --loglevel=info; fi"
debug:
@:
diff --git a/poetry.lock b/poetry.lock
index 6427edf..0e4cce9 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -537,6 +537,58 @@ all = ["email-validator (>=2.0.0)", "fastapi-cli[standard] (>=0.0.8)", "httpx (>
standard = ["email-validator (>=2.0.0)", "fastapi-cli[standard] (>=0.0.8)", "httpx (>=0.23.0,<1.0.0)", "jinja2 (>=3.1.5)", "python-multipart (>=0.0.18)", "uvicorn[standard] (>=0.12.0)"]
standard-no-fastapi-cloud-cli = ["email-validator (>=2.0.0)", "fastapi-cli[standard-no-fastapi-cloud-cli] (>=0.0.8)", "httpx (>=0.23.0,<1.0.0)", "jinja2 (>=3.1.5)", "python-multipart (>=0.0.18)", "uvicorn[standard] (>=0.12.0)"]
+[[package]]
+name = "filelock"
+version = "3.20.1"
+description = "A platform independent file lock."
+optional = false
+python-versions = ">=3.10"
+groups = ["main"]
+files = [
+ {file = "filelock-3.20.1-py3-none-any.whl", hash = "sha256:15d9e9a67306188a44baa72f569d2bfd803076269365fdea0934385da4dc361a"},
+ {file = "filelock-3.20.1.tar.gz", hash = "sha256:b8360948b351b80f420878d8516519a2204b07aefcdcfd24912a5d33127f188c"},
+]
+
+[[package]]
+name = "fsspec"
+version = "2025.12.0"
+description = "File-system specification"
+optional = false
+python-versions = ">=3.10"
+groups = ["main"]
+files = [
+ {file = "fsspec-2025.12.0-py3-none-any.whl", hash = "sha256:8bf1fe301b7d8acfa6e8571e3b1c3d158f909666642431cc78a1b7b4dbc5ec5b"},
+ {file = "fsspec-2025.12.0.tar.gz", hash = "sha256:c505de011584597b1060ff778bb664c1bc022e87921b0e4f10cc9c44f9635973"},
+]
+
+[package.extras]
+abfs = ["adlfs"]
+adl = ["adlfs"]
+arrow = ["pyarrow (>=1)"]
+dask = ["dask", "distributed"]
+dev = ["pre-commit", "ruff (>=0.5)"]
+doc = ["numpydoc", "sphinx", "sphinx-design", "sphinx-rtd-theme", "yarl"]
+dropbox = ["dropbox", "dropboxdrivefs", "requests"]
+full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "dask", "distributed", "dropbox", "dropboxdrivefs", "fusepy", "gcsfs", "libarchive-c", "ocifs", "panel", "paramiko", "pyarrow (>=1)", "pygit2", "requests", "s3fs", "smbprotocol", "tqdm"]
+fuse = ["fusepy"]
+gcs = ["gcsfs"]
+git = ["pygit2"]
+github = ["requests"]
+gs = ["gcsfs"]
+gui = ["panel"]
+hdfs = ["pyarrow (>=1)"]
+http = ["aiohttp (!=4.0.0a0,!=4.0.0a1)"]
+libarchive = ["libarchive-c"]
+oci = ["ocifs"]
+s3 = ["s3fs"]
+sftp = ["paramiko"]
+smb = ["smbprotocol"]
+ssh = ["paramiko"]
+test = ["aiohttp (!=4.0.0a0,!=4.0.0a1)", "numpy", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "requests"]
+test-downstream = ["aiobotocore (>=2.5.4,<3.0.0)", "dask[dataframe,test]", "moto[server] (>4,<5)", "pytest-timeout", "xarray"]
+test-full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "cloudpickle", "dask", "distributed", "dropbox", "dropboxdrivefs", "fastparquet", "fusepy", "gcsfs", "jinja2", "kerchunk", "libarchive-c", "lz4", "notebook", "numpy", "ocifs", "pandas", "panel", "paramiko", "pyarrow", "pyarrow (>=1)", "pyftpdlib", "pygit2", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "python-snappy", "requests", "smbprotocol", "tqdm", "urllib3", "zarr", "zstandard ; python_version < \"3.14\""]
+tqdm = ["tqdm"]
+
[[package]]
name = "google-api-core"
version = "2.27.0"
@@ -995,6 +1047,42 @@ files = [
{file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"},
]
+[[package]]
+name = "hf-xet"
+version = "1.2.0"
+description = "Fast transfer of large files with the Hugging Face Hub."
+optional = false
+python-versions = ">=3.8"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"arm64\" or platform_machine == \"aarch64\""
+files = [
+ {file = "hf_xet-1.2.0-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:ceeefcd1b7aed4956ae8499e2199607765fbd1c60510752003b6cc0b8413b649"},
+ {file = "hf_xet-1.2.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b70218dd548e9840224df5638fdc94bd033552963cfa97f9170829381179c813"},
+ {file = "hf_xet-1.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d40b18769bb9a8bc82a9ede575ce1a44c75eb80e7375a01d76259089529b5dc"},
+ {file = "hf_xet-1.2.0-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:cd3a6027d59cfb60177c12d6424e31f4b5ff13d8e3a1247b3a584bf8977e6df5"},
+ {file = "hf_xet-1.2.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6de1fc44f58f6dd937956c8d304d8c2dea264c80680bcfa61ca4a15e7b76780f"},
+ {file = "hf_xet-1.2.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:f182f264ed2acd566c514e45da9f2119110e48a87a327ca271027904c70c5832"},
+ {file = "hf_xet-1.2.0-cp313-cp313t-win_amd64.whl", hash = "sha256:293a7a3787e5c95d7be1857358a9130694a9c6021de3f27fa233f37267174382"},
+ {file = "hf_xet-1.2.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:10bfab528b968c70e062607f663e21e34e2bba349e8038db546646875495179e"},
+ {file = "hf_xet-1.2.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:2a212e842647b02eb6a911187dc878e79c4aa0aa397e88dd3b26761676e8c1f8"},
+ {file = "hf_xet-1.2.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:30e06daccb3a7d4c065f34fc26c14c74f4653069bb2b194e7f18f17cbe9939c0"},
+ {file = "hf_xet-1.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:29c8fc913a529ec0a91867ce3d119ac1aac966e098cf49501800c870328cc090"},
+ {file = "hf_xet-1.2.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:66e159cbfcfbb29f920db2c09ed8b660eb894640d284f102ada929b6e3dc410a"},
+ {file = "hf_xet-1.2.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:9c91d5ae931510107f148874e9e2de8a16052b6f1b3ca3c1b12f15ccb491390f"},
+ {file = "hf_xet-1.2.0-cp314-cp314t-win_amd64.whl", hash = "sha256:210d577732b519ac6ede149d2f2f34049d44e8622bf14eb3d63bbcd2d4b332dc"},
+ {file = "hf_xet-1.2.0-cp37-abi3-macosx_10_12_x86_64.whl", hash = "sha256:46740d4ac024a7ca9b22bebf77460ff43332868b661186a8e46c227fdae01848"},
+ {file = "hf_xet-1.2.0-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:27df617a076420d8845bea087f59303da8be17ed7ec0cd7ee3b9b9f579dff0e4"},
+ {file = "hf_xet-1.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3651fd5bfe0281951b988c0facbe726aa5e347b103a675f49a3fa8144c7968fd"},
+ {file = "hf_xet-1.2.0-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:d06fa97c8562fb3ee7a378dd9b51e343bc5bc8190254202c9771029152f5e08c"},
+ {file = "hf_xet-1.2.0-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:4c1428c9ae73ec0939410ec73023c4f842927f39db09b063b9482dac5a3bb737"},
+ {file = "hf_xet-1.2.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a55558084c16b09b5ed32ab9ed38421e2d87cf3f1f89815764d1177081b99865"},
+ {file = "hf_xet-1.2.0-cp37-abi3-win_amd64.whl", hash = "sha256:e6584a52253f72c9f52f9e549d5895ca7a471608495c4ecaa6cc73dba2b24d69"},
+ {file = "hf_xet-1.2.0.tar.gz", hash = "sha256:a8c27070ca547293b6890c4bf389f713f80e8c478631432962bb7f4bc0bd7d7f"},
+]
+
+[package.extras]
+tests = ["pytest"]
+
[[package]]
name = "httpcore"
version = "1.0.9"
@@ -1054,6 +1142,45 @@ files = [
{file = "httpx_sse-0.4.3.tar.gz", hash = "sha256:9b1ed0127459a66014aec3c56bebd93da3c1bc8bb6618c8082039a44889a755d"},
]
+[[package]]
+name = "huggingface-hub"
+version = "0.36.0"
+description = "Client library to download and publish models, datasets and other repos on the huggingface.co hub"
+optional = false
+python-versions = ">=3.8.0"
+groups = ["main"]
+files = [
+ {file = "huggingface_hub-0.36.0-py3-none-any.whl", hash = "sha256:7bcc9ad17d5b3f07b57c78e79d527102d08313caa278a641993acddcb894548d"},
+ {file = "huggingface_hub-0.36.0.tar.gz", hash = "sha256:47b3f0e2539c39bf5cde015d63b72ec49baff67b6931c3d97f3f84532e2b8d25"},
+]
+
+[package.dependencies]
+filelock = "*"
+fsspec = ">=2023.5.0"
+hf-xet = {version = ">=1.1.3,<2.0.0", markers = "platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"arm64\" or platform_machine == \"aarch64\""}
+packaging = ">=20.9"
+pyyaml = ">=5.1"
+requests = "*"
+tqdm = ">=4.42.1"
+typing-extensions = ">=3.7.4.3"
+
+[package.extras]
+all = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "aiohttp", "authlib (>=1.3.2)", "fastapi", "gradio (>=4.0.0)", "httpx", "itsdangerous", "jedi", "libcst (>=1.4.0)", "mypy (==1.15.0) ; python_version >= \"3.9\"", "mypy (>=1.14.1,<1.15.0) ; python_version == \"3.8\"", "numpy", "pytest (>=8.1.1,<8.2.2)", "pytest-asyncio", "pytest-cov", "pytest-env", "pytest-mock", "pytest-rerunfailures (<16.0)", "pytest-vcr", "pytest-xdist", "ruff (>=0.9.0)", "soundfile", "ty", "types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3", "typing-extensions (>=4.8.0)", "urllib3 (<2.0)"]
+cli = ["InquirerPy (==0.3.4)"]
+dev = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "aiohttp", "authlib (>=1.3.2)", "fastapi", "gradio (>=4.0.0)", "httpx", "itsdangerous", "jedi", "libcst (>=1.4.0)", "mypy (==1.15.0) ; python_version >= \"3.9\"", "mypy (>=1.14.1,<1.15.0) ; python_version == \"3.8\"", "numpy", "pytest (>=8.1.1,<8.2.2)", "pytest-asyncio", "pytest-cov", "pytest-env", "pytest-mock", "pytest-rerunfailures (<16.0)", "pytest-vcr", "pytest-xdist", "ruff (>=0.9.0)", "soundfile", "ty", "types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3", "typing-extensions (>=4.8.0)", "urllib3 (<2.0)"]
+fastai = ["fastai (>=2.4)", "fastcore (>=1.3.27)", "toml"]
+hf-transfer = ["hf-transfer (>=0.1.4)"]
+hf-xet = ["hf-xet (>=1.1.2,<2.0.0)"]
+inference = ["aiohttp"]
+mcp = ["aiohttp", "mcp (>=1.8.0)", "typer"]
+oauth = ["authlib (>=1.3.2)", "fastapi", "httpx", "itsdangerous"]
+quality = ["libcst (>=1.4.0)", "mypy (==1.15.0) ; python_version >= \"3.9\"", "mypy (>=1.14.1,<1.15.0) ; python_version == \"3.8\"", "ruff (>=0.9.0)", "ty"]
+tensorflow = ["graphviz", "pydot", "tensorflow"]
+tensorflow-testing = ["keras (<3.0)", "tensorflow"]
+testing = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "aiohttp", "authlib (>=1.3.2)", "fastapi", "gradio (>=4.0.0)", "httpx", "itsdangerous", "jedi", "numpy", "pytest (>=8.1.1,<8.2.2)", "pytest-asyncio", "pytest-cov", "pytest-env", "pytest-mock", "pytest-rerunfailures (<16.0)", "pytest-vcr", "pytest-xdist", "soundfile", "urllib3 (<2.0)"]
+torch = ["safetensors[torch]", "torch"]
+typing = ["types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3", "typing-extensions (>=4.8.0)"]
+
[[package]]
name = "idna"
version = "3.11"
@@ -1085,6 +1212,24 @@ files = [
colors = ["colorama"]
plugins = ["setuptools"]
+[[package]]
+name = "jinja2"
+version = "3.1.6"
+description = "A very fast and expressive template engine."
+optional = false
+python-versions = ">=3.7"
+groups = ["main"]
+files = [
+ {file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"},
+ {file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"},
+]
+
+[package.dependencies]
+MarkupSafe = ">=2.0"
+
+[package.extras]
+i18n = ["Babel (>=2.7)"]
+
[[package]]
name = "jiter"
version = "0.11.1"
@@ -1197,6 +1342,18 @@ files = [
{file = "jiter-0.11.1.tar.gz", hash = "sha256:849dcfc76481c0ea0099391235b7ca97d7279e0fa4c86005457ac7c88e8b76dc"},
]
+[[package]]
+name = "joblib"
+version = "1.5.3"
+description = "Lightweight pipelining with Python functions"
+optional = false
+python-versions = ">=3.9"
+groups = ["main"]
+files = [
+ {file = "joblib-1.5.3-py3-none-any.whl", hash = "sha256:5fc3c5039fc5ca8c0276333a188bbd59d6b7ab37fe6632daa76bc7f9ec18e713"},
+ {file = "joblib-1.5.3.tar.gz", hash = "sha256:8561a3269e6801106863fd0d6d84bb737be9e7631e33aaed3fb9ce5953688da3"},
+]
+
[[package]]
name = "jsonpatch"
version = "1.33"
@@ -1564,6 +1721,105 @@ files = [
[package.dependencies]
rapidfuzz = ">=3.9.0,<4.0.0"
+[[package]]
+name = "markupsafe"
+version = "3.0.3"
+description = "Safely add untrusted strings to HTML/XML markup."
+optional = false
+python-versions = ">=3.9"
+groups = ["main"]
+files = [
+ {file = "markupsafe-3.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2f981d352f04553a7171b8e44369f2af4055f888dfb147d55e42d29e29e74559"},
+ {file = "markupsafe-3.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e1c1493fb6e50ab01d20a22826e57520f1284df32f2d8601fdd90b6304601419"},
+ {file = "markupsafe-3.0.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1ba88449deb3de88bd40044603fafffb7bc2b055d626a330323a9ed736661695"},
+ {file = "markupsafe-3.0.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f42d0984e947b8adf7dd6dde396e720934d12c506ce84eea8476409563607591"},
+ {file = "markupsafe-3.0.3-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c0c0b3ade1c0b13b936d7970b1d37a57acde9199dc2aecc4c336773e1d86049c"},
+ {file = "markupsafe-3.0.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:0303439a41979d9e74d18ff5e2dd8c43ed6c6001fd40e5bf2e43f7bd9bbc523f"},
+ {file = "markupsafe-3.0.3-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:d2ee202e79d8ed691ceebae8e0486bd9a2cd4794cec4824e1c99b6f5009502f6"},
+ {file = "markupsafe-3.0.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:177b5253b2834fe3678cb4a5f0059808258584c559193998be2601324fdeafb1"},
+ {file = "markupsafe-3.0.3-cp310-cp310-win32.whl", hash = "sha256:2a15a08b17dd94c53a1da0438822d70ebcd13f8c3a95abe3a9ef9f11a94830aa"},
+ {file = "markupsafe-3.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:c4ffb7ebf07cfe8931028e3e4c85f0357459a3f9f9490886198848f4fa002ec8"},
+ {file = "markupsafe-3.0.3-cp310-cp310-win_arm64.whl", hash = "sha256:e2103a929dfa2fcaf9bb4e7c091983a49c9ac3b19c9061b6d5427dd7d14d81a1"},
+ {file = "markupsafe-3.0.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1cc7ea17a6824959616c525620e387f6dd30fec8cb44f649e31712db02123dad"},
+ {file = "markupsafe-3.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4bd4cd07944443f5a265608cc6aab442e4f74dff8088b0dfc8238647b8f6ae9a"},
+ {file = "markupsafe-3.0.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6b5420a1d9450023228968e7e6a9ce57f65d148ab56d2313fcd589eee96a7a50"},
+ {file = "markupsafe-3.0.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0bf2a864d67e76e5c9a34dc26ec616a66b9888e25e7b9460e1c76d3293bd9dbf"},
+ {file = "markupsafe-3.0.3-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bc51efed119bc9cfdf792cdeaa4d67e8f6fcccab66ed4bfdd6bde3e59bfcbb2f"},
+ {file = "markupsafe-3.0.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:068f375c472b3e7acbe2d5318dea141359e6900156b5b2ba06a30b169086b91a"},
+ {file = "markupsafe-3.0.3-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:7be7b61bb172e1ed687f1754f8e7484f1c8019780f6f6b0786e76bb01c2ae115"},
+ {file = "markupsafe-3.0.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f9e130248f4462aaa8e2552d547f36ddadbeaa573879158d721bbd33dfe4743a"},
+ {file = "markupsafe-3.0.3-cp311-cp311-win32.whl", hash = "sha256:0db14f5dafddbb6d9208827849fad01f1a2609380add406671a26386cdf15a19"},
+ {file = "markupsafe-3.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:de8a88e63464af587c950061a5e6a67d3632e36df62b986892331d4620a35c01"},
+ {file = "markupsafe-3.0.3-cp311-cp311-win_arm64.whl", hash = "sha256:3b562dd9e9ea93f13d53989d23a7e775fdfd1066c33494ff43f5418bc8c58a5c"},
+ {file = "markupsafe-3.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d53197da72cc091b024dd97249dfc7794d6a56530370992a5e1a08983ad9230e"},
+ {file = "markupsafe-3.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1872df69a4de6aead3491198eaf13810b565bdbeec3ae2dc8780f14458ec73ce"},
+ {file = "markupsafe-3.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3a7e8ae81ae39e62a41ec302f972ba6ae23a5c5396c8e60113e9066ef893da0d"},
+ {file = "markupsafe-3.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d6dd0be5b5b189d31db7cda48b91d7e0a9795f31430b7f271219ab30f1d3ac9d"},
+ {file = "markupsafe-3.0.3-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:94c6f0bb423f739146aec64595853541634bde58b2135f27f61c1ffd1cd4d16a"},
+ {file = "markupsafe-3.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:be8813b57049a7dc738189df53d69395eba14fb99345e0a5994914a3864c8a4b"},
+ {file = "markupsafe-3.0.3-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:83891d0e9fb81a825d9a6d61e3f07550ca70a076484292a70fde82c4b807286f"},
+ {file = "markupsafe-3.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:77f0643abe7495da77fb436f50f8dab76dbc6e5fd25d39589a0f1fe6548bfa2b"},
+ {file = "markupsafe-3.0.3-cp312-cp312-win32.whl", hash = "sha256:d88b440e37a16e651bda4c7c2b930eb586fd15ca7406cb39e211fcff3bf3017d"},
+ {file = "markupsafe-3.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:26a5784ded40c9e318cfc2bdb30fe164bdb8665ded9cd64d500a34fb42067b1c"},
+ {file = "markupsafe-3.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:35add3b638a5d900e807944a078b51922212fb3dedb01633a8defc4b01a3c85f"},
+ {file = "markupsafe-3.0.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e1cf1972137e83c5d4c136c43ced9ac51d0e124706ee1c8aa8532c1287fa8795"},
+ {file = "markupsafe-3.0.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:116bb52f642a37c115f517494ea5feb03889e04df47eeff5b130b1808ce7c219"},
+ {file = "markupsafe-3.0.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:133a43e73a802c5562be9bbcd03d090aa5a1fe899db609c29e8c8d815c5f6de6"},
+ {file = "markupsafe-3.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ccfcd093f13f0f0b7fdd0f198b90053bf7b2f02a3927a30e63f3ccc9df56b676"},
+ {file = "markupsafe-3.0.3-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:509fa21c6deb7a7a273d629cf5ec029bc209d1a51178615ddf718f5918992ab9"},
+ {file = "markupsafe-3.0.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4afe79fb3de0b7097d81da19090f4df4f8d3a2b3adaa8764138aac2e44f3af1"},
+ {file = "markupsafe-3.0.3-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:795e7751525cae078558e679d646ae45574b47ed6e7771863fcc079a6171a0fc"},
+ {file = "markupsafe-3.0.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8485f406a96febb5140bfeca44a73e3ce5116b2501ac54fe953e488fb1d03b12"},
+ {file = "markupsafe-3.0.3-cp313-cp313-win32.whl", hash = "sha256:bdd37121970bfd8be76c5fb069c7751683bdf373db1ed6c010162b2a130248ed"},
+ {file = "markupsafe-3.0.3-cp313-cp313-win_amd64.whl", hash = "sha256:9a1abfdc021a164803f4d485104931fb8f8c1efd55bc6b748d2f5774e78b62c5"},
+ {file = "markupsafe-3.0.3-cp313-cp313-win_arm64.whl", hash = "sha256:7e68f88e5b8799aa49c85cd116c932a1ac15caaa3f5db09087854d218359e485"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:218551f6df4868a8d527e3062d0fb968682fe92054e89978594c28e642c43a73"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:3524b778fe5cfb3452a09d31e7b5adefeea8c5be1d43c4f810ba09f2ceb29d37"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4e885a3d1efa2eadc93c894a21770e4bc67899e3543680313b09f139e149ab19"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8709b08f4a89aa7586de0aadc8da56180242ee0ada3999749b183aa23df95025"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b8512a91625c9b3da6f127803b166b629725e68af71f8184ae7e7d54686a56d6"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:9b79b7a16f7fedff2495d684f2b59b0457c3b493778c9eed31111be64d58279f"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:12c63dfb4a98206f045aa9563db46507995f7ef6d83b2f68eda65c307c6829eb"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:8f71bc33915be5186016f675cd83a1e08523649b0e33efdb898db577ef5bb009"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-win32.whl", hash = "sha256:69c0b73548bc525c8cb9a251cddf1931d1db4d2258e9599c28c07ef3580ef354"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-win_amd64.whl", hash = "sha256:1b4b79e8ebf6b55351f0d91fe80f893b4743f104bff22e90697db1590e47a218"},
+ {file = "markupsafe-3.0.3-cp313-cp313t-win_arm64.whl", hash = "sha256:ad2cf8aa28b8c020ab2fc8287b0f823d0a7d8630784c31e9ee5edea20f406287"},
+ {file = "markupsafe-3.0.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:eaa9599de571d72e2daf60164784109f19978b327a3910d3e9de8c97b5b70cfe"},
+ {file = "markupsafe-3.0.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c47a551199eb8eb2121d4f0f15ae0f923d31350ab9280078d1e5f12b249e0026"},
+ {file = "markupsafe-3.0.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f34c41761022dd093b4b6896d4810782ffbabe30f2d443ff5f083e0cbbb8c737"},
+ {file = "markupsafe-3.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:457a69a9577064c05a97c41f4e65148652db078a3a509039e64d3467b9e7ef97"},
+ {file = "markupsafe-3.0.3-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e8afc3f2ccfa24215f8cb28dcf43f0113ac3c37c2f0f0806d8c70e4228c5cf4d"},
+ {file = "markupsafe-3.0.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:ec15a59cf5af7be74194f7ab02d0f59a62bdcf1a537677ce67a2537c9b87fcda"},
+ {file = "markupsafe-3.0.3-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:0eb9ff8191e8498cca014656ae6b8d61f39da5f95b488805da4bb029cccbfbaf"},
+ {file = "markupsafe-3.0.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:2713baf880df847f2bece4230d4d094280f4e67b1e813eec43b4c0e144a34ffe"},
+ {file = "markupsafe-3.0.3-cp314-cp314-win32.whl", hash = "sha256:729586769a26dbceff69f7a7dbbf59ab6572b99d94576a5592625d5b411576b9"},
+ {file = "markupsafe-3.0.3-cp314-cp314-win_amd64.whl", hash = "sha256:bdc919ead48f234740ad807933cdf545180bfbe9342c2bb451556db2ed958581"},
+ {file = "markupsafe-3.0.3-cp314-cp314-win_arm64.whl", hash = "sha256:5a7d5dc5140555cf21a6fefbdbf8723f06fcd2f63ef108f2854de715e4422cb4"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:1353ef0c1b138e1907ae78e2f6c63ff67501122006b0f9abad68fda5f4ffc6ab"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:1085e7fbddd3be5f89cc898938f42c0b3c711fdcb37d75221de2666af647c175"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1b52b4fb9df4eb9ae465f8d0c228a00624de2334f216f178a995ccdcf82c4634"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fed51ac40f757d41b7c48425901843666a6677e3e8eb0abcff09e4ba6e664f50"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f190daf01f13c72eac4efd5c430a8de82489d9cff23c364c3ea822545032993e"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e56b7d45a839a697b5eb268c82a71bd8c7f6c94d6fd50c3d577fa39a9f1409f5"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:f3e98bb3798ead92273dc0e5fd0f31ade220f59a266ffd8a4f6065e0a3ce0523"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5678211cb9333a6468fb8d8be0305520aa073f50d17f089b5b4b477ea6e67fdc"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-win32.whl", hash = "sha256:915c04ba3851909ce68ccc2b8e2cd691618c4dc4c4232fb7982bca3f41fd8c3d"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4faffd047e07c38848ce017e8725090413cd80cbc23d86e55c587bf979e579c9"},
+ {file = "markupsafe-3.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:32001d6a8fc98c8cb5c947787c5d08b0a50663d139f1305bac5885d98d9b40fa"},
+ {file = "markupsafe-3.0.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:15d939a21d546304880945ca1ecb8a039db6b4dc49b2c5a400387cdae6a62e26"},
+ {file = "markupsafe-3.0.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:f71a396b3bf33ecaa1626c255855702aca4d3d9fea5e051b41ac59a9c1c41edc"},
+ {file = "markupsafe-3.0.3-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0f4b68347f8c5eab4a13419215bdfd7f8c9b19f2b25520968adfad23eb0ce60c"},
+ {file = "markupsafe-3.0.3-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e8fc20152abba6b83724d7ff268c249fa196d8259ff481f3b1476383f8f24e42"},
+ {file = "markupsafe-3.0.3-cp39-cp39-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:949b8d66bc381ee8b007cd945914c721d9aba8e27f71959d750a46f7c282b20b"},
+ {file = "markupsafe-3.0.3-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:3537e01efc9d4dccdf77221fb1cb3b8e1a38d5428920e0657ce299b20324d758"},
+ {file = "markupsafe-3.0.3-cp39-cp39-musllinux_1_2_riscv64.whl", hash = "sha256:591ae9f2a647529ca990bc681daebdd52c8791ff06c2bfa05b65163e28102ef2"},
+ {file = "markupsafe-3.0.3-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:a320721ab5a1aba0a233739394eb907f8c8da5c98c9181d1161e77a0c8e36f2d"},
+ {file = "markupsafe-3.0.3-cp39-cp39-win32.whl", hash = "sha256:df2449253ef108a379b8b5d6b43f4b1a8e81a061d6537becd5582fba5f9196d7"},
+ {file = "markupsafe-3.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:7c3fb7d25180895632e5d3148dbdc29ea38ccb7fd210aa27acbd1201a1902c6e"},
+ {file = "markupsafe-3.0.3-cp39-cp39-win_arm64.whl", hash = "sha256:38664109c14ffc9e7437e86b4dceb442b0096dfe3541d7864d9cbe1da4cf36c8"},
+ {file = "markupsafe-3.0.3.tar.gz", hash = "sha256:722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698"},
+]
+
[[package]]
name = "mccabe"
version = "0.7.0"
@@ -1576,6 +1832,24 @@ files = [
{file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"},
]
+[[package]]
+name = "mpmath"
+version = "1.3.0"
+description = "Python library for arbitrary-precision floating-point arithmetic"
+optional = false
+python-versions = "*"
+groups = ["main"]
+files = [
+ {file = "mpmath-1.3.0-py3-none-any.whl", hash = "sha256:a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c"},
+ {file = "mpmath-1.3.0.tar.gz", hash = "sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f"},
+]
+
+[package.extras]
+develop = ["codecov", "pycodestyle", "pytest (>=4.6)", "pytest-cov", "wheel"]
+docs = ["sphinx"]
+gmpy = ["gmpy2 (>=2.1.0a4) ; platform_python_implementation != \"PyPy\""]
+tests = ["pytest (>=4.6)"]
+
[[package]]
name = "neo4j"
version = "6.0.2"
@@ -1596,6 +1870,54 @@ numpy = ["numpy (>=1.21.2,<3.0.0)"]
pandas = ["numpy (>=1.21.2,<3.0.0)", "pandas (>=1.1.0,<3.0.0)"]
pyarrow = ["pyarrow (>=6.0.0,<22.0.0)"]
+[[package]]
+name = "networkx"
+version = "3.6"
+description = "Python package for creating and manipulating graphs and networks"
+optional = false
+python-versions = ">=3.11"
+groups = ["main"]
+markers = "python_version >= \"3.14\""
+files = [
+ {file = "networkx-3.6-py3-none-any.whl", hash = "sha256:cdb395b105806062473d3be36458d8f1459a4e4b98e236a66c3a48996e07684f"},
+ {file = "networkx-3.6.tar.gz", hash = "sha256:285276002ad1f7f7da0f7b42f004bcba70d381e936559166363707fdad3d72ad"},
+]
+
+[package.extras]
+benchmarking = ["asv", "virtualenv"]
+default = ["matplotlib (>=3.8)", "numpy (>=1.25)", "pandas (>=2.0)", "scipy (>=1.11.2)"]
+developer = ["mypy (>=1.15)", "pre-commit (>=4.1)"]
+doc = ["intersphinx-registry", "myst-nb (>=1.1)", "numpydoc (>=1.8.0)", "pillow (>=10)", "pydata-sphinx-theme (>=0.16)", "sphinx (>=8.0)", "sphinx-gallery (>=0.18)", "texext (>=0.6.7)"]
+example = ["cairocffi (>=1.7)", "contextily (>=1.6)", "igraph (>=0.11)", "iplotx (>=0.9.0)", "momepy (>=0.7.2)", "osmnx (>=2.0.0)", "scikit-learn (>=1.5)", "seaborn (>=0.13)"]
+extra = ["lxml (>=4.6)", "pydot (>=3.0.1)", "pygraphviz (>=1.14)", "sympy (>=1.10)"]
+release = ["build (>=0.10)", "changelist (==0.5)", "twine (>=4.0)", "wheel (>=0.40)"]
+test = ["pytest (>=7.2)", "pytest-cov (>=4.0)", "pytest-xdist (>=3.0)"]
+test-extras = ["pytest-mpl", "pytest-randomly"]
+
+[[package]]
+name = "networkx"
+version = "3.6.1"
+description = "Python package for creating and manipulating graphs and networks"
+optional = false
+python-versions = "!=3.14.1,>=3.11"
+groups = ["main"]
+markers = "python_version <= \"3.13\""
+files = [
+ {file = "networkx-3.6.1-py3-none-any.whl", hash = "sha256:d47fbf302e7d9cbbb9e2555a0d267983d2aa476bac30e90dfbe5669bd57f3762"},
+ {file = "networkx-3.6.1.tar.gz", hash = "sha256:26b7c357accc0c8cde558ad486283728b65b6a95d85ee1cd66bafab4c8168509"},
+]
+
+[package.extras]
+benchmarking = ["asv", "virtualenv"]
+default = ["matplotlib (>=3.8)", "numpy (>=1.25)", "pandas (>=2.0)", "scipy (>=1.11.2)"]
+developer = ["mypy (>=1.15)", "pre-commit (>=4.1)"]
+doc = ["intersphinx-registry", "myst-nb (>=1.1)", "numpydoc (>=1.8.0)", "pillow (>=10)", "pydata-sphinx-theme (>=0.16)", "sphinx (>=8.0)", "sphinx-gallery (>=0.18)", "texext (>=0.6.7)"]
+example = ["cairocffi (>=1.7)", "contextily (>=1.6)", "igraph (>=0.11)", "iplotx (>=0.9.0)", "momepy (>=0.7.2)", "osmnx (>=2.0.0)", "scikit-learn (>=1.5)", "seaborn (>=0.13)"]
+extra = ["lxml (>=4.6)", "pydot (>=3.0.1)", "pygraphviz (>=1.14)", "sympy (>=1.10)"]
+release = ["build (>=0.10)", "changelist (==0.5)", "twine (>=4.0)", "wheel (>=0.40)"]
+test = ["pytest (>=7.2)", "pytest-cov (>=4.0)", "pytest-xdist (>=3.0)"]
+test-extras = ["pytest-mpl", "pytest-randomly"]
+
[[package]]
name = "numexpr"
version = "2.14.1"
@@ -1750,6 +2072,449 @@ files = [
{file = "numpy-2.3.4.tar.gz", hash = "sha256:a7d018bfedb375a8d979ac758b120ba846a7fe764911a64465fd87b8729f4a6a"},
]
+[[package]]
+name = "nvidia-cublas-cu12"
+version = "12.6.4.1"
+description = "CUBLAS native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_cublas_cu12-12.6.4.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:08ed2686e9875d01b58e3cb379c6896df8e76c75e0d4a7f7dace3d7b6d9ef8eb"},
+ {file = "nvidia_cublas_cu12-12.6.4.1-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:235f728d6e2a409eddf1df58d5b0921cf80cfa9e72b9f2775ccb7b4a87984668"},
+ {file = "nvidia_cublas_cu12-12.6.4.1-py3-none-win_amd64.whl", hash = "sha256:9e4fa264f4d8a4eb0cdbd34beadc029f453b3bafae02401e999cf3d5a5af75f8"},
+]
+
+[[package]]
+name = "nvidia-cublas-cu12"
+version = "12.8.4.1"
+description = "CUBLAS native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_cublas_cu12-12.8.4.1-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:b86f6dd8935884615a0683b663891d43781b819ac4f2ba2b0c9604676af346d0"},
+ {file = "nvidia_cublas_cu12-12.8.4.1-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:8ac4e771d5a348c551b2a426eda6193c19aa630236b418086020df5ba9667142"},
+ {file = "nvidia_cublas_cu12-12.8.4.1-py3-none-win_amd64.whl", hash = "sha256:47e9b82132fa8d2b4944e708049229601448aaad7e6f296f630f2d1a32de35af"},
+]
+
+[[package]]
+name = "nvidia-cuda-cupti-cu12"
+version = "12.6.80"
+description = "CUDA profiling tools runtime libs."
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_cuda_cupti_cu12-12.6.80-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:166ee35a3ff1587f2490364f90eeeb8da06cd867bd5b701bf7f9a02b78bc63fc"},
+ {file = "nvidia_cuda_cupti_cu12-12.6.80-py3-none-manylinux2014_aarch64.whl", hash = "sha256:358b4a1d35370353d52e12f0a7d1769fc01ff74a191689d3870b2123156184c4"},
+ {file = "nvidia_cuda_cupti_cu12-12.6.80-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:6768bad6cab4f19e8292125e5f1ac8aa7d1718704012a0e3272a6f61c4bce132"},
+ {file = "nvidia_cuda_cupti_cu12-12.6.80-py3-none-manylinux2014_x86_64.whl", hash = "sha256:a3eff6cdfcc6a4c35db968a06fcadb061cbc7d6dde548609a941ff8701b98b73"},
+ {file = "nvidia_cuda_cupti_cu12-12.6.80-py3-none-win_amd64.whl", hash = "sha256:bbe6ae76e83ce5251b56e8c8e61a964f757175682bbad058b170b136266ab00a"},
+]
+
+[[package]]
+name = "nvidia-cuda-cupti-cu12"
+version = "12.8.90"
+description = "CUDA profiling tools runtime libs."
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_cuda_cupti_cu12-12.8.90-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:4412396548808ddfed3f17a467b104ba7751e6b58678a4b840675c56d21cf7ed"},
+ {file = "nvidia_cuda_cupti_cu12-12.8.90-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ea0cb07ebda26bb9b29ba82cda34849e73c166c18162d3913575b0c9db9a6182"},
+ {file = "nvidia_cuda_cupti_cu12-12.8.90-py3-none-win_amd64.whl", hash = "sha256:bb479dcdf7e6d4f8b0b01b115260399bf34154a1a2e9fe11c85c517d87efd98e"},
+]
+
+[[package]]
+name = "nvidia-cuda-nvrtc-cu12"
+version = "12.6.77"
+description = "NVRTC native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_cuda_nvrtc_cu12-12.6.77-py3-none-manylinux2014_aarch64.whl", hash = "sha256:5847f1d6e5b757f1d2b3991a01082a44aad6f10ab3c5c0213fa3e25bddc25a13"},
+ {file = "nvidia_cuda_nvrtc_cu12-12.6.77-py3-none-manylinux2014_x86_64.whl", hash = "sha256:35b0cc6ee3a9636d5409133e79273ce1f3fd087abb0532d2d2e8fff1fe9efc53"},
+ {file = "nvidia_cuda_nvrtc_cu12-12.6.77-py3-none-win_amd64.whl", hash = "sha256:f7007dbd914c56bd80ea31bc43e8e149da38f68158f423ba845fc3292684e45a"},
+]
+
+[[package]]
+name = "nvidia-cuda-nvrtc-cu12"
+version = "12.8.93"
+description = "NVRTC native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_cuda_nvrtc_cu12-12.8.93-py3-none-manylinux2010_x86_64.manylinux_2_12_x86_64.whl", hash = "sha256:a7756528852ef889772a84c6cd89d41dfa74667e24cca16bb31f8f061e3e9994"},
+ {file = "nvidia_cuda_nvrtc_cu12-12.8.93-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:fc1fec1e1637854b4c0a65fb9a8346b51dd9ee69e61ebaccc82058441f15bce8"},
+ {file = "nvidia_cuda_nvrtc_cu12-12.8.93-py3-none-win_amd64.whl", hash = "sha256:7a4b6b2904850fe78e0bd179c4b655c404d4bb799ef03ddc60804247099ae909"},
+]
+
+[[package]]
+name = "nvidia-cuda-runtime-cu12"
+version = "12.6.77"
+description = "CUDA Runtime native Libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_cuda_runtime_cu12-12.6.77-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:6116fad3e049e04791c0256a9778c16237837c08b27ed8c8401e2e45de8d60cd"},
+ {file = "nvidia_cuda_runtime_cu12-12.6.77-py3-none-manylinux2014_aarch64.whl", hash = "sha256:d461264ecb429c84c8879a7153499ddc7b19b5f8d84c204307491989a365588e"},
+ {file = "nvidia_cuda_runtime_cu12-12.6.77-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ba3b56a4f896141e25e19ab287cd71e52a6a0f4b29d0d31609f60e3b4d5219b7"},
+ {file = "nvidia_cuda_runtime_cu12-12.6.77-py3-none-manylinux2014_x86_64.whl", hash = "sha256:a84d15d5e1da416dd4774cb42edf5e954a3e60cc945698dc1d5be02321c44dc8"},
+ {file = "nvidia_cuda_runtime_cu12-12.6.77-py3-none-win_amd64.whl", hash = "sha256:86c58044c824bf3c173c49a2dbc7a6c8b53cb4e4dca50068be0bf64e9dab3f7f"},
+]
+
+[[package]]
+name = "nvidia-cuda-runtime-cu12"
+version = "12.8.90"
+description = "CUDA Runtime native Libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_cuda_runtime_cu12-12.8.90-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:52bf7bbee900262ffefe5e9d5a2a69a30d97e2bc5bb6cc866688caa976966e3d"},
+ {file = "nvidia_cuda_runtime_cu12-12.8.90-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:adade8dcbd0edf427b7204d480d6066d33902cab2a4707dcfc48a2d0fd44ab90"},
+ {file = "nvidia_cuda_runtime_cu12-12.8.90-py3-none-win_amd64.whl", hash = "sha256:c0c6027f01505bfed6c3b21ec546f69c687689aad5f1a377554bc6ca4aa993a8"},
+]
+
+[[package]]
+name = "nvidia-cudnn-cu12"
+version = "9.5.1.17"
+description = "cuDNN runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_cudnn_cu12-9.5.1.17-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:9fd4584468533c61873e5fda8ca41bac3a38bcb2d12350830c69b0a96a7e4def"},
+ {file = "nvidia_cudnn_cu12-9.5.1.17-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:30ac3869f6db17d170e0e556dd6cc5eee02647abc31ca856634d5a40f82c15b2"},
+ {file = "nvidia_cudnn_cu12-9.5.1.17-py3-none-win_amd64.whl", hash = "sha256:d7af0f8a4f3b4b9dbb3122f2ef553b45694ed9c384d5a75bab197b8eefb79ab8"},
+]
+
+[package.dependencies]
+nvidia-cublas-cu12 = "*"
+
+[[package]]
+name = "nvidia-cudnn-cu12"
+version = "9.10.2.21"
+description = "cuDNN runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_cudnn_cu12-9.10.2.21-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:c9132cc3f8958447b4910a1720036d9eff5928cc3179b0a51fb6d167c6cc87d8"},
+ {file = "nvidia_cudnn_cu12-9.10.2.21-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:949452be657fa16687d0930933f032835951ef0892b37d2d53824d1a84dc97a8"},
+ {file = "nvidia_cudnn_cu12-9.10.2.21-py3-none-win_amd64.whl", hash = "sha256:c6288de7d63e6cf62988f0923f96dc339cea362decb1bf5b3141883392a7d65e"},
+]
+
+[package.dependencies]
+nvidia-cublas-cu12 = "*"
+
+[[package]]
+name = "nvidia-cufft-cu12"
+version = "11.3.0.4"
+description = "CUFFT native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_cufft_cu12-11.3.0.4-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d16079550df460376455cba121db6564089176d9bac9e4f360493ca4741b22a6"},
+ {file = "nvidia_cufft_cu12-11.3.0.4-py3-none-manylinux2014_aarch64.whl", hash = "sha256:8510990de9f96c803a051822618d42bf6cb8f069ff3f48d93a8486efdacb48fb"},
+ {file = "nvidia_cufft_cu12-11.3.0.4-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ccba62eb9cef5559abd5e0d54ceed2d9934030f51163df018532142a8ec533e5"},
+ {file = "nvidia_cufft_cu12-11.3.0.4-py3-none-manylinux2014_x86_64.whl", hash = "sha256:768160ac89f6f7b459bee747e8d175dbf53619cfe74b2a5636264163138013ca"},
+ {file = "nvidia_cufft_cu12-11.3.0.4-py3-none-win_amd64.whl", hash = "sha256:6048ebddfb90d09d2707efb1fd78d4e3a77cb3ae4dc60e19aab6be0ece2ae464"},
+]
+
+[package.dependencies]
+nvidia-nvjitlink-cu12 = "*"
+
+[[package]]
+name = "nvidia-cufft-cu12"
+version = "11.3.3.83"
+description = "CUFFT native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_cufft_cu12-11.3.3.83-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:848ef7224d6305cdb2a4df928759dca7b1201874787083b6e7550dd6765ce69a"},
+ {file = "nvidia_cufft_cu12-11.3.3.83-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4d2dd21ec0b88cf61b62e6b43564355e5222e4a3fb394cac0db101f2dd0d4f74"},
+ {file = "nvidia_cufft_cu12-11.3.3.83-py3-none-win_amd64.whl", hash = "sha256:7a64a98ef2a7c47f905aaf8931b69a3a43f27c55530c698bb2ed7c75c0b42cb7"},
+]
+
+[package.dependencies]
+nvidia-nvjitlink-cu12 = "*"
+
+[[package]]
+name = "nvidia-cufile-cu12"
+version = "1.11.1.6"
+description = "cuFile GPUDirect libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_cufile_cu12-1.11.1.6-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:cc23469d1c7e52ce6c1d55253273d32c565dd22068647f3aa59b3c6b005bf159"},
+ {file = "nvidia_cufile_cu12-1.11.1.6-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:8f57a0051dcf2543f6dc2b98a98cb2719c37d3cee1baba8965d57f3bbc90d4db"},
+]
+
+[[package]]
+name = "nvidia-cufile-cu12"
+version = "1.13.1.3"
+description = "cuFile GPUDirect libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_cufile_cu12-1.13.1.3-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:1d069003be650e131b21c932ec3d8969c1715379251f8d23a1860554b1cb24fc"},
+ {file = "nvidia_cufile_cu12-1.13.1.3-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:4beb6d4cce47c1a0f1013d72e02b0994730359e17801d395bdcbf20cfb3bb00a"},
+]
+
+[[package]]
+name = "nvidia-curand-cu12"
+version = "10.3.7.77"
+description = "CURAND native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_curand_cu12-10.3.7.77-py3-none-manylinux2014_aarch64.whl", hash = "sha256:6e82df077060ea28e37f48a3ec442a8f47690c7499bff392a5938614b56c98d8"},
+ {file = "nvidia_curand_cu12-10.3.7.77-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:a42cd1344297f70b9e39a1e4f467a4e1c10f1da54ff7a85c12197f6c652c8bdf"},
+ {file = "nvidia_curand_cu12-10.3.7.77-py3-none-manylinux2014_x86_64.whl", hash = "sha256:99f1a32f1ac2bd134897fc7a203f779303261268a65762a623bf30cc9fe79117"},
+ {file = "nvidia_curand_cu12-10.3.7.77-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:7b2ed8e95595c3591d984ea3603dd66fe6ce6812b886d59049988a712ed06b6e"},
+ {file = "nvidia_curand_cu12-10.3.7.77-py3-none-win_amd64.whl", hash = "sha256:6d6d935ffba0f3d439b7cd968192ff068fafd9018dbf1b85b37261b13cfc9905"},
+]
+
+[[package]]
+name = "nvidia-curand-cu12"
+version = "10.3.9.90"
+description = "CURAND native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_curand_cu12-10.3.9.90-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:dfab99248034673b779bc6decafdc3404a8a6f502462201f2f31f11354204acd"},
+ {file = "nvidia_curand_cu12-10.3.9.90-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:b32331d4f4df5d6eefa0554c565b626c7216f87a06a4f56fab27c3b68a830ec9"},
+ {file = "nvidia_curand_cu12-10.3.9.90-py3-none-win_amd64.whl", hash = "sha256:f149a8ca457277da854f89cf282d6ef43176861926c7ac85b2a0fbd237c587ec"},
+]
+
+[[package]]
+name = "nvidia-cusolver-cu12"
+version = "11.7.1.2"
+description = "CUDA solver native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_cusolver_cu12-11.7.1.2-py3-none-manylinux2014_aarch64.whl", hash = "sha256:0ce237ef60acde1efc457335a2ddadfd7610b892d94efee7b776c64bb1cac9e0"},
+ {file = "nvidia_cusolver_cu12-11.7.1.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:e9e49843a7707e42022babb9bcfa33c29857a93b88020c4e4434656a655b698c"},
+ {file = "nvidia_cusolver_cu12-11.7.1.2-py3-none-manylinux2014_x86_64.whl", hash = "sha256:6cf28f17f64107a0c4d7802be5ff5537b2130bfc112f25d5a30df227058ca0e6"},
+ {file = "nvidia_cusolver_cu12-11.7.1.2-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:dbbe4fc38ec1289c7e5230e16248365e375c3673c9c8bac5796e2e20db07f56e"},
+ {file = "nvidia_cusolver_cu12-11.7.1.2-py3-none-win_amd64.whl", hash = "sha256:6813f9d8073f555444a8705f3ab0296d3e1cb37a16d694c5fc8b862a0d8706d7"},
+]
+
+[package.dependencies]
+nvidia-cublas-cu12 = "*"
+nvidia-cusparse-cu12 = "*"
+nvidia-nvjitlink-cu12 = "*"
+
+[[package]]
+name = "nvidia-cusolver-cu12"
+version = "11.7.3.90"
+description = "CUDA solver native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_cusolver_cu12-11.7.3.90-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:db9ed69dbef9715071232caa9b69c52ac7de3a95773c2db65bdba85916e4e5c0"},
+ {file = "nvidia_cusolver_cu12-11.7.3.90-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:4376c11ad263152bd50ea295c05370360776f8c3427b30991df774f9fb26c450"},
+ {file = "nvidia_cusolver_cu12-11.7.3.90-py3-none-win_amd64.whl", hash = "sha256:4a550db115fcabc4d495eb7d39ac8b58d4ab5d8e63274d3754df1c0ad6a22d34"},
+]
+
+[package.dependencies]
+nvidia-cublas-cu12 = "*"
+nvidia-cusparse-cu12 = "*"
+nvidia-nvjitlink-cu12 = "*"
+
+[[package]]
+name = "nvidia-cusparse-cu12"
+version = "12.5.4.2"
+description = "CUSPARSE native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_cusparse_cu12-12.5.4.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d25b62fb18751758fe3c93a4a08eff08effedfe4edf1c6bb5afd0890fe88f887"},
+ {file = "nvidia_cusparse_cu12-12.5.4.2-py3-none-manylinux2014_aarch64.whl", hash = "sha256:7aa32fa5470cf754f72d1116c7cbc300b4e638d3ae5304cfa4a638a5b87161b1"},
+ {file = "nvidia_cusparse_cu12-12.5.4.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7556d9eca156e18184b94947ade0fba5bb47d69cec46bf8660fd2c71a4b48b73"},
+ {file = "nvidia_cusparse_cu12-12.5.4.2-py3-none-manylinux2014_x86_64.whl", hash = "sha256:23749a6571191a215cb74d1cdbff4a86e7b19f1200c071b3fcf844a5bea23a2f"},
+ {file = "nvidia_cusparse_cu12-12.5.4.2-py3-none-win_amd64.whl", hash = "sha256:4acb8c08855a26d737398cba8fb6f8f5045d93f82612b4cfd84645a2332ccf20"},
+]
+
+[package.dependencies]
+nvidia-nvjitlink-cu12 = "*"
+
+[[package]]
+name = "nvidia-cusparse-cu12"
+version = "12.5.8.93"
+description = "CUSPARSE native runtime libraries"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_cusparse_cu12-12.5.8.93-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:9b6c161cb130be1a07a27ea6923df8141f3c295852f4b260c65f18f3e0a091dc"},
+ {file = "nvidia_cusparse_cu12-12.5.8.93-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:1ec05d76bbbd8b61b06a80e1eaf8cf4959c3d4ce8e711b65ebd0443bb0ebb13b"},
+ {file = "nvidia_cusparse_cu12-12.5.8.93-py3-none-win_amd64.whl", hash = "sha256:9a33604331cb2cac199f2e7f5104dfbb8a5a898c367a53dfda9ff2acb6b6b4dd"},
+]
+
+[package.dependencies]
+nvidia-nvjitlink-cu12 = "*"
+
+[[package]]
+name = "nvidia-cusparselt-cu12"
+version = "0.6.3"
+description = "NVIDIA cuSPARSELt"
+optional = false
+python-versions = "*"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_cusparselt_cu12-0.6.3-py3-none-manylinux2014_aarch64.whl", hash = "sha256:8371549623ba601a06322af2133c4a44350575f5a3108fb75f3ef20b822ad5f1"},
+ {file = "nvidia_cusparselt_cu12-0.6.3-py3-none-manylinux2014_x86_64.whl", hash = "sha256:e5c8a26c36445dd2e6812f1177978a24e2d37cacce7e090f297a688d1ec44f46"},
+ {file = "nvidia_cusparselt_cu12-0.6.3-py3-none-win_amd64.whl", hash = "sha256:3b325bcbd9b754ba43df5a311488fca11a6b5dc3d11df4d190c000cf1a0765c7"},
+]
+
+[[package]]
+name = "nvidia-cusparselt-cu12"
+version = "0.7.1"
+description = "NVIDIA cuSPARSELt"
+optional = false
+python-versions = "*"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_cusparselt_cu12-0.7.1-py3-none-manylinux2014_aarch64.whl", hash = "sha256:8878dce784d0fac90131b6817b607e803c36e629ba34dc5b433471382196b6a5"},
+ {file = "nvidia_cusparselt_cu12-0.7.1-py3-none-manylinux2014_x86_64.whl", hash = "sha256:f1bb701d6b930d5a7cea44c19ceb973311500847f81b634d802b7b539dc55623"},
+ {file = "nvidia_cusparselt_cu12-0.7.1-py3-none-win_amd64.whl", hash = "sha256:f67fbb5831940ec829c9117b7f33807db9f9678dc2a617fbe781cac17b4e1075"},
+]
+
+[[package]]
+name = "nvidia-nccl-cu12"
+version = "2.26.2"
+description = "NVIDIA Collective Communication Library (NCCL) Runtime"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_nccl_cu12-2.26.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:5c196e95e832ad30fbbb50381eb3cbd1fadd5675e587a548563993609af19522"},
+ {file = "nvidia_nccl_cu12-2.26.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:694cf3879a206553cc9d7dbda76b13efaf610fdb70a50cba303de1b0d1530ac6"},
+]
+
+[[package]]
+name = "nvidia-nccl-cu12"
+version = "2.27.5"
+description = "NVIDIA Collective Communication Library (NCCL) Runtime"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_nccl_cu12-2.27.5-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:31432ad4d1fb1004eb0c56203dc9bc2178a1ba69d1d9e02d64a6938ab5e40e7a"},
+ {file = "nvidia_nccl_cu12-2.27.5-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ad730cf15cb5d25fe849c6e6ca9eb5b76db16a80f13f425ac68d8e2e55624457"},
+]
+
+[[package]]
+name = "nvidia-nvjitlink-cu12"
+version = "12.6.85"
+description = "Nvidia JIT LTO Library"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_nvjitlink_cu12-12.6.85-py3-none-manylinux2010_x86_64.manylinux_2_12_x86_64.whl", hash = "sha256:eedc36df9e88b682efe4309aa16b5b4e78c2407eac59e8c10a6a47535164369a"},
+ {file = "nvidia_nvjitlink_cu12-12.6.85-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cf4eaa7d4b6b543ffd69d6abfb11efdeb2db48270d94dfd3a452c24150829e41"},
+ {file = "nvidia_nvjitlink_cu12-12.6.85-py3-none-win_amd64.whl", hash = "sha256:e61120e52ed675747825cdd16febc6a0730537451d867ee58bee3853b1b13d1c"},
+]
+
+[[package]]
+name = "nvidia-nvjitlink-cu12"
+version = "12.8.93"
+description = "Nvidia JIT LTO Library"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_nvjitlink_cu12-12.8.93-py3-none-manylinux2010_x86_64.manylinux_2_12_x86_64.whl", hash = "sha256:81ff63371a7ebd6e6451970684f916be2eab07321b73c9d244dc2b4da7f73b88"},
+ {file = "nvidia_nvjitlink_cu12-12.8.93-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:adccd7161ace7261e01bb91e44e88da350895c270d23f744f0820c818b7229e7"},
+ {file = "nvidia_nvjitlink_cu12-12.8.93-py3-none-win_amd64.whl", hash = "sha256:bd93fbeeee850917903583587f4fc3a4eafa022e34572251368238ab5e6bd67f"},
+]
+
+[[package]]
+name = "nvidia-nvshmem-cu12"
+version = "3.3.20"
+description = "NVSHMEM creates a global address space that provides efficient and scalable communication for NVIDIA GPU clusters."
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_nvshmem_cu12-3.3.20-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0b0b960da3842212758e4fa4696b94f129090b30e5122fea3c5345916545cff0"},
+ {file = "nvidia_nvshmem_cu12-3.3.20-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d00f26d3f9b2e3c3065be895e3059d6479ea5c638a3f38c9fec49b1b9dd7c1e5"},
+]
+
+[[package]]
+name = "nvidia-nvtx-cu12"
+version = "12.6.77"
+description = "NVIDIA Tools Extension"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "nvidia_nvtx_cu12-12.6.77-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:f44f8d86bb7d5629988d61c8d3ae61dddb2015dee142740536bc7481b022fe4b"},
+ {file = "nvidia_nvtx_cu12-12.6.77-py3-none-manylinux2014_aarch64.whl", hash = "sha256:adcaabb9d436c9761fca2b13959a2d237c5f9fd406c8e4b723c695409ff88059"},
+ {file = "nvidia_nvtx_cu12-12.6.77-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:b90bed3df379fa79afbd21be8e04a0314336b8ae16768b58f2d34cb1d04cd7d2"},
+ {file = "nvidia_nvtx_cu12-12.6.77-py3-none-manylinux2014_x86_64.whl", hash = "sha256:6574241a3ec5fdc9334353ab8c479fe75841dbe8f4532a8fc97ce63503330ba1"},
+ {file = "nvidia_nvtx_cu12-12.6.77-py3-none-win_amd64.whl", hash = "sha256:2fb11a4af04a5e6c84073e6404d26588a34afd35379f0855a99797897efa75c0"},
+]
+
+[[package]]
+name = "nvidia-nvtx-cu12"
+version = "12.8.90"
+description = "NVIDIA Tools Extension"
+optional = false
+python-versions = ">=3"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "nvidia_nvtx_cu12-12.8.90-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d7ad891da111ebafbf7e015d34879f7112832fc239ff0d7d776b6cb685274615"},
+ {file = "nvidia_nvtx_cu12-12.8.90-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:5b17e2001cc0d751a5bc2c6ec6d26ad95913324a4adb86788c944f8ce9ba441f"},
+ {file = "nvidia_nvtx_cu12-12.8.90-py3-none-win_amd64.whl", hash = "sha256:619c8304aedc69f02ea82dd244541a83c3d9d40993381b3b590f1adaed3db41e"},
+]
+
[[package]]
name = "openai"
version = "2.5.0"
@@ -2048,6 +2813,115 @@ sql-other = ["SQLAlchemy (>=2.0.0)", "adbc-driver-postgresql (>=0.8.0)", "adbc-d
test = ["hypothesis (>=6.46.1)", "pytest (>=7.3.2)", "pytest-xdist (>=2.2.0)"]
xml = ["lxml (>=4.9.2)"]
+[[package]]
+name = "pillow"
+version = "12.0.0"
+description = "Python Imaging Library (fork)"
+optional = false
+python-versions = ">=3.10"
+groups = ["main"]
+files = [
+ {file = "pillow-12.0.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:3adfb466bbc544b926d50fe8f4a4e6abd8c6bffd28a26177594e6e9b2b76572b"},
+ {file = "pillow-12.0.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1ac11e8ea4f611c3c0147424eae514028b5e9077dd99ab91e1bd7bc33ff145e1"},
+ {file = "pillow-12.0.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d49e2314c373f4c2b39446fb1a45ed333c850e09d0c59ac79b72eb3b95397363"},
+ {file = "pillow-12.0.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c7b2a63fd6d5246349f3d3f37b14430d73ee7e8173154461785e43036ffa96ca"},
+ {file = "pillow-12.0.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d64317d2587c70324b79861babb9c09f71fbb780bad212018874b2c013d8600e"},
+ {file = "pillow-12.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d77153e14b709fd8b8af6f66a3afbb9ed6e9fc5ccf0b6b7e1ced7b036a228782"},
+ {file = "pillow-12.0.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:32ed80ea8a90ee3e6fa08c21e2e091bba6eda8eccc83dbc34c95169507a91f10"},
+ {file = "pillow-12.0.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c828a1ae702fc712978bda0320ba1b9893d99be0badf2647f693cc01cf0f04fa"},
+ {file = "pillow-12.0.0-cp310-cp310-win32.whl", hash = "sha256:bd87e140e45399c818fac4247880b9ce719e4783d767e030a883a970be632275"},
+ {file = "pillow-12.0.0-cp310-cp310-win_amd64.whl", hash = "sha256:455247ac8a4cfb7b9bc45b7e432d10421aea9fc2e74d285ba4072688a74c2e9d"},
+ {file = "pillow-12.0.0-cp310-cp310-win_arm64.whl", hash = "sha256:6ace95230bfb7cd79ef66caa064bbe2f2a1e63d93471c3a2e1f1348d9f22d6b7"},
+ {file = "pillow-12.0.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:0fd00cac9c03256c8b2ff58f162ebcd2587ad3e1f2e397eab718c47e24d231cc"},
+ {file = "pillow-12.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a3475b96f5908b3b16c47533daaa87380c491357d197564e0ba34ae75c0f3257"},
+ {file = "pillow-12.0.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:110486b79f2d112cf6add83b28b627e369219388f64ef2f960fef9ebaf54c642"},
+ {file = "pillow-12.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:5269cc1caeedb67e6f7269a42014f381f45e2e7cd42d834ede3c703a1d915fe3"},
+ {file = "pillow-12.0.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:aa5129de4e174daccbc59d0a3b6d20eaf24417d59851c07ebb37aeb02947987c"},
+ {file = "pillow-12.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bee2a6db3a7242ea309aa7ee8e2780726fed67ff4e5b40169f2c940e7eb09227"},
+ {file = "pillow-12.0.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:90387104ee8400a7b4598253b4c406f8958f59fcf983a6cea2b50d59f7d63d0b"},
+ {file = "pillow-12.0.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:bc91a56697869546d1b8f0a3ff35224557ae7f881050e99f615e0119bf934b4e"},
+ {file = "pillow-12.0.0-cp311-cp311-win32.whl", hash = "sha256:27f95b12453d165099c84f8a8bfdfd46b9e4bda9e0e4b65f0635430027f55739"},
+ {file = "pillow-12.0.0-cp311-cp311-win_amd64.whl", hash = "sha256:b583dc9070312190192631373c6c8ed277254aa6e6084b74bdd0a6d3b221608e"},
+ {file = "pillow-12.0.0-cp311-cp311-win_arm64.whl", hash = "sha256:759de84a33be3b178a64c8ba28ad5c135900359e85fb662bc6e403ad4407791d"},
+ {file = "pillow-12.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:53561a4ddc36facb432fae7a9d8afbfaf94795414f5cdc5fc52f28c1dca90371"},
+ {file = "pillow-12.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:71db6b4c1653045dacc1585c1b0d184004f0d7e694c7b34ac165ca70c0838082"},
+ {file = "pillow-12.0.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:2fa5f0b6716fc88f11380b88b31fe591a06c6315e955c096c35715788b339e3f"},
+ {file = "pillow-12.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:82240051c6ca513c616f7f9da06e871f61bfd7805f566275841af15015b8f98d"},
+ {file = "pillow-12.0.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:55f818bd74fe2f11d4d7cbc65880a843c4075e0ac7226bc1a23261dbea531953"},
+ {file = "pillow-12.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b87843e225e74576437fd5b6a4c2205d422754f84a06942cfaf1dc32243e45a8"},
+ {file = "pillow-12.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:c607c90ba67533e1b2355b821fef6764d1dd2cbe26b8c1005ae84f7aea25ff79"},
+ {file = "pillow-12.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:21f241bdd5080a15bc86d3466a9f6074a9c2c2b314100dd896ac81ee6db2f1ba"},
+ {file = "pillow-12.0.0-cp312-cp312-win32.whl", hash = "sha256:dd333073e0cacdc3089525c7df7d39b211bcdf31fc2824e49d01c6b6187b07d0"},
+ {file = "pillow-12.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:9fe611163f6303d1619bbcb653540a4d60f9e55e622d60a3108be0d5b441017a"},
+ {file = "pillow-12.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:7dfb439562f234f7d57b1ac6bc8fe7f838a4bd49c79230e0f6a1da93e82f1fad"},
+ {file = "pillow-12.0.0-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:0869154a2d0546545cde61d1789a6524319fc1897d9ee31218eae7a60ccc5643"},
+ {file = "pillow-12.0.0-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:a7921c5a6d31b3d756ec980f2f47c0cfdbce0fc48c22a39347a895f41f4a6ea4"},
+ {file = "pillow-12.0.0-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:1ee80a59f6ce048ae13cda1abf7fbd2a34ab9ee7d401c46be3ca685d1999a399"},
+ {file = "pillow-12.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:c50f36a62a22d350c96e49ad02d0da41dbd17ddc2e29750dbdba4323f85eb4a5"},
+ {file = "pillow-12.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5193fde9a5f23c331ea26d0cf171fbf67e3f247585f50c08b3e205c7aeb4589b"},
+ {file = "pillow-12.0.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:bde737cff1a975b70652b62d626f7785e0480918dece11e8fef3c0cf057351c3"},
+ {file = "pillow-12.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:a6597ff2b61d121172f5844b53f21467f7082f5fb385a9a29c01414463f93b07"},
+ {file = "pillow-12.0.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0b817e7035ea7f6b942c13aa03bb554fc44fea70838ea21f8eb31c638326584e"},
+ {file = "pillow-12.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f4f1231b7dec408e8670264ce63e9c71409d9583dd21d32c163e25213ee2a344"},
+ {file = "pillow-12.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:6e51b71417049ad6ab14c49608b4a24d8fb3fe605e5dfabfe523b58064dc3d27"},
+ {file = "pillow-12.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:d120c38a42c234dc9a8c5de7ceaaf899cf33561956acb4941653f8bdc657aa79"},
+ {file = "pillow-12.0.0-cp313-cp313-win32.whl", hash = "sha256:4cc6b3b2efff105c6a1656cfe59da4fdde2cda9af1c5e0b58529b24525d0a098"},
+ {file = "pillow-12.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:4cf7fed4b4580601c4345ceb5d4cbf5a980d030fd5ad07c4d2ec589f95f09905"},
+ {file = "pillow-12.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:9f0b04c6b8584c2c193babcccc908b38ed29524b29dd464bc8801bf10d746a3a"},
+ {file = "pillow-12.0.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:7fa22993bac7b77b78cae22bad1e2a987ddf0d9015c63358032f84a53f23cdc3"},
+ {file = "pillow-12.0.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:f135c702ac42262573fe9714dfe99c944b4ba307af5eb507abef1667e2cbbced"},
+ {file = "pillow-12.0.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:c85de1136429c524e55cfa4e033b4a7940ac5c8ee4d9401cc2d1bf48154bbc7b"},
+ {file = "pillow-12.0.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:38df9b4bfd3db902c9c2bd369bcacaf9d935b2fff73709429d95cc41554f7b3d"},
+ {file = "pillow-12.0.0-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7d87ef5795da03d742bf49439f9ca4d027cde49c82c5371ba52464aee266699a"},
+ {file = "pillow-12.0.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:aff9e4d82d082ff9513bdd6acd4f5bd359f5b2c870907d2b0a9c5e10d40c88fe"},
+ {file = "pillow-12.0.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:8d8ca2b210ada074d57fcee40c30446c9562e542fc46aedc19baf758a93532ee"},
+ {file = "pillow-12.0.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:99a7f72fb6249302aa62245680754862a44179b545ded638cf1fef59befb57ef"},
+ {file = "pillow-12.0.0-cp313-cp313t-win32.whl", hash = "sha256:4078242472387600b2ce8d93ade8899c12bf33fa89e55ec89fe126e9d6d5d9e9"},
+ {file = "pillow-12.0.0-cp313-cp313t-win_amd64.whl", hash = "sha256:2c54c1a783d6d60595d3514f0efe9b37c8808746a66920315bfd34a938d7994b"},
+ {file = "pillow-12.0.0-cp313-cp313t-win_arm64.whl", hash = "sha256:26d9f7d2b604cd23aba3e9faf795787456ac25634d82cd060556998e39c6fa47"},
+ {file = "pillow-12.0.0-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:beeae3f27f62308f1ddbcfb0690bf44b10732f2ef43758f169d5e9303165d3f9"},
+ {file = "pillow-12.0.0-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:d4827615da15cd59784ce39d3388275ec093ae3ee8d7f0c089b76fa87af756c2"},
+ {file = "pillow-12.0.0-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:3e42edad50b6909089750e65c91aa09aaf1e0a71310d383f11321b27c224ed8a"},
+ {file = "pillow-12.0.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:e5d8efac84c9afcb40914ab49ba063d94f5dbdf5066db4482c66a992f47a3a3b"},
+ {file = "pillow-12.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:266cd5f2b63ff316d5a1bba46268e603c9caf5606d44f38c2873c380950576ad"},
+ {file = "pillow-12.0.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:58eea5ebe51504057dd95c5b77d21700b77615ab0243d8152793dc00eb4faf01"},
+ {file = "pillow-12.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f13711b1a5ba512d647a0e4ba79280d3a9a045aaf7e0cc6fbe96b91d4cdf6b0c"},
+ {file = "pillow-12.0.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6846bd2d116ff42cba6b646edf5bf61d37e5cbd256425fa089fee4ff5c07a99e"},
+ {file = "pillow-12.0.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c98fa880d695de164b4135a52fd2e9cd7b7c90a9d8ac5e9e443a24a95ef9248e"},
+ {file = "pillow-12.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:fa3ed2a29a9e9d2d488b4da81dcb54720ac3104a20bf0bd273f1e4648aff5af9"},
+ {file = "pillow-12.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:d034140032870024e6b9892c692fe2968493790dd57208b2c37e3fb35f6df3ab"},
+ {file = "pillow-12.0.0-cp314-cp314-win32.whl", hash = "sha256:1b1b133e6e16105f524a8dec491e0586d072948ce15c9b914e41cdadd209052b"},
+ {file = "pillow-12.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:8dc232e39d409036af549c86f24aed8273a40ffa459981146829a324e0848b4b"},
+ {file = "pillow-12.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:d52610d51e265a51518692045e372a4c363056130d922a7351429ac9f27e70b0"},
+ {file = "pillow-12.0.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:1979f4566bb96c1e50a62d9831e2ea2d1211761e5662afc545fa766f996632f6"},
+ {file = "pillow-12.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b2e4b27a6e15b04832fe9bf292b94b5ca156016bbc1ea9c2c20098a0320d6cf6"},
+ {file = "pillow-12.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:fb3096c30df99fd01c7bf8e544f392103d0795b9f98ba71a8054bcbf56b255f1"},
+ {file = "pillow-12.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7438839e9e053ef79f7112c881cef684013855016f928b168b81ed5835f3e75e"},
+ {file = "pillow-12.0.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5d5c411a8eaa2299322b647cd932586b1427367fd3184ffbb8f7a219ea2041ca"},
+ {file = "pillow-12.0.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d7e091d464ac59d2c7ad8e7e08105eaf9dafbc3883fd7265ffccc2baad6ac925"},
+ {file = "pillow-12.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:792a2c0be4dcc18af9d4a2dfd8a11a17d5e25274a1062b0ec1c2d79c76f3e7f8"},
+ {file = "pillow-12.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:afbefa430092f71a9593a99ab6a4e7538bc9eabbf7bf94f91510d3503943edc4"},
+ {file = "pillow-12.0.0-cp314-cp314t-win32.whl", hash = "sha256:3830c769decf88f1289680a59d4f4c46c72573446352e2befec9a8512104fa52"},
+ {file = "pillow-12.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:905b0365b210c73afb0ebe9101a32572152dfd1c144c7e28968a331b9217b94a"},
+ {file = "pillow-12.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:99353a06902c2e43b43e8ff74ee65a7d90307d82370604746738a1e0661ccca7"},
+ {file = "pillow-12.0.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:b22bd8c974942477156be55a768f7aa37c46904c175be4e158b6a86e3a6b7ca8"},
+ {file = "pillow-12.0.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:805ebf596939e48dbb2e4922a1d3852cfc25c38160751ce02da93058b48d252a"},
+ {file = "pillow-12.0.0-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cae81479f77420d217def5f54b5b9d279804d17e982e0f2fa19b1d1e14ab5197"},
+ {file = "pillow-12.0.0-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:aeaefa96c768fc66818730b952a862235d68825c178f1b3ffd4efd7ad2edcb7c"},
+ {file = "pillow-12.0.0-pp311-pypy311_pp73-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:09f2d0abef9e4e2f349305a4f8cc784a8a6c2f58a8c4892eea13b10a943bd26e"},
+ {file = "pillow-12.0.0-pp311-pypy311_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bdee52571a343d721fb2eb3b090a82d959ff37fc631e3f70422e0c2e029f3e76"},
+ {file = "pillow-12.0.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:b290fd8aa38422444d4b50d579de197557f182ef1068b75f5aa8558638b8d0a5"},
+ {file = "pillow-12.0.0.tar.gz", hash = "sha256:87d4f8125c9988bfbed67af47dd7a953e2fc7b0cc1e7800ec6d2080d490bb353"},
+]
+
+[package.extras]
+docs = ["furo", "olefile", "sphinx (>=8.2)", "sphinx-autobuild", "sphinx-copybutton", "sphinx-inline-tabs", "sphinxext-opengraph"]
+fpx = ["olefile"]
+mic = ["olefile"]
+test-arrow = ["arro3-compute", "arro3-core", "nanoarrow", "pyarrow"]
+tests = ["check-manifest", "coverage (>=7.4.2)", "defusedxml", "markdown2", "olefile", "packaging", "pyroma (>=5)", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", "trove-classifiers (>=2024.10.12)"]
+xmp = ["defusedxml"]
+
[[package]]
name = "platformdirs"
version = "4.5.0"
@@ -2546,6 +3420,18 @@ files = [
[package.extras]
cli = ["click (>=5.0)"]
+[[package]]
+name = "python-multipart"
+version = "0.0.20"
+description = "A streaming multipart parser for Python"
+optional = false
+python-versions = ">=3.8"
+groups = ["main"]
+files = [
+ {file = "python_multipart-0.0.20-py3-none-any.whl", hash = "sha256:8a62d3a8335e06589fe01f2a3e178cdcc632f3fbe0d492ad9ee0ec35aab1f104"},
+ {file = "python_multipart-0.0.20.tar.gz", hash = "sha256:8dd0cab45b8e23064ae09147625994d090fa46f5b0d1e13af944c331a7fa9d13"},
+]
+
[[package]]
name = "pytz"
version = "2025.2"
@@ -2943,6 +3829,219 @@ files = [
[package.dependencies]
pyasn1 = ">=0.1.3"
+[[package]]
+name = "safetensors"
+version = "0.7.0"
+description = ""
+optional = false
+python-versions = ">=3.9"
+groups = ["main"]
+files = [
+ {file = "safetensors-0.7.0-cp38-abi3-macosx_10_12_x86_64.whl", hash = "sha256:c82f4d474cf725255d9e6acf17252991c3c8aac038d6ef363a4bf8be2f6db517"},
+ {file = "safetensors-0.7.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:94fd4858284736bb67a897a41608b5b0c2496c9bdb3bf2af1fa3409127f20d57"},
+ {file = "safetensors-0.7.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e07d91d0c92a31200f25351f4acb2bc6aff7f48094e13ebb1d0fb995b54b6542"},
+ {file = "safetensors-0.7.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8469155f4cb518bafb4acf4865e8bb9d6804110d2d9bdcaa78564b9fd841e104"},
+ {file = "safetensors-0.7.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:54bef08bf00a2bff599982f6b08e8770e09cc012d7bba00783fc7ea38f1fb37d"},
+ {file = "safetensors-0.7.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:42cb091236206bb2016d245c377ed383aa7f78691748f3bb6ee1bfa51ae2ce6a"},
+ {file = "safetensors-0.7.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dac7252938f0696ddea46f5e855dd3138444e82236e3be475f54929f0c510d48"},
+ {file = "safetensors-0.7.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1d060c70284127fa805085d8f10fbd0962792aed71879d00864acda69dbab981"},
+ {file = "safetensors-0.7.0-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:cdab83a366799fa730f90a4ebb563e494f28e9e92c4819e556152ad55e43591b"},
+ {file = "safetensors-0.7.0-cp38-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:672132907fcad9f2aedcb705b2d7b3b93354a2aec1b2f706c4db852abe338f85"},
+ {file = "safetensors-0.7.0-cp38-abi3-musllinux_1_2_i686.whl", hash = "sha256:5d72abdb8a4d56d4020713724ba81dac065fedb7f3667151c4a637f1d3fb26c0"},
+ {file = "safetensors-0.7.0-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:b0f6d66c1c538d5a94a73aa9ddca8ccc4227e6c9ff555322ea40bdd142391dd4"},
+ {file = "safetensors-0.7.0-cp38-abi3-win32.whl", hash = "sha256:c74af94bf3ac15ac4d0f2a7c7b4663a15f8c2ab15ed0fc7531ca61d0835eccba"},
+ {file = "safetensors-0.7.0-cp38-abi3-win_amd64.whl", hash = "sha256:d1239932053f56f3456f32eb9625590cc7582e905021f94636202a864d470755"},
+ {file = "safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f4729811a6640d019a4b7ba8638ee2fd21fa5ca8c7e7bdf0fed62068fcaac737"},
+ {file = "safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:12f49080303fa6bb424b362149a12949dfbbf1e06811a88f2307276b0c131afd"},
+ {file = "safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0071bffba4150c2f46cae1432d31995d77acfd9f8db598b5d1a2ce67e8440ad2"},
+ {file = "safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:473b32699f4200e69801bf5abf93f1a4ecd432a70984df164fc22ccf39c4a6f3"},
+ {file = "safetensors-0.7.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7b95a3fa7b3abb9b5b0e07668e808364d0d40f6bbbf9ae0faa8b5b210c97b140"},
+ {file = "safetensors-0.7.0-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cfdead2f57330d76aa7234051dadfa7d4eedc0e5a27fd08e6f96714a92b00f09"},
+ {file = "safetensors-0.7.0-pp39-pypy39_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dc92bc2db7b45bda4510e4f51c59b00fe80b2d6be88928346e4294ce1c2abe7c"},
+ {file = "safetensors-0.7.0-pp39-pypy39_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6999421eb8ba9df4450a16d9184fcb7bef26240b9f98e95401f17af6c2210b71"},
+ {file = "safetensors-0.7.0.tar.gz", hash = "sha256:07663963b67e8bd9f0b8ad15bb9163606cd27cc5a1b96235a50d8369803b96b0"},
+]
+
+[package.extras]
+all = ["safetensors[jax]", "safetensors[numpy]", "safetensors[paddlepaddle]", "safetensors[pinned-tf]", "safetensors[quality]", "safetensors[testing]", "safetensors[torch]"]
+dev = ["safetensors[all]"]
+jax = ["flax (>=0.6.3)", "jax (>=0.3.25)", "jaxlib (>=0.3.25)", "safetensors[numpy]"]
+mlx = ["mlx (>=0.0.9)"]
+numpy = ["numpy (>=1.21.6)"]
+paddlepaddle = ["paddlepaddle (>=2.4.1)", "safetensors[numpy]"]
+pinned-tf = ["safetensors[numpy]", "tensorflow (==2.18.0)"]
+quality = ["ruff"]
+tensorflow = ["safetensors[numpy]", "tensorflow (>=2.11.0)"]
+testing = ["h5py (>=3.7.0)", "huggingface-hub (>=0.12.1)", "hypothesis (>=6.70.2)", "pytest (>=7.2.0)", "pytest-benchmark (>=4.0.0)", "safetensors[numpy]", "setuptools-rust (>=1.5.2)"]
+testingfree = ["huggingface-hub (>=0.12.1)", "hypothesis (>=6.70.2)", "pytest (>=7.2.0)", "pytest-benchmark (>=4.0.0)", "safetensors[numpy]", "setuptools-rust (>=1.5.2)"]
+torch = ["packaging", "safetensors[numpy]", "torch (>=1.10)"]
+
+[[package]]
+name = "scikit-learn"
+version = "1.8.0"
+description = "A set of python modules for machine learning and data mining"
+optional = false
+python-versions = ">=3.11"
+groups = ["main"]
+files = [
+ {file = "scikit_learn-1.8.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:146b4d36f800c013d267b29168813f7a03a43ecd2895d04861f1240b564421da"},
+ {file = "scikit_learn-1.8.0-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:f984ca4b14914e6b4094c5d52a32ea16b49832c03bd17a110f004db3c223e8e1"},
+ {file = "scikit_learn-1.8.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5e30adb87f0cc81c7690a84f7932dd66be5bac57cfe16b91cb9151683a4a2d3b"},
+ {file = "scikit_learn-1.8.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ada8121bcb4dac28d930febc791a69f7cb1673c8495e5eee274190b73a4559c1"},
+ {file = "scikit_learn-1.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:c57b1b610bd1f40ba43970e11ce62821c2e6569e4d74023db19c6b26f246cb3b"},
+ {file = "scikit_learn-1.8.0-cp311-cp311-win_arm64.whl", hash = "sha256:2838551e011a64e3053ad7618dda9310175f7515f1742fa2d756f7c874c05961"},
+ {file = "scikit_learn-1.8.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5fb63362b5a7ddab88e52b6dbb47dac3fd7dafeee740dc6c8d8a446ddedade8e"},
+ {file = "scikit_learn-1.8.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:5025ce924beccb28298246e589c691fe1b8c1c96507e6d27d12c5fadd85bfd76"},
+ {file = "scikit_learn-1.8.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4496bb2cf7a43ce1a2d7524a79e40bc5da45cf598dbf9545b7e8316ccba47bb4"},
+ {file = "scikit_learn-1.8.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0bcfe4d0d14aec44921545fd2af2338c7471de9cb701f1da4c9d85906ab847a"},
+ {file = "scikit_learn-1.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:35c007dedb2ffe38fe3ee7d201ebac4a2deccd2408e8621d53067733e3c74809"},
+ {file = "scikit_learn-1.8.0-cp312-cp312-win_arm64.whl", hash = "sha256:8c497fff237d7b4e07e9ef1a640887fa4fb765647f86fbe00f969ff6280ce2bb"},
+ {file = "scikit_learn-1.8.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:0d6ae97234d5d7079dc0040990a6f7aeb97cb7fa7e8945f1999a429b23569e0a"},
+ {file = "scikit_learn-1.8.0-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:edec98c5e7c128328124a029bceb09eda2d526997780fef8d65e9a69eead963e"},
+ {file = "scikit_learn-1.8.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:74b66d8689d52ed04c271e1329f0c61635bcaf5b926db9b12d58914cdc01fe57"},
+ {file = "scikit_learn-1.8.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8fdf95767f989b0cfedb85f7ed8ca215d4be728031f56ff5a519ee1e3276dc2e"},
+ {file = "scikit_learn-1.8.0-cp313-cp313-win_amd64.whl", hash = "sha256:2de443b9373b3b615aec1bb57f9baa6bb3a9bd093f1269ba95c17d870422b271"},
+ {file = "scikit_learn-1.8.0-cp313-cp313-win_arm64.whl", hash = "sha256:eddde82a035681427cbedded4e6eff5e57fa59216c2e3e90b10b19ab1d0a65c3"},
+ {file = "scikit_learn-1.8.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:7cc267b6108f0a1499a734167282c00c4ebf61328566b55ef262d48e9849c735"},
+ {file = "scikit_learn-1.8.0-cp313-cp313t-macosx_12_0_arm64.whl", hash = "sha256:fe1c011a640a9f0791146011dfd3c7d9669785f9fed2b2a5f9e207536cf5c2fd"},
+ {file = "scikit_learn-1.8.0-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:72358cce49465d140cc4e7792015bb1f0296a9742d5622c67e31399b75468b9e"},
+ {file = "scikit_learn-1.8.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:80832434a6cc114f5219211eec13dcbc16c2bac0e31ef64c6d346cde3cf054cb"},
+ {file = "scikit_learn-1.8.0-cp313-cp313t-win_amd64.whl", hash = "sha256:ee787491dbfe082d9c3013f01f5991658b0f38aa8177e4cd4bf434c58f551702"},
+ {file = "scikit_learn-1.8.0-cp313-cp313t-win_arm64.whl", hash = "sha256:bf97c10a3f5a7543f9b88cbf488d33d175e9146115a451ae34568597ba33dcde"},
+ {file = "scikit_learn-1.8.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:c22a2da7a198c28dd1a6e1136f19c830beab7fdca5b3e5c8bba8394f8a5c45b3"},
+ {file = "scikit_learn-1.8.0-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:6b595b07a03069a2b1740dc08c2299993850ea81cce4fe19b2421e0c970de6b7"},
+ {file = "scikit_learn-1.8.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:29ffc74089f3d5e87dfca4c2c8450f88bdc61b0fc6ed5d267f3988f19a1309f6"},
+ {file = "scikit_learn-1.8.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fb65db5d7531bccf3a4f6bec3462223bea71384e2cda41da0f10b7c292b9e7c4"},
+ {file = "scikit_learn-1.8.0-cp314-cp314-win_amd64.whl", hash = "sha256:56079a99c20d230e873ea40753102102734c5953366972a71d5cb39a32bc40c6"},
+ {file = "scikit_learn-1.8.0-cp314-cp314-win_arm64.whl", hash = "sha256:3bad7565bc9cf37ce19a7c0d107742b320c1285df7aab1a6e2d28780df167242"},
+ {file = "scikit_learn-1.8.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:4511be56637e46c25721e83d1a9cea9614e7badc7040c4d573d75fbe257d6fd7"},
+ {file = "scikit_learn-1.8.0-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:a69525355a641bf8ef136a7fa447672fb54fe8d60cab5538d9eb7c6438543fb9"},
+ {file = "scikit_learn-1.8.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c2656924ec73e5939c76ac4c8b026fc203b83d8900362eb2599d8aee80e4880f"},
+ {file = "scikit_learn-1.8.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:15fc3b5d19cc2be65404786857f2e13c70c83dd4782676dd6814e3b89dc8f5b9"},
+ {file = "scikit_learn-1.8.0-cp314-cp314t-win_amd64.whl", hash = "sha256:00d6f1d66fbcf4eba6e356e1420d33cc06c70a45bb1363cd6f6a8e4ebbbdece2"},
+ {file = "scikit_learn-1.8.0-cp314-cp314t-win_arm64.whl", hash = "sha256:f28dd15c6bb0b66ba09728cf09fd8736c304be29409bd8445a080c1280619e8c"},
+ {file = "scikit_learn-1.8.0.tar.gz", hash = "sha256:9bccbb3b40e3de10351f8f5068e105d0f4083b1a65fa07b6634fbc401a6287fd"},
+]
+
+[package.dependencies]
+joblib = ">=1.3.0"
+numpy = ">=1.24.1"
+scipy = ">=1.10.0"
+threadpoolctl = ">=3.2.0"
+
+[package.extras]
+benchmark = ["matplotlib (>=3.6.1)", "memory_profiler (>=0.57.0)", "pandas (>=1.5.0)"]
+build = ["cython (>=3.1.2)", "meson-python (>=0.17.1)", "numpy (>=1.24.1)", "scipy (>=1.10.0)"]
+docs = ["Pillow (>=10.1.0)", "matplotlib (>=3.6.1)", "memory_profiler (>=0.57.0)", "numpydoc (>=1.2.0)", "pandas (>=1.5.0)", "plotly (>=5.18.0)", "polars (>=0.20.30)", "pooch (>=1.8.0)", "pydata-sphinx-theme (>=0.15.3)", "scikit-image (>=0.22.0)", "seaborn (>=0.13.0)", "sphinx (>=7.3.7)", "sphinx-copybutton (>=0.5.2)", "sphinx-design (>=0.6.0)", "sphinx-gallery (>=0.17.1)", "sphinx-prompt (>=1.4.0)", "sphinx-remove-toctrees (>=1.0.0.post1)", "sphinxcontrib-sass (>=0.3.4)", "sphinxext-opengraph (>=0.9.1)", "towncrier (>=24.8.0)"]
+examples = ["matplotlib (>=3.6.1)", "pandas (>=1.5.0)", "plotly (>=5.18.0)", "pooch (>=1.8.0)", "scikit-image (>=0.22.0)", "seaborn (>=0.13.0)"]
+install = ["joblib (>=1.3.0)", "numpy (>=1.24.1)", "scipy (>=1.10.0)", "threadpoolctl (>=3.2.0)"]
+maintenance = ["conda-lock (==3.0.1)"]
+tests = ["matplotlib (>=3.6.1)", "mypy (>=1.15)", "numpydoc (>=1.2.0)", "pandas (>=1.5.0)", "polars (>=0.20.30)", "pooch (>=1.8.0)", "pyamg (>=5.0.0)", "pyarrow (>=12.0.0)", "pytest (>=7.1.2)", "pytest-cov (>=2.9.0)", "ruff (>=0.11.7)"]
+
+[[package]]
+name = "scipy"
+version = "1.16.3"
+description = "Fundamental algorithms for scientific computing in Python"
+optional = false
+python-versions = ">=3.11"
+groups = ["main"]
+files = [
+ {file = "scipy-1.16.3-cp311-cp311-macosx_10_14_x86_64.whl", hash = "sha256:40be6cf99e68b6c4321e9f8782e7d5ff8265af28ef2cd56e9c9b2638fa08ad97"},
+ {file = "scipy-1.16.3-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:8be1ca9170fcb6223cc7c27f4305d680ded114a1567c0bd2bfcbf947d1b17511"},
+ {file = "scipy-1.16.3-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:bea0a62734d20d67608660f69dcda23e7f90fb4ca20974ab80b6ed40df87a005"},
+ {file = "scipy-1.16.3-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:2a207a6ce9c24f1951241f4693ede2d393f59c07abc159b2cb2be980820e01fb"},
+ {file = "scipy-1.16.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:532fb5ad6a87e9e9cd9c959b106b73145a03f04c7d57ea3e6f6bb60b86ab0876"},
+ {file = "scipy-1.16.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:0151a0749efeaaab78711c78422d413c583b8cdd2011a3c1d6c794938ee9fdb2"},
+ {file = "scipy-1.16.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:b7180967113560cca57418a7bc719e30366b47959dd845a93206fbed693c867e"},
+ {file = "scipy-1.16.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:deb3841c925eeddb6afc1e4e4a45e418d19ec7b87c5df177695224078e8ec733"},
+ {file = "scipy-1.16.3-cp311-cp311-win_amd64.whl", hash = "sha256:53c3844d527213631e886621df5695d35e4f6a75f620dca412bcd292f6b87d78"},
+ {file = "scipy-1.16.3-cp311-cp311-win_arm64.whl", hash = "sha256:9452781bd879b14b6f055b26643703551320aa8d79ae064a71df55c00286a184"},
+ {file = "scipy-1.16.3-cp312-cp312-macosx_10_14_x86_64.whl", hash = "sha256:81fc5827606858cf71446a5e98715ba0e11f0dbc83d71c7409d05486592a45d6"},
+ {file = "scipy-1.16.3-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:c97176013d404c7346bf57874eaac5187d969293bf40497140b0a2b2b7482e07"},
+ {file = "scipy-1.16.3-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:2b71d93c8a9936046866acebc915e2af2e292b883ed6e2cbe5c34beb094b82d9"},
+ {file = "scipy-1.16.3-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:3d4a07a8e785d80289dfe66b7c27d8634a773020742ec7187b85ccc4b0e7b686"},
+ {file = "scipy-1.16.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0553371015692a898e1aa858fed67a3576c34edefa6b7ebdb4e9dde49ce5c203"},
+ {file = "scipy-1.16.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:72d1717fd3b5e6ec747327ce9bda32d5463f472c9dce9f54499e81fbd50245a1"},
+ {file = "scipy-1.16.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1fb2472e72e24d1530debe6ae078db70fb1605350c88a3d14bc401d6306dbffe"},
+ {file = "scipy-1.16.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c5192722cffe15f9329a3948c4b1db789fbb1f05c97899187dcf009b283aea70"},
+ {file = "scipy-1.16.3-cp312-cp312-win_amd64.whl", hash = "sha256:56edc65510d1331dae01ef9b658d428e33ed48b4f77b1d51caf479a0253f96dc"},
+ {file = "scipy-1.16.3-cp312-cp312-win_arm64.whl", hash = "sha256:a8a26c78ef223d3e30920ef759e25625a0ecdd0d60e5a8818b7513c3e5384cf2"},
+ {file = "scipy-1.16.3-cp313-cp313-macosx_10_14_x86_64.whl", hash = "sha256:d2ec56337675e61b312179a1ad124f5f570c00f920cc75e1000025451b88241c"},
+ {file = "scipy-1.16.3-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:16b8bc35a4cc24db80a0ec836a9286d0e31b2503cb2fd7ff7fb0e0374a97081d"},
+ {file = "scipy-1.16.3-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:5803c5fadd29de0cf27fa08ccbfe7a9e5d741bf63e4ab1085437266f12460ff9"},
+ {file = "scipy-1.16.3-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:b81c27fc41954319a943d43b20e07c40bdcd3ff7cf013f4fb86286faefe546c4"},
+ {file = "scipy-1.16.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0c3b4dd3d9b08dbce0f3440032c52e9e2ab9f96ade2d3943313dfe51a7056959"},
+ {file = "scipy-1.16.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7dc1360c06535ea6116a2220f760ae572db9f661aba2d88074fe30ec2aa1ff88"},
+ {file = "scipy-1.16.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:663b8d66a8748051c3ee9c96465fb417509315b99c71550fda2591d7dd634234"},
+ {file = "scipy-1.16.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:eab43fae33a0c39006a88096cd7b4f4ef545ea0447d250d5ac18202d40b6611d"},
+ {file = "scipy-1.16.3-cp313-cp313-win_amd64.whl", hash = "sha256:062246acacbe9f8210de8e751b16fc37458213f124bef161a5a02c7a39284304"},
+ {file = "scipy-1.16.3-cp313-cp313-win_arm64.whl", hash = "sha256:50a3dbf286dbc7d84f176f9a1574c705f277cb6565069f88f60db9eafdbe3ee2"},
+ {file = "scipy-1.16.3-cp313-cp313t-macosx_10_14_x86_64.whl", hash = "sha256:fb4b29f4cf8cc5a8d628bc8d8e26d12d7278cd1f219f22698a378c3d67db5e4b"},
+ {file = "scipy-1.16.3-cp313-cp313t-macosx_12_0_arm64.whl", hash = "sha256:8d09d72dc92742988b0e7750bddb8060b0c7079606c0d24a8cc8e9c9c11f9079"},
+ {file = "scipy-1.16.3-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:03192a35e661470197556de24e7cb1330d84b35b94ead65c46ad6f16f6b28f2a"},
+ {file = "scipy-1.16.3-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:57d01cb6f85e34f0946b33caa66e892aae072b64b034183f3d87c4025802a119"},
+ {file = "scipy-1.16.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:96491a6a54e995f00a28a3c3badfff58fd093bf26cd5fb34a2188c8c756a3a2c"},
+ {file = "scipy-1.16.3-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:cd13e354df9938598af2be05822c323e97132d5e6306b83a3b4ee6724c6e522e"},
+ {file = "scipy-1.16.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:63d3cdacb8a824a295191a723ee5e4ea7768ca5ca5f2838532d9f2e2b3ce2135"},
+ {file = "scipy-1.16.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:e7efa2681ea410b10dde31a52b18b0154d66f2485328830e45fdf183af5aefc6"},
+ {file = "scipy-1.16.3-cp313-cp313t-win_amd64.whl", hash = "sha256:2d1ae2cf0c350e7705168ff2429962a89ad90c2d49d1dd300686d8b2a5af22fc"},
+ {file = "scipy-1.16.3-cp313-cp313t-win_arm64.whl", hash = "sha256:0c623a54f7b79dd88ef56da19bc2873afec9673a48f3b85b18e4d402bdd29a5a"},
+ {file = "scipy-1.16.3-cp314-cp314-macosx_10_14_x86_64.whl", hash = "sha256:875555ce62743e1d54f06cdf22c1e0bc47b91130ac40fe5d783b6dfa114beeb6"},
+ {file = "scipy-1.16.3-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:bb61878c18a470021fb515a843dc7a76961a8daceaaaa8bad1332f1bf4b54657"},
+ {file = "scipy-1.16.3-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:f2622206f5559784fa5c4b53a950c3c7c1cf3e84ca1b9c4b6c03f062f289ca26"},
+ {file = "scipy-1.16.3-cp314-cp314-macosx_14_0_x86_64.whl", hash = "sha256:7f68154688c515cdb541a31ef8eb66d8cd1050605be9dcd74199cbd22ac739bc"},
+ {file = "scipy-1.16.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8b3c820ddb80029fe9f43d61b81d8b488d3ef8ca010d15122b152db77dc94c22"},
+ {file = "scipy-1.16.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d3837938ae715fc0fe3c39c0202de3a8853aff22ca66781ddc2ade7554b7e2cc"},
+ {file = "scipy-1.16.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:aadd23f98f9cb069b3bd64ddc900c4d277778242e961751f77a8cb5c4b946fb0"},
+ {file = "scipy-1.16.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b7c5f1bda1354d6a19bc6af73a649f8285ca63ac6b52e64e658a5a11d4d69800"},
+ {file = "scipy-1.16.3-cp314-cp314-win_amd64.whl", hash = "sha256:e5d42a9472e7579e473879a1990327830493a7047506d58d73fc429b84c1d49d"},
+ {file = "scipy-1.16.3-cp314-cp314-win_arm64.whl", hash = "sha256:6020470b9d00245926f2d5bb93b119ca0340f0d564eb6fbaad843eaebf9d690f"},
+ {file = "scipy-1.16.3-cp314-cp314t-macosx_10_14_x86_64.whl", hash = "sha256:e1d27cbcb4602680a49d787d90664fa4974063ac9d4134813332a8c53dbe667c"},
+ {file = "scipy-1.16.3-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:9b9c9c07b6d56a35777a1b4cc8966118fb16cfd8daf6743867d17d36cfad2d40"},
+ {file = "scipy-1.16.3-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:3a4c460301fb2cffb7f88528f30b3127742cff583603aa7dc964a52c463b385d"},
+ {file = "scipy-1.16.3-cp314-cp314t-macosx_14_0_x86_64.whl", hash = "sha256:f667a4542cc8917af1db06366d3f78a5c8e83badd56409f94d1eac8d8d9133fa"},
+ {file = "scipy-1.16.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:f379b54b77a597aa7ee5e697df0d66903e41b9c85a6dd7946159e356319158e8"},
+ {file = "scipy-1.16.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4aff59800a3b7f786b70bfd6ab551001cb553244988d7d6b8299cb1ea653b353"},
+ {file = "scipy-1.16.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:da7763f55885045036fabcebd80144b757d3db06ab0861415d1c3b7c69042146"},
+ {file = "scipy-1.16.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ffa6eea95283b2b8079b821dc11f50a17d0571c92b43e2b5b12764dc5f9b285d"},
+ {file = "scipy-1.16.3-cp314-cp314t-win_amd64.whl", hash = "sha256:d9f48cafc7ce94cf9b15c6bffdc443a81a27bf7075cf2dcd5c8b40f85d10c4e7"},
+ {file = "scipy-1.16.3-cp314-cp314t-win_arm64.whl", hash = "sha256:21d9d6b197227a12dcbf9633320a4e34c6b0e51c57268df255a0942983bac562"},
+ {file = "scipy-1.16.3.tar.gz", hash = "sha256:01e87659402762f43bd2fee13370553a17ada367d42e7487800bf2916535aecb"},
+]
+
+[package.dependencies]
+numpy = ">=1.25.2,<2.6"
+
+[package.extras]
+dev = ["cython-lint (>=0.12.2)", "doit (>=0.36.0)", "mypy (==1.10.0)", "pycodestyle", "pydevtool", "rich-click", "ruff (>=0.0.292)", "types-psutil", "typing_extensions"]
+doc = ["intersphinx_registry", "jupyterlite-pyodide-kernel", "jupyterlite-sphinx (>=0.19.1)", "jupytext", "linkify-it-py", "matplotlib (>=3.5)", "myst-nb (>=1.2.0)", "numpydoc", "pooch", "pydata-sphinx-theme (>=0.15.2)", "sphinx (>=5.0.0,<8.2.0)", "sphinx-copybutton", "sphinx-design (>=0.4.0)"]
+test = ["Cython", "array-api-strict (>=2.3.1)", "asv", "gmpy2", "hypothesis (>=6.30)", "meson", "mpmath", "ninja ; sys_platform != \"emscripten\"", "pooch", "pytest (>=8.0.0)", "pytest-cov", "pytest-timeout", "pytest-xdist", "scikit-umfpack", "threadpoolctl"]
+
+[[package]]
+name = "sentence-transformers"
+version = "2.7.0"
+description = "Multilingual text embeddings"
+optional = false
+python-versions = ">=3.8.0"
+groups = ["main"]
+files = [
+ {file = "sentence_transformers-2.7.0-py3-none-any.whl", hash = "sha256:6a7276b05a95931581bbfa4ba49d780b2cf6904fa4a171ec7fd66c343f761c98"},
+ {file = "sentence_transformers-2.7.0.tar.gz", hash = "sha256:2f7df99d1c021dded471ed2d079e9d1e4fc8e30ecb06f957be060511b36f24ea"},
+]
+
+[package.dependencies]
+huggingface-hub = ">=0.15.1"
+numpy = "*"
+Pillow = "*"
+scikit-learn = "*"
+scipy = "*"
+torch = ">=1.11.0"
+tqdm = "*"
+transformers = ">=4.34.0,<5.0.0"
+
+[package.extras]
+dev = ["pre-commit", "pytest", "ruff (>=0.3.0)"]
+
[[package]]
name = "setuptools"
version = "80.9.0"
@@ -3081,6 +4180,24 @@ typing-extensions = {version = ">=4.10.0", markers = "python_version < \"3.13\""
[package.extras]
full = ["httpx (>=0.27.0,<0.29.0)", "itsdangerous", "jinja2", "python-multipart (>=0.0.18)", "pyyaml"]
+[[package]]
+name = "sympy"
+version = "1.14.0"
+description = "Computer algebra system (CAS) in Python"
+optional = false
+python-versions = ">=3.9"
+groups = ["main"]
+files = [
+ {file = "sympy-1.14.0-py3-none-any.whl", hash = "sha256:e091cc3e99d2141a0ba2847328f5479b05d94a6635cb96148ccb3f34671bd8f5"},
+ {file = "sympy-1.14.0.tar.gz", hash = "sha256:d3d3fe8df1e5a0b42f0e7bdf50541697dbe7d23746e894990c030e2b05e72517"},
+]
+
+[package.dependencies]
+mpmath = ">=1.1.0,<1.4"
+
+[package.extras]
+dev = ["hypothesis (>=6.70.0)", "pytest (>=7.1.0)"]
+
[[package]]
name = "tenacity"
version = "9.1.2"
@@ -3097,6 +4214,18 @@ files = [
doc = ["reno", "sphinx"]
test = ["pytest", "tornado (>=4.5)", "typeguard"]
+[[package]]
+name = "threadpoolctl"
+version = "3.6.0"
+description = "threadpoolctl"
+optional = false
+python-versions = ">=3.9"
+groups = ["main"]
+files = [
+ {file = "threadpoolctl-3.6.0-py3-none-any.whl", hash = "sha256:43a0b8fd5a2928500110039e43a5eed8480b918967083ea48dc3ab9f13c4a7fb"},
+ {file = "threadpoolctl-3.6.0.tar.gz", hash = "sha256:8ab8b4aa3491d812b623328249fab5302a68d2d71745c8a4c719a2fcaba9f44e"},
+]
+
[[package]]
name = "tiktoken"
version = "0.12.0"
@@ -3171,6 +4300,39 @@ requests = ">=2.26.0"
[package.extras]
blobfile = ["blobfile (>=2)"]
+[[package]]
+name = "tokenizers"
+version = "0.22.1"
+description = ""
+optional = false
+python-versions = ">=3.9"
+groups = ["main"]
+files = [
+ {file = "tokenizers-0.22.1-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:59fdb013df17455e5f950b4b834a7b3ee2e0271e6378ccb33aa74d178b513c73"},
+ {file = "tokenizers-0.22.1-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:8d4e484f7b0827021ac5f9f71d4794aaef62b979ab7608593da22b1d2e3c4edc"},
+ {file = "tokenizers-0.22.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:19d2962dd28bc67c1f205ab180578a78eef89ac60ca7ef7cbe9635a46a56422a"},
+ {file = "tokenizers-0.22.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:38201f15cdb1f8a6843e6563e6e79f4abd053394992b9bbdf5213ea3469b4ae7"},
+ {file = "tokenizers-0.22.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d1cbe5454c9a15df1b3443c726063d930c16f047a3cc724b9e6e1a91140e5a21"},
+ {file = "tokenizers-0.22.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e7d094ae6312d69cc2a872b54b91b309f4f6fbce871ef28eb27b52a98e4d0214"},
+ {file = "tokenizers-0.22.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:afd7594a56656ace95cdd6df4cca2e4059d294c5cfb1679c57824b605556cb2f"},
+ {file = "tokenizers-0.22.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2ef6063d7a84994129732b47e7915e8710f27f99f3a3260b8a38fc7ccd083f4"},
+ {file = "tokenizers-0.22.1-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:ba0a64f450b9ef412c98f6bcd2a50c6df6e2443b560024a09fa6a03189726879"},
+ {file = "tokenizers-0.22.1-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:331d6d149fa9c7d632cde4490fb8bbb12337fa3a0232e77892be656464f4b446"},
+ {file = "tokenizers-0.22.1-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:607989f2ea68a46cb1dfbaf3e3aabdf3f21d8748312dbeb6263d1b3b66c5010a"},
+ {file = "tokenizers-0.22.1-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a0f307d490295717726598ef6fa4f24af9d484809223bbc253b201c740a06390"},
+ {file = "tokenizers-0.22.1-cp39-abi3-win32.whl", hash = "sha256:b5120eed1442765cd90b903bb6cfef781fd8fe64e34ccaecbae4c619b7b12a82"},
+ {file = "tokenizers-0.22.1-cp39-abi3-win_amd64.whl", hash = "sha256:65fd6e3fb11ca1e78a6a93602490f134d1fdeb13bcef99389d5102ea318ed138"},
+ {file = "tokenizers-0.22.1.tar.gz", hash = "sha256:61de6522785310a309b3407bac22d99c4db5dba349935e99e4d15ea2226af2d9"},
+]
+
+[package.dependencies]
+huggingface-hub = ">=0.16.4,<2.0"
+
+[package.extras]
+dev = ["tokenizers[testing]"]
+docs = ["setuptools-rust", "sphinx", "sphinx-rtd-theme"]
+testing = ["black (==22.3)", "datasets", "numpy", "pytest", "pytest-asyncio", "requests", "ruff"]
+
[[package]]
name = "tomlkit"
version = "0.13.3"
@@ -3183,6 +4345,138 @@ files = [
{file = "tomlkit-0.13.3.tar.gz", hash = "sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1"},
]
+[[package]]
+name = "torch"
+version = "2.7.1"
+description = "Tensors and Dynamic neural networks in Python with strong GPU acceleration"
+optional = false
+python-versions = ">=3.9.0"
+groups = ["main"]
+markers = "python_version >= \"3.14\""
+files = [
+ {file = "torch-2.7.1-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:a103b5d782af5bd119b81dbcc7ffc6fa09904c423ff8db397a1e6ea8fd71508f"},
+ {file = "torch-2.7.1-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:fe955951bdf32d182ee8ead6c3186ad54781492bf03d547d31771a01b3d6fb7d"},
+ {file = "torch-2.7.1-cp310-cp310-win_amd64.whl", hash = "sha256:885453d6fba67d9991132143bf7fa06b79b24352f4506fd4d10b309f53454162"},
+ {file = "torch-2.7.1-cp310-none-macosx_11_0_arm64.whl", hash = "sha256:d72acfdb86cee2a32c0ce0101606f3758f0d8bb5f8f31e7920dc2809e963aa7c"},
+ {file = "torch-2.7.1-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:236f501f2e383f1cb861337bdf057712182f910f10aeaf509065d54d339e49b2"},
+ {file = "torch-2.7.1-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:06eea61f859436622e78dd0cdd51dbc8f8c6d76917a9cf0555a333f9eac31ec1"},
+ {file = "torch-2.7.1-cp311-cp311-win_amd64.whl", hash = "sha256:8273145a2e0a3c6f9fd2ac36762d6ee89c26d430e612b95a99885df083b04e52"},
+ {file = "torch-2.7.1-cp311-none-macosx_11_0_arm64.whl", hash = "sha256:aea4fc1bf433d12843eb2c6b2204861f43d8364597697074c8d38ae2507f8730"},
+ {file = "torch-2.7.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:27ea1e518df4c9de73af7e8a720770f3628e7f667280bce2be7a16292697e3fa"},
+ {file = "torch-2.7.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:c33360cfc2edd976c2633b3b66c769bdcbbf0e0b6550606d188431c81e7dd1fc"},
+ {file = "torch-2.7.1-cp312-cp312-win_amd64.whl", hash = "sha256:d8bf6e1856ddd1807e79dc57e54d3335f2b62e6f316ed13ed3ecfe1fc1df3d8b"},
+ {file = "torch-2.7.1-cp312-none-macosx_11_0_arm64.whl", hash = "sha256:787687087412c4bd68d315e39bc1223f08aae1d16a9e9771d95eabbb04ae98fb"},
+ {file = "torch-2.7.1-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:03563603d931e70722dce0e11999d53aa80a375a3d78e6b39b9f6805ea0a8d28"},
+ {file = "torch-2.7.1-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:d632f5417b6980f61404a125b999ca6ebd0b8b4bbdbb5fbbba44374ab619a412"},
+ {file = "torch-2.7.1-cp313-cp313-win_amd64.whl", hash = "sha256:23660443e13995ee93e3d844786701ea4ca69f337027b05182f5ba053ce43b38"},
+ {file = "torch-2.7.1-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:0da4f4dba9f65d0d203794e619fe7ca3247a55ffdcbd17ae8fb83c8b2dc9b585"},
+ {file = "torch-2.7.1-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:e08d7e6f21a617fe38eeb46dd2213ded43f27c072e9165dc27300c9ef9570934"},
+ {file = "torch-2.7.1-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:30207f672328a42df4f2174b8f426f354b2baa0b7cca3a0adb3d6ab5daf00dc8"},
+ {file = "torch-2.7.1-cp313-cp313t-win_amd64.whl", hash = "sha256:79042feca1c634aaf6603fe6feea8c6b30dfa140a6bbc0b973e2260c7e79a22e"},
+ {file = "torch-2.7.1-cp313-none-macosx_11_0_arm64.whl", hash = "sha256:988b0cbc4333618a1056d2ebad9eb10089637b659eb645434d0809d8d937b946"},
+ {file = "torch-2.7.1-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:e0d81e9a12764b6f3879a866607c8ae93113cbcad57ce01ebde63eb48a576369"},
+ {file = "torch-2.7.1-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:8394833c44484547ed4a47162318337b88c97acdb3273d85ea06e03ffff44998"},
+ {file = "torch-2.7.1-cp39-cp39-win_amd64.whl", hash = "sha256:df41989d9300e6e3c19ec9f56f856187a6ef060c3662fe54f4b6baf1fc90bd19"},
+ {file = "torch-2.7.1-cp39-none-macosx_11_0_arm64.whl", hash = "sha256:a737b5edd1c44a5c1ece2e9f3d00df9d1b3fb9541138bee56d83d38293fb6c9d"},
+]
+
+[package.dependencies]
+filelock = "*"
+fsspec = "*"
+jinja2 = "*"
+networkx = "*"
+nvidia-cublas-cu12 = {version = "12.6.4.1", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cuda-cupti-cu12 = {version = "12.6.80", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cuda-nvrtc-cu12 = {version = "12.6.77", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cuda-runtime-cu12 = {version = "12.6.77", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cudnn-cu12 = {version = "9.5.1.17", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cufft-cu12 = {version = "11.3.0.4", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cufile-cu12 = {version = "1.11.1.6", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-curand-cu12 = {version = "10.3.7.77", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cusolver-cu12 = {version = "11.7.1.2", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cusparse-cu12 = {version = "12.5.4.2", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cusparselt-cu12 = {version = "0.6.3", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-nccl-cu12 = {version = "2.26.2", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-nvjitlink-cu12 = {version = "12.6.85", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-nvtx-cu12 = {version = "12.6.77", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+setuptools = {version = "*", markers = "python_version >= \"3.12\""}
+sympy = ">=1.13.3"
+triton = {version = "3.3.1", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+typing-extensions = ">=4.10.0"
+
+[package.extras]
+opt-einsum = ["opt-einsum (>=3.3)"]
+optree = ["optree (>=0.13.0)"]
+
+[[package]]
+name = "torch"
+version = "2.9.1"
+description = "Tensors and Dynamic neural networks in Python with strong GPU acceleration"
+optional = false
+python-versions = ">=3.10"
+groups = ["main"]
+markers = "python_version <= \"3.13\""
+files = [
+ {file = "torch-2.9.1-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:1cc208435f6c379f9b8fdfd5ceb5be1e3b72a6bdf1cb46c0d2812aa73472db9e"},
+ {file = "torch-2.9.1-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:9fd35c68b3679378c11f5eb73220fdcb4e6f4592295277fbb657d31fd053237c"},
+ {file = "torch-2.9.1-cp310-cp310-win_amd64.whl", hash = "sha256:2af70e3be4a13becba4655d6cc07dcfec7ae844db6ac38d6c1dafeb245d17d65"},
+ {file = "torch-2.9.1-cp310-none-macosx_11_0_arm64.whl", hash = "sha256:a83b0e84cc375e3318a808d032510dde99d696a85fe9473fc8575612b63ae951"},
+ {file = "torch-2.9.1-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:62b3fd888277946918cba4478cf849303da5359f0fb4e3bfb86b0533ba2eaf8d"},
+ {file = "torch-2.9.1-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:d033ff0ac3f5400df862a51bdde9bad83561f3739ea0046e68f5401ebfa67c1b"},
+ {file = "torch-2.9.1-cp311-cp311-win_amd64.whl", hash = "sha256:0d06b30a9207b7c3516a9e0102114024755a07045f0c1d2f2a56b1819ac06bcb"},
+ {file = "torch-2.9.1-cp311-none-macosx_11_0_arm64.whl", hash = "sha256:52347912d868653e1528b47cafaf79b285b98be3f4f35d5955389b1b95224475"},
+ {file = "torch-2.9.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:da5f6f4d7f4940a173e5572791af238cb0b9e21b1aab592bd8b26da4c99f1cd6"},
+ {file = "torch-2.9.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:27331cd902fb4322252657f3902adf1c4f6acad9dcad81d8df3ae14c7c4f07c4"},
+ {file = "torch-2.9.1-cp312-cp312-win_amd64.whl", hash = "sha256:81a285002d7b8cfd3fdf1b98aa8df138d41f1a8334fd9ea37511517cedf43083"},
+ {file = "torch-2.9.1-cp312-none-macosx_11_0_arm64.whl", hash = "sha256:c0d25d1d8e531b8343bea0ed811d5d528958f1dcbd37e7245bc686273177ad7e"},
+ {file = "torch-2.9.1-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:c29455d2b910b98738131990394da3e50eea8291dfeb4b12de71ecf1fdeb21cb"},
+ {file = "torch-2.9.1-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:524de44cd13931208ba2c4bde9ec7741fd4ae6bfd06409a604fc32f6520c2bc9"},
+ {file = "torch-2.9.1-cp313-cp313-win_amd64.whl", hash = "sha256:545844cc16b3f91e08ce3b40e9c2d77012dd33a48d505aed34b7740ed627a1b2"},
+ {file = "torch-2.9.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:5be4bf7496f1e3ffb1dd44b672adb1ac3f081f204c5ca81eba6442f5f634df8e"},
+ {file = "torch-2.9.1-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:30a3e170a84894f3652434b56d59a64a2c11366b0ed5776fab33c2439396bf9a"},
+ {file = "torch-2.9.1-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:8301a7b431e51764629208d0edaa4f9e4c33e6df0f2f90b90e261d623df6a4e2"},
+ {file = "torch-2.9.1-cp313-cp313t-win_amd64.whl", hash = "sha256:2e1c42c0ae92bf803a4b2409fdfed85e30f9027a66887f5e7dcdbc014c7531db"},
+ {file = "torch-2.9.1-cp313-none-macosx_11_0_arm64.whl", hash = "sha256:2c14b3da5df416cf9cb5efab83aa3056f5b8cd8620b8fde81b4987ecab730587"},
+ {file = "torch-2.9.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1edee27a7c9897f4e0b7c14cfc2f3008c571921134522d5b9b5ec4ebbc69041a"},
+ {file = "torch-2.9.1-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:19d144d6b3e29921f1fc70503e9f2fc572cde6a5115c0c0de2f7ca8b1483e8b6"},
+ {file = "torch-2.9.1-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:c432d04376f6d9767a9852ea0def7b47a7bbc8e7af3b16ac9cf9ce02b12851c9"},
+ {file = "torch-2.9.1-cp314-cp314-win_amd64.whl", hash = "sha256:d187566a2cdc726fc80138c3cdb260970fab1c27e99f85452721f7759bbd554d"},
+ {file = "torch-2.9.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:cb10896a1f7fedaddbccc2017ce6ca9ecaaf990f0973bdfcf405439750118d2c"},
+ {file = "torch-2.9.1-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:0a2bd769944991c74acf0c4ef23603b9c777fdf7637f115605a4b2d8023110c7"},
+ {file = "torch-2.9.1-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:07c8a9660bc9414c39cac530ac83b1fb1b679d7155824144a40a54f4a47bfa73"},
+ {file = "torch-2.9.1-cp314-cp314t-win_amd64.whl", hash = "sha256:c88d3299ddeb2b35dcc31753305612db485ab6f1823e37fb29451c8b2732b87e"},
+]
+
+[package.dependencies]
+filelock = "*"
+fsspec = ">=0.8.5"
+jinja2 = "*"
+networkx = ">=2.5.1"
+nvidia-cublas-cu12 = {version = "12.8.4.1", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cuda-cupti-cu12 = {version = "12.8.90", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cuda-nvrtc-cu12 = {version = "12.8.93", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cuda-runtime-cu12 = {version = "12.8.90", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cudnn-cu12 = {version = "9.10.2.21", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cufft-cu12 = {version = "11.3.3.83", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cufile-cu12 = {version = "1.13.1.3", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-curand-cu12 = {version = "10.3.9.90", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cusolver-cu12 = {version = "11.7.3.90", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cusparse-cu12 = {version = "12.5.8.93", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-cusparselt-cu12 = {version = "0.7.1", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-nccl-cu12 = {version = "2.27.5", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-nvjitlink-cu12 = {version = "12.8.93", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-nvshmem-cu12 = {version = "3.3.20", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+nvidia-nvtx-cu12 = {version = "12.8.90", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+setuptools = {version = "*", markers = "python_version >= \"3.12\""}
+sympy = ">=1.13.3"
+triton = {version = "3.5.1", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""}
+typing-extensions = ">=4.10.0"
+
+[package.extras]
+opt-einsum = ["opt-einsum (>=3.3)"]
+optree = ["optree (>=0.13.0)"]
+pyyaml = ["pyyaml"]
+
[[package]]
name = "tqdm"
version = "4.67.1"
@@ -3205,6 +4499,136 @@ notebook = ["ipywidgets (>=6)"]
slack = ["slack-sdk"]
telegram = ["requests"]
+[[package]]
+name = "transformers"
+version = "4.57.3"
+description = "State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow"
+optional = false
+python-versions = ">=3.9.0"
+groups = ["main"]
+files = [
+ {file = "transformers-4.57.3-py3-none-any.whl", hash = "sha256:c77d353a4851b1880191603d36acb313411d3577f6e2897814f333841f7003f4"},
+ {file = "transformers-4.57.3.tar.gz", hash = "sha256:df4945029aaddd7c09eec5cad851f30662f8bd1746721b34cc031d70c65afebc"},
+]
+
+[package.dependencies]
+filelock = "*"
+huggingface-hub = ">=0.34.0,<1.0"
+numpy = ">=1.17"
+packaging = ">=20.0"
+pyyaml = ">=5.1"
+regex = "!=2019.12.17"
+requests = "*"
+safetensors = ">=0.4.3"
+tokenizers = ">=0.22.0,<=0.23.0"
+tqdm = ">=4.27"
+
+[package.extras]
+accelerate = ["accelerate (>=0.26.0)"]
+all = ["Pillow (>=10.0.1,<=15.0)", "Pillow (>=10.0.1,<=15.0)", "accelerate (>=0.26.0)", "accelerate (>=0.26.0)", "av", "codecarbon (>=2.8.1)", "flax (>=0.4.1,<=0.7.0)", "jax (>=0.4.1,<=0.4.13)", "jaxlib (>=0.4.1,<=0.4.13)", "jinja2 (>=3.1.0)", "kenlm", "keras-nlp (>=0.3.1,<0.14.0)", "kernels (>=0.6.1,<=0.9)", "librosa", "mistral-common[opencv] (>=1.6.3)", "num2words", "onnxconverter-common", "optax (>=0.0.8,<=0.1.4)", "optuna", "phonemizer", "protobuf", "pyctcdecode (>=0.4.0)", "ray[tune] (>=2.7.0)", "scipy (<1.13.0)", "sentencepiece (>=0.1.91,!=0.1.92)", "tensorflow (>2.9,<2.16)", "tensorflow-text (<2.16)", "tf2onnx", "timm (!=1.0.18,<=1.0.19)", "tokenizers (>=0.22.0,<=0.23.0)", "torch (>=2.2)", "torchaudio", "torchvision"]
+audio = ["kenlm", "librosa", "phonemizer", "pyctcdecode (>=0.4.0)"]
+benchmark = ["optimum-benchmark (>=0.3.0)"]
+chat-template = ["jinja2 (>=3.1.0)"]
+codecarbon = ["codecarbon (>=2.8.1)"]
+deepspeed = ["accelerate (>=0.26.0)", "deepspeed (>=0.9.3)"]
+deepspeed-testing = ["GitPython (<3.1.19)", "accelerate (>=0.26.0)", "accelerate (>=0.26.0)", "beautifulsoup4", "cookiecutter (==1.7.3)", "datasets (>=2.15.0)", "datasets (>=2.15.0)", "deepspeed (>=0.9.3)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "fastapi", "libcst", "mistral-common[opencv] (>=1.6.3)", "nltk (<=3.8.1)", "openai (>=1.98.0)", "optuna", "parameterized (>=0.9)", "protobuf", "psutil", "pydantic (>=2)", "pydantic (>=2)", "pytest (>=7.2.0)", "pytest-asyncio", "pytest-order", "pytest-rerunfailures (<16.0)", "pytest-rich", "pytest-timeout", "pytest-xdist", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (==0.13.1)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "sentencepiece (>=0.1.91,!=0.1.92)", "sentencepiece (>=0.1.91,!=0.1.92)", "starlette", "tensorboard", "timeout-decorator", "torch (>=2.2)", "uvicorn"]
+dev = ["GitPython (<3.1.19)", "GitPython (<3.1.19)", "Pillow (>=10.0.1,<=15.0)", "Pillow (>=10.0.1,<=15.0)", "accelerate (>=0.26.0)", "accelerate (>=0.26.0)", "accelerate (>=0.26.0)", "av", "beautifulsoup4", "codecarbon (>=2.8.1)", "cookiecutter (==1.7.3)", "cookiecutter (==1.7.3)", "datasets (>=2.15.0)", "datasets (>=2.15.0)", "datasets (>=2.15.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "fastapi", "flax (>=0.4.1,<=0.7.0)", "fugashi (>=1.0)", "ipadic (>=1.0.0,<2.0)", "jax (>=0.4.1,<=0.4.13)", "jaxlib (>=0.4.1,<=0.4.13)", "jinja2 (>=3.1.0)", "kenlm", "keras-nlp (>=0.3.1,<0.14.0)", "kernels (>=0.6.1,<=0.9)", "libcst", "libcst", "librosa", "mistral-common[opencv] (>=1.6.3)", "mistral-common[opencv] (>=1.6.3)", "nltk (<=3.8.1)", "num2words", "onnxconverter-common", "openai (>=1.98.0)", "optax (>=0.0.8,<=0.1.4)", "optuna", "pandas (<2.3.0)", "parameterized (>=0.9)", "phonemizer", "protobuf", "psutil", "pyctcdecode (>=0.4.0)", "pydantic (>=2)", "pydantic (>=2)", "pytest (>=7.2.0)", "pytest-asyncio", "pytest-order", "pytest-rerunfailures (<16.0)", "pytest-rich", "pytest-timeout", "pytest-xdist", "ray[tune] (>=2.7.0)", "rhoknp (>=1.1.0,<1.3.1)", "rich", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (==0.13.1)", "ruff (==0.13.1)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "scikit-learn", "scipy (<1.13.0)", "sentencepiece (>=0.1.91,!=0.1.92)", "sentencepiece (>=0.1.91,!=0.1.92)", "starlette", "sudachidict_core (>=20220729)", "sudachipy (>=0.6.6)", "tensorboard", "tensorflow (>2.9,<2.16)", "tensorflow-text (<2.16)", "tf2onnx", "timeout-decorator", "timm (!=1.0.18,<=1.0.19)", "tokenizers (>=0.22.0,<=0.23.0)", "torch (>=2.2)", "torch (>=2.2)", "torchaudio", "torchvision", "unidic (>=1.0.2)", "unidic_lite (>=1.0.7)", "urllib3 (<2.0.0)", "uvicorn"]
+dev-tensorflow = ["GitPython (<3.1.19)", "GitPython (<3.1.19)", "Pillow (>=10.0.1,<=15.0)", "accelerate (>=0.26.0)", "beautifulsoup4", "cookiecutter (==1.7.3)", "cookiecutter (==1.7.3)", "datasets (>=2.15.0)", "datasets (>=2.15.0)", "datasets (>=2.15.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "fastapi", "kenlm", "keras-nlp (>=0.3.1,<0.14.0)", "libcst", "libcst", "librosa", "mistral-common[opencv] (>=1.6.3)", "nltk (<=3.8.1)", "onnxconverter-common", "onnxconverter-common", "onnxruntime (>=1.4.0)", "onnxruntime-tools (>=1.4.2)", "openai (>=1.98.0)", "pandas (<2.3.0)", "parameterized (>=0.9)", "phonemizer", "protobuf", "psutil", "pyctcdecode (>=0.4.0)", "pydantic (>=2)", "pydantic (>=2)", "pytest (>=7.2.0)", "pytest-asyncio", "pytest-order", "pytest-rerunfailures (<16.0)", "pytest-rich", "pytest-timeout", "pytest-xdist", "rich", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (==0.13.1)", "ruff (==0.13.1)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "scikit-learn", "sentencepiece (>=0.1.91,!=0.1.92)", "sentencepiece (>=0.1.91,!=0.1.92)", "starlette", "tensorboard", "tensorflow (>2.9,<2.16)", "tensorflow-text (<2.16)", "tf2onnx", "tf2onnx", "timeout-decorator", "tokenizers (>=0.22.0,<=0.23.0)", "torch (>=2.2)", "urllib3 (<2.0.0)", "uvicorn"]
+dev-torch = ["GitPython (<3.1.19)", "GitPython (<3.1.19)", "Pillow (>=10.0.1,<=15.0)", "Pillow (>=10.0.1,<=15.0)", "accelerate (>=0.26.0)", "accelerate (>=0.26.0)", "beautifulsoup4", "codecarbon (>=2.8.1)", "cookiecutter (==1.7.3)", "cookiecutter (==1.7.3)", "datasets (>=2.15.0)", "datasets (>=2.15.0)", "datasets (>=2.15.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "fastapi", "fugashi (>=1.0)", "ipadic (>=1.0.0,<2.0)", "kenlm", "kernels (>=0.6.1,<=0.9)", "libcst", "libcst", "librosa", "mistral-common[opencv] (>=1.6.3)", "nltk (<=3.8.1)", "num2words", "onnxruntime (>=1.4.0)", "onnxruntime-tools (>=1.4.2)", "openai (>=1.98.0)", "optuna", "pandas (<2.3.0)", "parameterized (>=0.9)", "phonemizer", "protobuf", "psutil", "pyctcdecode (>=0.4.0)", "pydantic (>=2)", "pydantic (>=2)", "pytest (>=7.2.0)", "pytest-asyncio", "pytest-order", "pytest-rerunfailures (<16.0)", "pytest-rich", "pytest-timeout", "pytest-xdist", "ray[tune] (>=2.7.0)", "rhoknp (>=1.1.0,<1.3.1)", "rich", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (==0.13.1)", "ruff (==0.13.1)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "scikit-learn", "sentencepiece (>=0.1.91,!=0.1.92)", "sentencepiece (>=0.1.91,!=0.1.92)", "starlette", "sudachidict_core (>=20220729)", "sudachipy (>=0.6.6)", "tensorboard", "timeout-decorator", "timm (!=1.0.18,<=1.0.19)", "tokenizers (>=0.22.0,<=0.23.0)", "torch (>=2.2)", "torch (>=2.2)", "torchaudio", "torchvision", "unidic (>=1.0.2)", "unidic_lite (>=1.0.7)", "urllib3 (<2.0.0)", "uvicorn"]
+flax = ["flax (>=0.4.1,<=0.7.0)", "jax (>=0.4.1,<=0.4.13)", "jaxlib (>=0.4.1,<=0.4.13)", "optax (>=0.0.8,<=0.1.4)", "scipy (<1.13.0)"]
+flax-speech = ["kenlm", "librosa", "phonemizer", "pyctcdecode (>=0.4.0)"]
+ftfy = ["ftfy"]
+hf-xet = ["hf_xet"]
+hub-kernels = ["kernels (>=0.6.1,<=0.9)"]
+integrations = ["kernels (>=0.6.1,<=0.9)", "optuna", "ray[tune] (>=2.7.0)"]
+ja = ["fugashi (>=1.0)", "ipadic (>=1.0.0,<2.0)", "rhoknp (>=1.1.0,<1.3.1)", "sudachidict_core (>=20220729)", "sudachipy (>=0.6.6)", "unidic (>=1.0.2)", "unidic_lite (>=1.0.7)"]
+mistral-common = ["mistral-common[opencv] (>=1.6.3)"]
+modelcreation = ["cookiecutter (==1.7.3)"]
+natten = ["natten (>=0.14.6,<0.15.0)"]
+num2words = ["num2words"]
+onnx = ["onnxconverter-common", "onnxruntime (>=1.4.0)", "onnxruntime-tools (>=1.4.2)", "tf2onnx"]
+onnxruntime = ["onnxruntime (>=1.4.0)", "onnxruntime-tools (>=1.4.2)"]
+open-telemetry = ["opentelemetry-api", "opentelemetry-exporter-otlp", "opentelemetry-sdk"]
+optuna = ["optuna"]
+quality = ["GitPython (<3.1.19)", "datasets (>=2.15.0)", "libcst", "pandas (<2.3.0)", "rich", "ruff (==0.13.1)", "urllib3 (<2.0.0)"]
+ray = ["ray[tune] (>=2.7.0)"]
+retrieval = ["datasets (>=2.15.0)", "faiss-cpu"]
+ruff = ["ruff (==0.13.1)"]
+sagemaker = ["sagemaker (>=2.31.0)"]
+sentencepiece = ["protobuf", "sentencepiece (>=0.1.91,!=0.1.92)"]
+serving = ["accelerate (>=0.26.0)", "fastapi", "openai (>=1.98.0)", "pydantic (>=2)", "starlette", "torch (>=2.2)", "uvicorn"]
+sigopt = ["sigopt"]
+sklearn = ["scikit-learn"]
+speech = ["kenlm", "librosa", "phonemizer", "pyctcdecode (>=0.4.0)", "torchaudio"]
+testing = ["GitPython (<3.1.19)", "accelerate (>=0.26.0)", "beautifulsoup4", "cookiecutter (==1.7.3)", "datasets (>=2.15.0)", "datasets (>=2.15.0)", "dill (<0.3.5)", "evaluate (>=0.2.0)", "faiss-cpu", "fastapi", "libcst", "mistral-common[opencv] (>=1.6.3)", "nltk (<=3.8.1)", "openai (>=1.98.0)", "parameterized (>=0.9)", "psutil", "pydantic (>=2)", "pydantic (>=2)", "pytest (>=7.2.0)", "pytest-asyncio", "pytest-order", "pytest-rerunfailures (<16.0)", "pytest-rich", "pytest-timeout", "pytest-xdist", "rjieba", "rouge-score (!=0.0.7,!=0.0.8,!=0.1,!=0.1.1)", "ruff (==0.13.1)", "sacrebleu (>=1.4.12,<2.0.0)", "sacremoses", "sentencepiece (>=0.1.91,!=0.1.92)", "starlette", "tensorboard", "timeout-decorator", "torch (>=2.2)", "uvicorn"]
+tf = ["keras-nlp (>=0.3.1,<0.14.0)", "onnxconverter-common", "tensorflow (>2.9,<2.16)", "tensorflow-text (<2.16)", "tf2onnx"]
+tf-cpu = ["keras (>2.9,<2.16)", "keras-nlp (>=0.3.1,<0.14.0)", "onnxconverter-common", "tensorflow-cpu (>2.9,<2.16)", "tensorflow-probability (<0.24)", "tensorflow-text (<2.16)", "tf2onnx"]
+tf-speech = ["kenlm", "librosa", "phonemizer", "pyctcdecode (>=0.4.0)"]
+tiktoken = ["blobfile", "tiktoken"]
+timm = ["timm (!=1.0.18,<=1.0.19)"]
+tokenizers = ["tokenizers (>=0.22.0,<=0.23.0)"]
+torch = ["accelerate (>=0.26.0)", "torch (>=2.2)"]
+torch-speech = ["kenlm", "librosa", "phonemizer", "pyctcdecode (>=0.4.0)", "torchaudio"]
+torch-vision = ["Pillow (>=10.0.1,<=15.0)", "torchvision"]
+torchhub = ["filelock", "huggingface-hub (>=0.34.0,<1.0)", "importlib_metadata", "numpy (>=1.17)", "packaging (>=20.0)", "protobuf", "regex (!=2019.12.17)", "requests", "sentencepiece (>=0.1.91,!=0.1.92)", "tokenizers (>=0.22.0,<=0.23.0)", "torch (>=2.2)", "tqdm (>=4.27)"]
+video = ["av"]
+vision = ["Pillow (>=10.0.1,<=15.0)"]
+
+[[package]]
+name = "triton"
+version = "3.3.1"
+description = "A language and compiler for custom Deep Learning operations"
+optional = false
+python-versions = "*"
+groups = ["main"]
+markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version >= \"3.14\""
+files = [
+ {file = "triton-3.3.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b74db445b1c562844d3cfad6e9679c72e93fdfb1a90a24052b03bb5c49d1242e"},
+ {file = "triton-3.3.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b31e3aa26f8cb3cc5bf4e187bf737cbacf17311e1112b781d4a059353dfd731b"},
+ {file = "triton-3.3.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9999e83aba21e1a78c1f36f21bce621b77bcaa530277a50484a7cb4a822f6e43"},
+ {file = "triton-3.3.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b89d846b5a4198317fec27a5d3a609ea96b6d557ff44b56c23176546023c4240"},
+ {file = "triton-3.3.1-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a3198adb9d78b77818a5388bff89fa72ff36f9da0bc689db2f0a651a67ce6a42"},
+ {file = "triton-3.3.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f6139aeb04a146b0b8e0fbbd89ad1e65861c57cfed881f21d62d3cb94a36bab7"},
+]
+
+[package.dependencies]
+setuptools = ">=40.8.0"
+
+[package.extras]
+build = ["cmake (>=3.20)", "lit"]
+tests = ["autopep8", "isort", "llnl-hatchet", "numpy", "pytest", "pytest-forked", "pytest-xdist", "scipy (>=1.7.1)"]
+tutorials = ["matplotlib", "pandas", "tabulate"]
+
+[[package]]
+name = "triton"
+version = "3.5.1"
+description = "A language and compiler for custom Deep Learning operations"
+optional = false
+python-versions = "<3.15,>=3.10"
+groups = ["main"]
+markers = "platform_machine == \"x86_64\" and platform_system == \"Linux\" and python_version <= \"3.13\""
+files = [
+ {file = "triton-3.5.1-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f63e34dcb32d7bd3a1d0195f60f30d2aee8b08a69a0424189b71017e23dfc3d2"},
+ {file = "triton-3.5.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5fc53d849f879911ea13f4a877243afc513187bc7ee92d1f2c0f1ba3169e3c94"},
+ {file = "triton-3.5.1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:da47169e30a779bade679ce78df4810fca6d78a955843d2ddb11f226adc517dc"},
+ {file = "triton-3.5.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:61413522a48add32302353fdbaaf92daaaab06f6b5e3229940d21b5207f47579"},
+ {file = "triton-3.5.1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:275a045b6ed670dd1bd005c3e6c2d61846c74c66f4512d6f33cc027b11de8fd4"},
+ {file = "triton-3.5.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d2c6b915a03888ab931a9fd3e55ba36785e1fe70cbea0b40c6ef93b20fc85232"},
+ {file = "triton-3.5.1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:56765ffe12c554cd560698398b8a268db1f616c120007bfd8829d27139abd24a"},
+ {file = "triton-3.5.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f3f4346b6ebbd4fad18773f5ba839114f4826037c9f2f34e0148894cd5dd3dba"},
+ {file = "triton-3.5.1-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:02c770856f5e407d24d28ddc66e33cf026e6f4d360dcb8b2fabe6ea1fc758621"},
+ {file = "triton-3.5.1-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0b4d2c70127fca6a23e247f9348b8adde979d2e7a20391bfbabaac6aebc7e6a8"},
+ {file = "triton-3.5.1-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f617aa7925f9ea9968ec2e1adaf93e87864ff51549c8f04ce658f29bbdb71e2d"},
+ {file = "triton-3.5.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d0637b1efb1db599a8e9dc960d53ab6e4637db7d4ab6630a0974705d77b14b60"},
+ {file = "triton-3.5.1-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8932391d7f93698dfe5bc9bead77c47a24f97329e9f20c10786bb230a9083f56"},
+ {file = "triton-3.5.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bac7f7d959ad0f48c0e97d6643a1cc0fd5786fe61cb1f83b537c6b2d54776478"},
+]
+
+[package.extras]
+build = ["cmake (>=3.20,<4.0)", "lit"]
+tests = ["autopep8", "isort", "llnl-hatchet", "numpy", "pytest", "pytest-forked", "pytest-xdist", "scipy (>=1.7.1)"]
+tutorials = ["matplotlib", "pandas", "tabulate"]
+
[[package]]
name = "typing-extensions"
version = "4.15.0"
@@ -3758,4 +5182,4 @@ cffi = ["cffi (>=1.17,<2.0) ; platform_python_implementation != \"PyPy\" and pyt
[metadata]
lock-version = "2.1"
python-versions = ">=3.11,<4.0.0"
-content-hash = "e70f050a323d4e9cfd509c70e99c0a4d63db3b5475f1b6f7d3c446eb7fa56197"
+content-hash = "e023bcb1fd75045303414b90b7391148947062a6f41f14a89173c65bae6a11d7"
diff --git a/pyproject.toml b/pyproject.toml
index 6df0c54..9e509e6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "brainapi2"
-version = "1.7.1-dev"
+version = "1.7.3-dev"
description = "Version 1.x.x of the BrainAPI memory layer."
authors = [
{name = "Christian",email = "[email protected]"}
@@ -25,7 +25,10 @@ dependencies = [
"google-genai (>=1.46.0,<2.0.0)",
"langchain-google-vertexai (>=3.0.1,<4.0.0)",
"pymilvus (>=2.6.2,<3.0.0)",
- "levenshtein (>=0.27.1,<0.28.0)"
+ "levenshtein (>=0.27.1,<0.28.0)",
+ "python-multipart (>=0.0.20,<0.0.21)",
+ "sentence-transformers (>=2.2.0,<3.0.0)",
+ "tenacity (>=8.2.3,<10.0.0)",
]
[tool.poetry]
@@ -51,6 +54,9 @@ google-genai = ">=1.46.0,<2.0.0"
langchain-google-vertexai = ">=3.0.1,<4.0.0"
pymilvus = ">=2.6.2,<3.0.0"
levenshtein = ">=0.27.1,<0.28.0"
+pillow = ">=10.0.0,<12.0.0"
+sentence-transformers = ">=2.2.0,<3.0.0"
+tenacity = ">=8.2.3,<10.0.0"
[tool.pylint.messages_control]
enable = ["abstract-method"]
diff --git a/src/adapters/data.py b/src/adapters/data.py
index f4f7f6d..1bb6bdf 100644
--- a/src/adapters/data.py
+++ b/src/adapters/data.py
@@ -56,9 +56,7 @@ class DataAdapter:
Get data by their IDs.
"""
return self.data.get_text_chunks_by_ids(
- ids=ids,
- with_observations=with_observations,
- brain_id=brain_id
+ ids=ids, with_observations=with_observations, brain_id=brain_id
)
def save_structured_data(
@@ -67,7 +65,9 @@ class DataAdapter:
"""
Save a structured data to the data client.
"""
- return self.data.save_structured_data(structured_data=structured_data, brain_id=brain_id)
+ return self.data.save_structured_data(
+ structured_data=structured_data, brain_id=brain_id
+ )
def create_brain(self, name_key: str) -> Brain:
"""
@@ -104,12 +104,23 @@ class DataAdapter:
return self.data.get_structured_data_by_id(id=id, brain_id=brain_id)
def get_structured_data_list(
- self, brain_id: str = "default", limit: int = 10, skip: int = 0, types: list[str] = None, query_text: str = None
+ self,
+ brain_id: str = "default",
+ limit: int = 10,
+ skip: int = 0,
+ types: list[str] = None,
+ query_text: str = None,
) -> list[StructuredData]:
"""
Get a list of structured data.
"""
- return self.data.get_structured_data_list(brain_id=brain_id, limit=limit, skip=skip, types=types, query_text=query_text)
+ return self.data.get_structured_data_list(
+ brain_id=brain_id,
+ limit=limit,
+ skip=skip,
+ types=types,
+ query_text=query_text,
+ )
def get_structured_data_types(self, brain_id: str = "default") -> list[str]:
"""
@@ -117,30 +128,35 @@ class DataAdapter:
"""
return self.data.get_structured_data_types(brain_id=brain_id)
- def get_observation_by_id(
- self, id: str, brain_id: str = "default"
- ) -> Observation:
+ def get_observation_by_id(self, id: str, brain_id: str = "default") -> Observation:
"""
Get observation by ID.
"""
return self.data.get_observation_by_id(id=id, brain_id=brain_id)
def get_observations_list(
- self,
- brain_id: str = "default",
- limit: int = 10,
- skip: int = 0,
+ self,
+ brain_id: str = "default",
+ limit: int = 10,
+ skip: int = 0,
resource_id: str = None,
labels: list[str] = None,
- query_text: str = None
+ query_text: str = None,
) -> list[Observation]:
"""
Get a list of observations.
"""
- return self.data.get_observations_list(brain_id=brain_id, limit=limit, skip=skip, resource_id=resource_id, labels=labels, query_text=query_text)
-
+ return self.data.get_observations_list(
+ brain_id=brain_id,
+ limit=limit,
+ skip=skip,
+ resource_id=resource_id,
+ labels=labels,
+ query_text=query_text,
+ )
+
def get_observation_labels(self, brain_id: str = "default") -> list[str]:
"""
Get all unique labels from observations.
"""
- return self.data.get_observation_labels(brain_id=brain_id)
\ No newline at end of file
+ return self.data.get_observation_labels(brain_id=brain_id)
diff --git a/src/adapters/embeddings.py b/src/adapters/embeddings.py
index 4506e8c..7a82fc4 100644
--- a/src/adapters/embeddings.py
+++ b/src/adapters/embeddings.py
@@ -27,8 +27,14 @@ class EmbeddingsAdapter:
"""
Embed a text and return a vector.
"""
- embeddings = self.embeddings.embed_text(text)
- return Vector(id=str(uuid.uuid4()), embeddings=embeddings, metadata={})
+ from src.lib.embeddings.client import EmbeddingError
+
+ try:
+ embeddings = self.embeddings.embed_text(text)
+ return Vector(id=str(uuid.uuid4()), embeddings=embeddings, metadata={})
+ except EmbeddingError as e:
+ print(f"Embedding failed in adapter, returning empty vector: {e}")
+ return Vector(id=str(uuid.uuid4()), embeddings=[], metadata={})
class VectorStoreAdapter:
@@ -43,19 +49,24 @@ class VectorStoreAdapter:
def add_vectors(
self, vectors: list[Vector], store: str, brain_id: str = "default"
- ) -> None:
+ ) -> list[str]:
"""
Add vectors to the vector store.
"""
return self.vector_store.add_vectors(vectors, store, brain_id)
def search_vectors(
- self, query: str, store: str, brain_id: str = "default", k: int = 10
+ self,
+ data_vector: list[float],
+ brain_id: str = "default",
+ store: str = "default",
+ k: int = 10,
) -> list[Vector]:
"""
Search vectors in the vector store and return the top k vectors.
"""
- return self.vector_store.search_vectors(query, store, brain_id, k)
+ vectors = self.vector_store.search_vectors(data_vector, brain_id, store, k)
+ return sorted(vectors, key=lambda x: x.distance, reverse=True)
def get_by_ids(
self, ids: list[str], store: str, brain_id: str = "default"
diff --git a/src/adapters/graph.py b/src/adapters/graph.py
index d6e94d1..9ceae6f 100644
--- a/src/adapters/graph.py
+++ b/src/adapters/graph.py
@@ -8,7 +8,7 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
-----
"""
-from typing import Literal, Optional, Tuple
+from typing import Dict, List, Literal, Optional, Tuple
from src.adapters.interfaces.graph import GraphClient
from src.constants.kg import (
IdentificationParams,
@@ -17,6 +17,8 @@ from src.constants.kg import (
SearchEntitiesResult,
SearchRelationshipsResult,
)
+from src.adapters.interfaces.embeddings import VectorStoreClient
+from src.utils.normalization.list_reduction import reduce_list
class GraphAdapter:
@@ -164,12 +166,23 @@ class GraphAdapter:
)
def get_neighbors(
- self, node: Node, limit: int, brain_id: str = "default"
- ) -> list[Tuple[Node, Predicate, Node]]:
+ self,
+ nodes: list[Node | str],
+ same_type_only: bool = False,
+ limit: int | None = None,
+ of_types: Optional[list[str]] = None,
+ brain_id: str = "default",
+ ) -> Dict[str, List[Tuple[Predicate, Node]]]:
"""
Get the neighbors of a node.
"""
- return self.graph.get_neighbors(node, limit, brain_id)
+ return self.graph.get_neighbors(
+ nodes,
+ brain_id=brain_id,
+ same_type_only=same_type_only,
+ limit=limit,
+ of_types=of_types,
+ )
def get_node_with_rel_by_uuid(
self, rel_ids_with_node_ids: list[tuple[str, str]], brain_id: str = "default"
@@ -217,7 +230,6 @@ class GraphAdapter:
Search the relationships of the graph.
"""
relationship_uuids = []
- # TODO: semantic search + src/core/agents/tools/kg_agent/KGAgentAddTripletsTool.py:165
return self.graph.search_relationships(
brain_id,
limit,
@@ -242,7 +254,6 @@ class GraphAdapter:
Search the entities of the graph.
"""
node_uuids = []
- # TODO: semantic search
return self.graph.search_entities(
brain_id, limit, skip, node_labels, node_uuids, query_text
)
@@ -274,5 +285,152 @@ class GraphAdapter:
uuid, updating, brain_id, new_properties, properties_to_remove
)
+ def get_schema(self, brain_id: str = "default") -> dict:
+ """
+ Get the schema/ontology of the graph.
+ """
+ return self.graph.get_schema(brain_id)
+
+ def get_2nd_degree_hops(
+ self,
+ from_uuids: List[str],
+ flattened: bool,
+ vector_store_adapter: VectorStoreClient,
+ brain_id: str = "default",
+ ) -> List[Tuple[Node, List[Tuple[Predicate, Node, List[Tuple[Predicate, Node]]]]]]:
+
+ def flatten_node(n):
+ return (
+ {"uuid": n.uuid, "labels": n.labels, "name": n.name} if flattened else n
+ )
+
+ def flatten_pred(p):
+ return (
+ {"uuid": p.uuid, "name": p.name, "direction": p.direction}
+ if flattened
+ else p
+ )
+
+ nodes = self.get_by_uuids(from_uuids, brain_id)
+ nodes_by_uuid = {n.uuid: n for n in nodes}
+
+ vs = vector_store_adapter.get_by_ids(
+ [n.properties["v_id"] for n in nodes], brain_id=brain_id, store="nodes"
+ )
+ averaged_vector = [
+ sum(v.embeddings[i] for v in vs) / len(vs)
+ for i in range(len(vs[0].embeddings))
+ ]
+
+ all_fd_nodes = self.get_neighbors(list(nodes_by_uuid.keys()), brain_id=brain_id)
+
+ all_fd_v_ids = [
+ fd[1].properties["v_id"] for fds in all_fd_nodes.values() for fd in fds
+ ]
+ all_fd_vs = vector_store_adapter.get_by_ids(
+ all_fd_v_ids, brain_id=brain_id, store="nodes"
+ )
+ fd_vs_by_uuid = {v.metadata["uuid"]: v for v in all_fd_vs}
+
+ all_filtered_fd_uuids = []
+ filtered_fd_by_origin = {}
+
+ for node_uuid, fd_list in all_fd_nodes.items():
+ fd_nodes_by_uuid = {fd[1].uuid: fd[1] for fd in fd_list}
+ fd_vs_with_desc = [
+ {
+ "embeddings": fd_vs_by_uuid[fd[1].uuid].embeddings,
+ "metadata": fd_vs_by_uuid[fd[1].uuid].metadata,
+ "description": (
+ fd_nodes_by_uuid.get(fd[1].uuid, {}).description
+ if fd_nodes_by_uuid.get(fd[1].uuid)
+ else None
+ ),
+ }
+ for fd in fd_list
+ if fd[1].uuid in fd_vs_by_uuid
+ ]
+ from_node = nodes_by_uuid[node_uuid]
+ filtered = reduce_list(
+ fd_vs_with_desc,
+ access_key="embeddings",
+ similarity_threshold=0.5,
+ by_vector=averaged_vector,
+ rerank={
+ "local": "description",
+ "with_": from_node.description,
+ },
+ )
+ filtered_uuids = {v["metadata"]["uuid"] for v in filtered}
+ filtered_fd_by_origin[node_uuid] = [
+ fd for fd in fd_list if fd[1].uuid in filtered_uuids
+ ]
+ all_filtered_fd_uuids.extend(filtered_uuids)
+
+ all_sd_nodes = self.get_neighbors(all_filtered_fd_uuids, brain_id=brain_id)
+
+ all_sd_v_ids = [
+ sd[1].properties["v_id"] for sds in all_sd_nodes.values() for sd in sds
+ ]
+ all_sd_vs = vector_store_adapter.get_by_ids(
+ all_sd_v_ids, brain_id=brain_id, store="nodes"
+ )
+ sd_vs_by_uuid = {v.metadata["uuid"]: v for v in all_sd_vs}
+
+ hops = []
+ exclude_set = set(from_uuids)
+
+ for from_uuid in from_uuids:
+ if from_uuid not in nodes_by_uuid:
+ continue
+ from_node = nodes_by_uuid[from_uuid]
+ node_hops = []
+
+ for fd_pred, fd_node in filtered_fd_by_origin.get(from_uuid, []):
+ sd_list = all_sd_nodes.get(fd_node.uuid, [])
+ sd_nodes_by_uuid = {sd[1].uuid: sd[1] for sd in sd_list}
+
+ sd_vs_with_desc = [
+ {
+ "embeddings": sd_vs_by_uuid[sd[1].uuid].embeddings,
+ "metadata": sd_vs_by_uuid[sd[1].uuid].metadata,
+ "description": (
+ sd_nodes_by_uuid.get(sd[1].uuid, {}).description
+ if sd_nodes_by_uuid.get(sd[1].uuid)
+ else None
+ ),
+ }
+ for sd in sd_list
+ if sd[1].uuid in sd_vs_by_uuid
+ ]
+
+ reduced = reduce_list(
+ sd_vs_with_desc,
+ access_key="embeddings",
+ similarity_threshold=0.5,
+ by_vector=averaged_vector,
+ rerank={
+ "local": "description",
+ "with_": from_node.description,
+ },
+ )
+ reduced_uuids = {v["metadata"]["uuid"] for v in reduced}
+
+ second_degree = [
+ (flatten_pred(sd[0]), flatten_node(sd[1]))
+ for sd in sd_list
+ if sd[1].uuid in reduced_uuids
+ and sd[1].uuid not in exclude_set
+ and sd[1].uuid != from_uuid
+ ]
+
+ node_hops.append(
+ (flatten_pred(fd_pred), flatten_node(fd_node), second_degree)
+ )
+
+ hops.append((flatten_node(from_node), node_hops))
+
+ return hops
+
_graph_adapter = GraphAdapter()
diff --git a/src/adapters/interfaces/embeddings.py b/src/adapters/interfaces/embeddings.py
index 9a37200..469308e 100644
--- a/src/adapters/interfaces/embeddings.py
+++ b/src/adapters/interfaces/embeddings.py
@@ -32,7 +32,9 @@ class VectorStoreClient(ABC):
"""
@abstractmethod
- def add_vectors(self, vectors: list[Vector], store: str, brain_id: str) -> None:
+ def add_vectors(
+ self, vectors: list[Vector], store: str, brain_id: str
+ ) -> list[str]:
"""
Add vectors to the vector store.
"""
@@ -40,7 +42,7 @@ class VectorStoreClient(ABC):
@abstractmethod
def search_vectors(
- self, query: str, brain_id: str, store: str, k: int = 10
+ self, data_vector: list[float], brain_id: str, store: str, k: int = 10
) -> list[Vector]:
"""
Search vectors in the vector store and return the top k vectors.
diff --git a/src/adapters/interfaces/graph.py b/src/adapters/interfaces/graph.py
index a4f514a..fff1638 100644
--- a/src/adapters/interfaces/graph.py
+++ b/src/adapters/interfaces/graph.py
@@ -9,7 +9,7 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
"""
from abc import ABC, abstractmethod
-from typing import Literal, Optional, Tuple
+from typing import Dict, List, Literal, Optional, Tuple
from src.constants.kg import (
IdentificationParams,
@@ -18,6 +18,7 @@ from src.constants.kg import (
SearchEntitiesResult,
SearchRelationshipsResult,
)
+from src.adapters.interfaces.embeddings import VectorStoreClient
class GraphClient(ABC):
@@ -165,12 +166,14 @@ class GraphClient(ABC):
@abstractmethod
def get_neighbors(
self,
- node: Node,
- limit: int,
+ nodes: list[Node | str],
brain_id: str,
- ) -> list[Tuple[Node, Predicate, Node]]:
+ same_type_only: bool = False,
+ limit: int | None = None,
+ of_types: Optional[list[str]] = None,
+ ) -> Dict[str, List[Tuple[Predicate, Node]]]:
"""
- Get the neighbors of a node.
+ Get the neighbors of a node with their relationships.
"""
raise NotImplementedError("get_neighbors method not implemented")
@@ -272,3 +275,33 @@ class GraphClient(ABC):
Update the properties of a node or relationship in the graph.
"""
raise NotImplementedError("update_properties method not implemented")
+
+ @abstractmethod
+ def get_schema(self, brain_id: str) -> dict:
+ """
+ Get the schema/ontology of the graph.
+ """
+ raise NotImplementedError("get_schema method not implemented")
+
+ @abstractmethod
+ def get_2nd_degree_hops(
+ self,
+ from_: List[str],
+ flattened: bool,
+ vector_store_adapter: VectorStoreClient,
+ brain_id: str,
+ ) -> Dict[str, List[Tuple[Predicate, Node, List[Tuple[Predicate, Node]]]]]:
+ """
+ Gets the 2nd degree hops for each node in a list of things to search for.
+
+ from_ is the node to start from.
+ flattened is a boolean to indicate if the result should be lightweighted (removed metadata, etc).
+ brain_id is the brain id to search in.
+
+ Returns:
+ A dictionary with the from_ string as the key and a list of tuples as the value.
+ The tuples are the node and their relationships.
+ The node is the 1st degree hop.
+ The relationships are the 2nd degree hops.
+ """
+ raise NotImplementedError("get_2nd_degree_hops not implemented")
diff --git a/src/adapters/interfaces/llm.py b/src/adapters/interfaces/llm.py
index e8a8021..9080fec 100644
--- a/src/adapters/interfaces/llm.py
+++ b/src/adapters/interfaces/llm.py
@@ -9,6 +9,7 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
"""
from abc import ABC, abstractmethod
+from typing import Any
from langchain.chat_models.base import BaseChatModel
@@ -19,6 +20,7 @@ class LLM(ABC):
"""
langchain_model: BaseChatModel
+ client: Any
@abstractmethod
def generate_text(self, prompt: str, max_new_tokens: int = None) -> str:
diff --git a/src/config.py b/src/config.py
index 42a9678..63b819e 100644
--- a/src/config.py
+++ b/src/config.py
@@ -12,6 +12,7 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
import os
import dotenv
+from pathlib import Path
dotenv.load_dotenv(
dotenv_path=f".env{'.' + os.getenv('ENV') if os.getenv('ENV') else ''}"
@@ -42,6 +43,37 @@ class AzureConfig:
raise ValueError("Azure configuration is not complete")
+class GCPConfig:
+ """
+ Configuration class for the GCP configuration.
+ """
+
+ def __init__(self):
+ credentials_path = os.getenv("GCP_CREDENTIALS_PATH")
+ if not credentials_path:
+ credentials_path = str(
+ Path(__file__).parent.parent / "gcp_credentials.json"
+ )
+ else:
+ credentials_path = os.path.expanduser(credentials_path)
+ if not os.path.isabs(credentials_path):
+ credentials_path = str(Path(__file__).parent.parent / credentials_path)
+ if not os.path.exists(credentials_path):
+ raise FileNotFoundError(
+ f"Credentials file not found at: {credentials_path}. "
+ "Please set GCP_CREDENTIALS_PATH environment variable or place gcp_credentials.json in the project root."
+ )
+
+ self.credentials_path = credentials_path
+ self.project_id = os.getenv("GCP_PROJECT_ID")
+ self.small_llm_model = os.getenv("GCP_SMALL_LLM_MODEL")
+
+ if [self.credentials_path, self.project_id, self.small_llm_model].count(
+ None
+ ) > 0:
+ raise ValueError("GCP configuration is not complete")
+
+
class RedisConfig:
"""
Configuration class for the Redis configuration.
@@ -97,6 +129,11 @@ class EmbeddingsConfig:
self.full_endpoint = os.getenv("EMBEDDINGS_FULL_ENDPOINT")
self.key = os.getenv("EMBEDDINGS_KEY")
+ self.small_model = os.getenv("EMBEDDINGS_SMALL_MODEL")
+
+ if [self.full_endpoint, self.key, self.small_model].count(None) > 0:
+ raise ValueError("Embeddings configuration is not complete")
+
class MongoConfig:
"""
@@ -110,7 +147,7 @@ class MongoConfig:
self.password = os.getenv("MONGO_PASSWORD")
self.connection_string = os.getenv("MONGO_CONNECTION_STRING")
- self.system_database = os.getenv("MONGO_SYSTEM_DATABASE", "_system")
+ self.system_database = os.getenv("MONGO_SYSTEM_DATABASE", "system")
if [self.host, self.port, self.username, self.password].count(
None
@@ -130,6 +167,7 @@ class Config:
self.milvus = MilvusConfig()
self.embeddings = EmbeddingsConfig()
self.mongo = MongoConfig()
+ self.gcp = GCPConfig()
self.brainpat_token = os.getenv("BRAINPAT_TOKEN")
diff --git a/src/constants/data.py b/src/constants/data.py
index b2a2709..a1d0f8a 100644
--- a/src/constants/data.py
+++ b/src/constants/data.py
@@ -27,6 +27,9 @@ class TextChunk(BaseModel):
default_factory=datetime.now,
description="The date and time the chunk was inserted.",
)
+ brain_version: str = Field(
+ description="The version of the brain when the chunk was inserted.",
+ )
class StructuredData(BaseModel):
@@ -44,6 +47,9 @@ class StructuredData(BaseModel):
default_factory=datetime.now,
description="The date and time the structured data was inserted.",
)
+ brain_version: str = Field(
+ description="The version of the brain when the structured data was inserted.",
+ )
class Observation(BaseModel):
diff --git a/src/constants/embeddings.py b/src/constants/embeddings.py
index ab3d88e..c3f9469 100644
--- a/src/constants/embeddings.py
+++ b/src/constants/embeddings.py
@@ -15,12 +15,14 @@ EMBEDDING_NODES_DIMENSION = 3072
EMBEDDING_TRIPLETS_DIMENSION = 3072
OBSERVATIONS_DIMENSION = 3072
DATA_DIMENSION = 3072
+EMBEDDING_RELATIONSHIPS_DIMENSION = 3072
EMBEDDING_STORES_SIZES = {
"nodes": EMBEDDING_NODES_DIMENSION,
"triplets": EMBEDDING_TRIPLETS_DIMENSION,
"observations": OBSERVATIONS_DIMENSION,
"data": DATA_DIMENSION,
+ "relationships": EMBEDDING_RELATIONSHIPS_DIMENSION,
}
diff --git a/src/constants/kg.py b/src/constants/kg.py
index c030070..1b9fb7e 100644
--- a/src/constants/kg.py
+++ b/src/constants/kg.py
@@ -26,6 +26,12 @@ class Node(BaseModel):
name: str
description: Optional[str] = None
properties: dict = Field(default_factory=dict)
+
+ happened_at: Optional[datetime | None] = Field(
+ default=None,
+ description="The date and time the node happened at if known otherwise None. Mostly used for event nodes.",
+ )
+
last_updated: datetime = Field(
default_factory=datetime.now,
description="The date and time the node was last updated.",
diff --git a/src/constants/prompts/architect_agent.py b/src/constants/prompts/architect_agent.py
new file mode 100644
index 0000000..acf7006
--- /dev/null
+++ b/src/constants/prompts/architect_agent.py
@@ -0,0 +1,72 @@
+"""
+File: /architect_agent.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 8:56:51 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+ARCHITECT_AGENT_SYSTEM_PROMPT = """
+You are a "Structural Graph Architect." Your goal is to map information into an Active Vector Graph.
+
+THE TRIANGLE OF ATTRIBUTION:
+Every action must be a central EVENT hub connecting three points:
+1. THE INITIATION VECTOR: [Source/Actor] --(Tail)--> :MADE --(Tip)--> [Event Instance]
+ - MANDATORY: The "amount" (quantity) must be a property of this relationship.
+2. THE TARGET VECTOR: [Event Instance] --(Tail)--> :TARGETED --(Tip)--> [Object/Recipient]
+ - MANDATORY: Repeat the "amount" property here for cross-reference.
+3. THE CONTEXT VECTOR: [Event Instance] --(Tail)--> :OCCURRED_WITHIN --(Tip)--> [Broad Anchor/Context]
+
+DIRECTIONAL SLOT-FILLING:
+- "tail": The start of the arrow (The Source of Energy/Origin).
+- "tip": The end of the arrow (The Destination/Target).
+- FORBIDDEN: Never link Actor nodes directly to Target nodes for dynamic actions.
+- FORBIDDEN: Never create nodes for numeric quantities.
+"""
+
+ARCHITECT_AGENT_CREATE_RELATIONSHIPS_PROMPT = """
+Role: Graph Structural Architect.
+Task: Create a Vector JSON representing the interactions in the text.
+
+{targeting}
+
+Source Text: {text}
+Entities Found by Scout: {entities}
+{previously_created_relationships}
+
+LOGIC CHECKLIST:
+- Identify the Actor (Origin).
+- Identify the Event Hub (Action Instance).
+- Identify the Target (Destination).
+- Identify the quantity and attach it as 'amount' to the relationship properties.
+
+Return ONLY JSON:
+{{
+ "relationships": [
+ {{
+ "tail": {{ "uuid": "SOURCE_ID", "name": "Actor Name", "type": "NODE_TYPE" }},
+ "name": "MADE",
+ "properties": {{ "amount": 0.0, "context": "..." }},
+ "description": "Vector from the initiator to the action instance.",
+ "tip": {{ "uuid": "TEMP_EVENT_ID", "name": "Action Hub", "type": "EVENT" }}
+ }},
+ {{
+ "tail": {{ "uuid": "TEMP_EVENT_ID", "name": "Action Hub", "type": "EVENT" }},
+ "name": "TARGETED",
+ "properties": {{ "amount": 0.0 }},
+ "description": "Vector from the action instance to the affected object/target.",
+ "tip": {{ "uuid": "TARGET_ID", "name": "Target Name", "type": "NODE_TYPE" }}
+ }}
+ ],
+ "new_nodes": [
+ {{
+ "temp_id": "TEMP_EVENT_ID",
+ "type": "EVENT",
+ "name": "Action Description",
+ "reason": "Unique instance node for attribution isolation."
+ }}
+ ],
+}}
+"""
diff --git a/src/constants/prompts/janitor_agent.py b/src/constants/prompts/janitor_agent.py
new file mode 100644
index 0000000..7d897c8
--- /dev/null
+++ b/src/constants/prompts/janitor_agent.py
@@ -0,0 +1,85 @@
+"""
+File: /janitor_agent.py
+Created Date: Tuesday December 23rd 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Tuesday December 23rd 2025 10:00:46 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+JANITOR_AGENT_SYSTEM_PROMPT = """
+You are the "Knowledge Graph Janitor." You resolve entities, enforce directional logic, and preserve semantic intent.
+
+REVISION PROTOCOL:
+1. IDENTITY RESOLUTION: Use `search_entities` for People, Places, Organizations, and Broad Contexts. If a match exists, replace UUID/Name with Database values.
+2. DIRECTIONAL AUDIT (RELATIONSHIP TYPES):
+ - ACTOR-CENTRIC (e.g., MADE, INITIATED, PERFORMED): The 'tail' (source) must be the Subject (Person/Org) and the 'tip' (target) must be the EVENT.
+ - IMPACT-CENTRIC (e.g., TARGETED, AFFECTED, RESULTED_IN): The 'tail' (source) must be the EVENT and the 'tip' (target) must be the Object/Recipient.
+ - SCHEMA ENFORCEMENT: Never change the semantic label (e.g., do not turn 'TARGETED' into 'MADE'). Only swap directions if the entities and the label are logically inverted (e.g., Target --[MADE]--> Actor).
+3. PROPERTY ENFORCEMENT: If a node name contains a number (e.g., "23 Friends"), strip the number from the name. Move that value into the 'amount' or 'count' property of the relationship.
+4. INSTANCE PROTECTION: Never merge nodes of type 'EVENT'. Every event instance must remain unique to preserve individual historical contributions.
+"""
+
+JANITOR_AGENT_NORMALIZE_INSERTION_PROMPT = """
+Role: Normalize and Repair this single graph unit.
+
+UNIT_OF_WORK: {unit_of_work}
+
+CONTEXT_TEXT: {text}
+{targeting}
+
+INSTRUCTIONS:
+1. VALIDATE SEMANTICS: Compare the relationship label to the entities.
+ - Is it an Actor performing an Event? (Expected: Actor -> Event)
+ - Is it an Event affecting a Recipient/Target? (Expected: Event -> Target)
+2. REPAIR DIRECTION: Only swap the tail and tip if the current direction contradicts the logic of the label (e.g., if the text says "John invited friends" but the graph shows "Friends --[INVITED]--> John").
+3. PRESERVE MEANING: Do not replace one relationship type with another. If the input is 'TARGETED', keep it 'TARGETED'.
+4. UPDATE DESCRIPTION: Reflect any direction swaps or property extractions in the JSON description field.
+
+Return ONLY JSON:
+{{
+ "relationship": {{...}},
+ "virtual_node": {{...}},
+ "entity": {{...}}
+}}
+"""
+
+JANITOR_AGENT_GRAPH_NORMALIZATOR_SYSTEM_PROMPT = """
+You are the "Knowledge Graph Architect." You are responsible for Global Entity Resolution and Relational Synthesis.
+
+CORE PROTOCOLS:
+1. CO-REFERENCE RESOLUTION:
+ - Identify entities that refer to the same real-world object/event even if labels differ (e.g., "John's Wedding" vs "Mary's Wedding").
+ - Criteria for merging: Shared time, shared location, or overlapping key participants identified in the context text.
+2. RELATIONSHIP CONSOLIDATION:
+ - When merging nodes, you MUST re-map all incoming and outgoing edges to the new "Survivor" node.
+ - Avoid duplicate relationships. If Node A and Node B both had a "MADE" relationship from the same person, consolidate them into one.
+3. HIERARCHICAL LINKING:
+ - Connect specific Event instances to broader concepts (e.g., Link "John & Mary's Wedding" to the "Wedding" Concept node via an 'IS_A' relationship).
+4. DIRECTIONAL TRUTH:
+ - Ensure the Actor (Subject) -> Event -> Target (Object) chain is preserved during merges.
+"""
+
+JANITOR_AGENT_GRAPH_NORMALIZATOR_PROMPT = """
+Role: Perform Global Synthesis. You have been provided with a "Neighborhood Snapshot" of the existing Knowledge Graph relevant to the new data.
+
+CONTEXT_TEXT: {text}
+NEW_DATA_UNITS: {units}
+GRAPH_SNAPSHOT: {snapshot_json}
+
+INSTRUCTIONS:
+1. CROSS-REFERENCE: Compare entities in `NEW_DATA_UNITS` against `GRAPH_SNAPSHOT`.
+ - Look for fuzzy matches (e.g., "J. Doe" vs "John Doe").
+ - Look for situational matches (e.g., Two different 'Wedding' nodes occurring at the same 'Grand Plaza' venue on the same date).
+2. CONSOLIDATION LOGIC:
+ - If a match is found, select the most established Node ID from the `GRAPH_SNAPSHOT` as the Survivor.
+ - Map all relationships from the new units to this Survivor.
+3. REDUNDANCY CHECK:
+ - If the `GRAPH_SNAPSHOT` already contains a relationship (e.g., Mary -> MADE -> Wedding), do NOT create a duplicate edge.
+4. MISSING BRIDGES:
+ - If `John` and `Mary` are both linked to the same `Wedding` in the text, but the `GRAPH_SNAPSHOT` only shows Mary, create the missing link for John.
+
+OUTPUT:
+Return a list of tool calls: `merge_nodes`, `create_relationship`, or `update_node`.
+"""
diff --git a/src/constants/prompts/misc.py b/src/constants/prompts/misc.py
new file mode 100644
index 0000000..bc62788
--- /dev/null
+++ b/src/constants/prompts/misc.py
@@ -0,0 +1,22 @@
+"""
+File: /misc.py
+Created Date: Saturday January 3rd 2026
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Saturday January 3rd 2026 7:43:36 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+NODE_DESCRIPTION_PROMPT = """
+You are an experienced reader and analyst.
+You are given a {element_type} to describe,
+your task is to carefully read and understand the related information and provide a concise description of {element_name} (the {element_type}).
+
+The thing to describe:
+{element}
+
+Your output must only be the description of the thing above without any other text or comments.
+
+Begin!
+"""
diff --git a/src/constants/prompts/observations_agent.py b/src/constants/prompts/observations_agent.py
index bcf1df1..d392460 100644
--- a/src/constants/prompts/observations_agent.py
+++ b/src/constants/prompts/observations_agent.py
@@ -14,7 +14,7 @@ You are given a text, your task is to carefully read it and understand the meani
You think step by step and reason about the text, you must not miss any important information or hidden concepts.
-You must return the text with the hidden concepts and meanings highlighted in bold.
+You must return the text with the hidden, implicit concepts and meanings.
Text:
{text}
diff --git a/src/constants/prompts/scout_agent.py b/src/constants/prompts/scout_agent.py
new file mode 100644
index 0000000..b3638c7
--- /dev/null
+++ b/src/constants/prompts/scout_agent.py
@@ -0,0 +1,43 @@
+"""
+File: /scout_agent.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 2:56:36 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+SCOUT_AGENT_SYSTEM_PROMPT = """
+You are a "High-Recall Semantic Scout." Your goal is to decompose raw text into its fundamental building blocks: Entities, Quantities, and Events.
+
+ENTITY VS. PROPERTY LOGIC:
+- STATIC ATTRIBUTES: Things that are unique to a specific entity and do not change often (e.g., ID numbers, telephone numbers, emails, descriptive text) must be stored as PROPERTIES of that entity.
+- SHARED DIMENSIONS: Things that can be connected to multiple different entities (e.g., Currencies, Languages, Skills, Cities, Requirements) must be standalone ENTITIES.
+- DYNAMIC QUANTITIES: Do not create nodes for numbers. Identify the "Unit" (e.g., USD, Members, Hours) as an entity; the numeric value is a property to be handled by the Architect.
+
+DECISION CRITERIA:
+1. Does it change frequently? YES -> Entity.
+2. Is it shared by many entities? YES -> Entity.
+3. Is it a unique identifier or a narrative description? YES -> Property.
+"""
+
+SCOUT_AGENT_EXTRACT_ENTITIES_PROMPT = """
+Carefully read the text and extract all entities, unique action instances (events), and quantitative units.
+
+{targeting}
+
+Text: {text}
+
+OUTPUT RULES:
+- Return a JSON list of objects.
+- Each object must include: "type", "name", and optional "properties" and "description".
+- For actions (e.g., a move, a payment, an invitation), create an entity of type "EVENT".
+
+Example:
+[
+ {{"type": "ACTOR_TYPE", "name": "Unique Name", "properties": {{"key": "value"}}}},
+ {{"type": "EVENT", "name": "Action Instance Name", "description": "Context of what happened"}},
+ {{"type": "UNIT", "name": "Measurement Unit (e.g. USD, People)"}}
+]
+"""
diff --git a/src/core/agents/architect_agent.py b/src/core/agents/architect_agent.py
new file mode 100644
index 0000000..12c2c49
--- /dev/null
+++ b/src/core/agents/architect_agent.py
@@ -0,0 +1,362 @@
+"""
+File: /architect_agent.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 2:28:05 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from typing import List, Optional
+import uuid
+from langchain.agents import create_agent
+from langchain.tools import BaseTool
+from pydantic import BaseModel, Field
+import os
+from concurrent.futures import ThreadPoolExecutor, TimeoutError as FutureTimeoutError
+from tenacity import (
+ retry,
+ stop_after_attempt,
+ wait_exponential,
+ retry_if_exception_type,
+ RetryError,
+)
+from src.adapters.embeddings import EmbeddingsAdapter, VectorStoreAdapter
+from src.adapters.cache import CacheAdapter
+from src.adapters.graph import GraphAdapter
+from src.adapters.llm import LLMAdapter
+from src.constants.kg import Node
+from src.constants.prompts.architect_agent import (
+ ARCHITECT_AGENT_CREATE_RELATIONSHIPS_PROMPT,
+ ARCHITECT_AGENT_SYSTEM_PROMPT,
+)
+from src.core.agents.scout_agent import ScoutEntity
+
+# from src.core.agents.tools.kg_agent import (
+# KGAgentSearchGraphTool,
+# )
+
+
+class ArchitectAgentEntity(BaseModel):
+ """
+ Architect agent entity.
+ """
+
+ uuid: str
+ name: str
+ type: str
+
+
+class _ArchitectAgentNew(BaseModel):
+ """
+ Architect agent new entity.
+ """
+
+ temp_id: str
+ type: str
+ name: str
+ reason: str
+ properties: Optional[dict] = Field(default_factory=dict)
+ description: Optional[str] = None
+
+
+class ArchitectAgentNew(BaseModel):
+ """
+ Architect agent new entity.
+ """
+
+ uuid: str = Field(default_factory=lambda: str(uuid.uuid4()))
+ type: str
+ name: str
+ reason: str
+ properties: Optional[dict] = Field(default_factory=dict)
+ description: Optional[str] = None
+
+
+class _ArchitectAgentRelationship(BaseModel):
+ """
+ Architect agent relationship.
+ """
+
+ tip: ArchitectAgentEntity
+ name: str
+ properties: Optional[dict] = Field(default_factory=dict)
+ description: Optional[str] = None
+ tail: ArchitectAgentEntity
+
+
+class ArchitectAgentRelationship(_ArchitectAgentRelationship):
+ """
+ Architect agent relationship.
+ """
+
+ uuid: str = Field(default_factory=lambda: str(uuid.uuid4()))
+
+
+class _ArchitectAgentResponse(BaseModel):
+ """
+ Architect agent response containing the created relationships
+ between the entities.
+ """
+
+ new_nodes: List[_ArchitectAgentNew]
+ relationships: List[_ArchitectAgentRelationship]
+
+
+class ArchitectAgentResponse(BaseModel):
+ """
+ Architect agent response containing the created relationships
+ between the entities.
+ """
+
+ new_nodes: List[ArchitectAgentNew]
+ relationships: List[ArchitectAgentRelationship]
+ input_tokens: int
+ output_tokens: int
+
+
+class ArchitectAgent:
+ """
+ Architect agent.
+ """
+
+ def __init__(
+ self,
+ llm_adapter: LLMAdapter,
+ cache_adapter: CacheAdapter,
+ kg: GraphAdapter,
+ vector_store: VectorStoreAdapter,
+ embeddings: EmbeddingsAdapter,
+ # database_desc: str,
+ ):
+ self.llm_adapter = llm_adapter
+ self.cache_adapter = cache_adapter
+ self.kg = kg
+ self.vector_store = vector_store
+ self.embeddings = embeddings
+ self.agent = None
+ # self.database_desc = database_desc
+
+ def _get_tools(self, brain_id: str = "default") -> List[BaseTool]:
+ return []
+ # Currently not using the knowledge graph tools
+ # return [
+ # KGAgentSearchGraphTool(
+ # self,
+ # self.kg,
+ # self.vector_store,
+ # self.embeddings,
+ # metadata=metadata,
+ # brain_id=brain_id,
+ # ),
+ # ]
+
+ def _get_agent(
+ self,
+ tools: Optional[List[BaseTool]] = None,
+ output_schema: Optional[BaseModel] = None,
+ extra_system_prompt: Optional[dict] = None,
+ brain_id: str = "default",
+ ):
+ system_prompt = ARCHITECT_AGENT_SYSTEM_PROMPT.format(
+ extra_system_prompt=extra_system_prompt if extra_system_prompt else ""
+ )
+
+ self.agent = create_agent(
+ model=self.llm_adapter.llm.langchain_model,
+ tools=(tools if tools else self._get_tools(brain_id)),
+ system_prompt=system_prompt,
+ response_format=output_schema if output_schema else None,
+ debug=os.environ.get("DEBUG", "false").lower() == "true",
+ )
+
+ def run(
+ self,
+ text: str,
+ entities: List[ScoutEntity],
+ targeting: Optional[Node] = None,
+ brain_id: str = "default",
+ timeout: int = 90,
+ max_retries: int = 3,
+ ) -> ArchitectAgentResponse:
+ """
+ Run the architect agent.
+ """
+
+ self._get_agent(
+ output_schema=_ArchitectAgentResponse,
+ brain_id=brain_id,
+ )
+
+ self.input_tokens = 0
+ self.output_tokens = 0
+
+ def _invoke_agent(
+ ent: list[ScoutEntity], all_rels: list[ArchitectAgentRelationship]
+ ):
+ return self.agent.invoke(
+ {
+ "messages": [
+ {
+ "role": "user",
+ "content": ARCHITECT_AGENT_CREATE_RELATIONSHIPS_PROMPT.format(
+ text=text,
+ entities=[
+ entity.model_dump(mode="json") for entity in ent
+ ],
+ previously_created_relationships=(
+ f"""
+ Previously Created Relationships: {[rel.model_dump(mode="json") for rel in all_rels]}
+ """
+ if len(all_rels) > 0
+ else ""
+ ),
+ targeting=(
+ f"""
+ The information is related to the following node:
+ Name: {targeting.name}
+ UUID: {targeting.uuid}
+ Type: {targeting.labels}
+ Description: {targeting.description}
+ {targeting.properties}
+ """
+ if targeting
+ else ""
+ ),
+ ),
+ }
+ ],
+ },
+ )
+
+ def _process_response(
+ response: dict,
+ connected_entity_uuids: set,
+ all_relationships: list,
+ all_new_nodes: list,
+ entities: List[ScoutEntity],
+ ) -> set:
+ structured_response = response.get("structured_response", {})
+ iteration_connected = set()
+
+ if hasattr(structured_response, "relationships"):
+ for rel in structured_response.relationships:
+ if hasattr(rel, "tip") and hasattr(rel.tip, "uuid"):
+ tip_uuid = rel.tip.uuid
+ if any(e.uuid == tip_uuid for e in entities):
+ iteration_connected.add(tip_uuid)
+ if hasattr(rel, "tail") and hasattr(rel.tail, "uuid"):
+ tail_uuid = rel.tail.uuid
+ if any(e.uuid == tail_uuid for e in entities):
+ iteration_connected.add(tail_uuid)
+
+ if iteration_connected:
+ connected_entity_uuids.update(iteration_connected)
+ all_relationships.extend(structured_response.relationships)
+
+ if hasattr(structured_response, "new_nodes"):
+ all_new_nodes.extend(structured_response.new_nodes)
+
+ def _extract_tokens(r):
+ response_metadata = r.get("response_metadata", {})
+ token_usage = response_metadata.get("token_usage", {})
+ if token_usage:
+ return token_usage.get("prompt_tokens", 0), token_usage.get(
+ "completion_tokens", 0
+ )
+ usage_metadata = r.get("usage_metadata", {})
+ if usage_metadata:
+ return usage_metadata.get("input_tokens", 0), usage_metadata.get(
+ "output_tokens", 0
+ )
+ input_tokens = r.get("input_tokens", 0)
+ output_tokens = r.get("output_tokens", 0)
+ return input_tokens, output_tokens
+
+ it, ot = _extract_tokens(response)
+ self.input_tokens += it
+ self.output_tokens += ot
+
+ return iteration_connected
+
+ connected_entity_uuids = set()
+ all_relationships = []
+ all_new_nodes = []
+ max_iterations = 3
+ iteration = 0
+
+ @retry(
+ stop=stop_after_attempt(max_retries),
+ wait=wait_exponential(multiplier=1, min=2, max=30),
+ retry=retry_if_exception_type(TimeoutError),
+ reraise=True,
+ )
+ def _invoke_agent_with_retry(unconnected_entities_list: List[ScoutEntity]):
+ try:
+ with ThreadPoolExecutor(max_workers=1) as executor:
+ future = executor.submit(
+ _invoke_agent, unconnected_entities_list, all_relationships
+ )
+ response = future.result(timeout=timeout)
+ return response
+ except FutureTimeoutError:
+ raise TimeoutError(
+ f"Architect agent invoke timed out after {timeout} seconds. "
+ "This may indicate a network issue or the LLM service is unresponsive."
+ )
+
+ def _invoke_and_process(unconnected_entities_list: List[ScoutEntity]):
+ try:
+ response = _invoke_agent_with_retry(unconnected_entities_list)
+ return _process_response(
+ response,
+ connected_entity_uuids,
+ all_relationships,
+ all_new_nodes,
+ entities,
+ )
+ except RetryError as e:
+ last_attempt = e.last_attempt
+ raise TimeoutError(
+ f"Architect agent invoke failed after {last_attempt.attempt_number} attempts. "
+ f"Last error: {last_attempt.exception()}"
+ ) from last_attempt.exception()
+ except TimeoutError:
+ raise
+
+ unconnected_entities = [
+ entity for entity in entities if entity.uuid not in connected_entity_uuids
+ ]
+
+ while len(unconnected_entities) > 0 and iteration <= max_iterations:
+ ret = _invoke_and_process(unconnected_entities)
+ unconnected_entities = list(
+ filter(lambda e: e.uuid not in ret, unconnected_entities)
+ )
+ print("----------------------------------------------------------")
+ from pprint import pprint
+
+ pprint(unconnected_entities)
+ iteration += 1
+
+ if not all_relationships and not all_new_nodes:
+ return ArchitectAgentResponse(
+ new_nodes=[],
+ relationships=[],
+ input_tokens=self.input_tokens,
+ output_tokens=self.output_tokens,
+ )
+
+ return ArchitectAgentResponse(
+ new_nodes=[
+ ArchitectAgentNew(**new_node.model_dump(mode="json"))
+ for new_node in all_new_nodes
+ ],
+ relationships=[
+ ArchitectAgentRelationship(**relationship.model_dump(mode="json"))
+ for relationship in all_relationships
+ ],
+ input_tokens=self.input_tokens,
+ output_tokens=self.output_tokens,
+ )
diff --git a/src/core/agents/janitor_agent.py b/src/core/agents/janitor_agent.py
new file mode 100644
index 0000000..3193476
--- /dev/null
+++ b/src/core/agents/janitor_agent.py
@@ -0,0 +1,334 @@
+"""
+File: /janitor_agent.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 2:28:14 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+import os
+from typing import List, Literal, Optional, Tuple
+from langchain.agents import create_agent
+from langchain.tools import BaseTool
+from pydantic import BaseModel
+from concurrent.futures import ThreadPoolExecutor, TimeoutError as FutureTimeoutError
+from tenacity import (
+ retry,
+ stop_after_attempt,
+ wait_exponential,
+ retry_if_exception_type,
+ RetryError,
+)
+
+from src.adapters.embeddings import EmbeddingsAdapter, VectorStoreAdapter
+from src.adapters.graph import GraphAdapter
+from src.adapters.llm import LLMAdapter
+from src.constants.kg import Node
+from src.constants.prompts.janitor_agent import (
+ JANITOR_AGENT_NORMALIZE_INSERTION_PROMPT,
+ JANITOR_AGENT_SYSTEM_PROMPT,
+ JANITOR_AGENT_GRAPH_NORMALIZATOR_PROMPT,
+ JANITOR_AGENT_GRAPH_NORMALIZATOR_SYSTEM_PROMPT,
+)
+from src.core.agents.architect_agent import (
+ ArchitectAgentRelationship,
+ ArchitectAgentNew,
+)
+from src.core.agents.scout_agent import ScoutEntity
+from src.core.agents.tools.janitor_agent import (
+ JanitorAgentGetSchemaTool,
+ JanitorAgentSearchEntitiesTool,
+ JanitorAgentExecuteGraphReadOperationTool,
+ JanitorAgentExecuteGraphOperationTool,
+)
+
+
+class JanitorAgentInputOutput(BaseModel):
+ """
+ Janitor agent input and output, a single relationship or virtual node to normalize.
+ Received directly from the Architect agent.
+ """
+
+ relationship: Optional[ArchitectAgentRelationship] = None
+ virtual_node: Optional[ArchitectAgentNew] = None
+ entity: Optional[ScoutEntity] = None
+ input_tokens: Optional[int] = None
+ output_tokens: Optional[int] = None
+
+
+class JanitorAgent:
+ """
+ Janitor agent.
+ """
+
+ def __init__(
+ self,
+ llm_adapter: LLMAdapter,
+ kg: GraphAdapter,
+ vector_store: VectorStoreAdapter,
+ embeddings: EmbeddingsAdapter,
+ database_desc: str,
+ ):
+ self.llm_adapter = llm_adapter
+ self.kg = kg
+ self.vector_store = vector_store
+ self.embeddings = embeddings
+ self.agent = None
+ self.database_desc = database_desc
+
+ def _get_tools(self, brain_id: str = "default") -> List[BaseTool]:
+ return [
+ JanitorAgentGetSchemaTool(
+ self,
+ self.kg,
+ brain_id=brain_id,
+ ),
+ JanitorAgentSearchEntitiesTool(
+ self,
+ self.kg,
+ self.embeddings,
+ self.vector_store,
+ brain_id=brain_id,
+ ),
+ JanitorAgentExecuteGraphReadOperationTool(
+ self,
+ self.kg,
+ self.database_desc,
+ brain_id=brain_id,
+ ),
+ ]
+
+ def _get_agent(
+ self,
+ tools: Optional[List[BaseTool]] = None,
+ output_schema: Optional[BaseModel] = None,
+ extra_system_prompt: Optional[dict] = None,
+ brain_id: str = "default",
+ type_: str = Literal["janitor", "graph-janitor"],
+ ):
+ system_prompt = None
+ if type_ == "janitor":
+ system_prompt = JANITOR_AGENT_SYSTEM_PROMPT.format(
+ extra_system_prompt=extra_system_prompt if extra_system_prompt else ""
+ )
+ elif type_ == "graph-janitor":
+ system_prompt = JANITOR_AGENT_GRAPH_NORMALIZATOR_SYSTEM_PROMPT.format(
+ extra_system_prompt=extra_system_prompt if extra_system_prompt else ""
+ )
+ else:
+ raise ValueError(f"Invalid type: {type_}")
+
+ self.agent = create_agent(
+ model=self.llm_adapter.llm.langchain_model,
+ tools=(tools if tools else self._get_tools(brain_id)),
+ system_prompt=system_prompt,
+ response_format=output_schema if output_schema else None,
+ debug=os.environ.get("DEBUG", "false").lower() == "true",
+ )
+
+ def run_graph_normalizator(
+ self,
+ new_nodes: List[ScoutEntity | ArchitectAgentNew],
+ text: str,
+ brain_id: str = "default",
+ timeout: int = 90,
+ max_retries: int = 3,
+ ) -> Tuple[int, int]:
+ """
+ Runs a final janitor normalization across the kg snapshot
+ """
+
+ input_tokens = 0
+ output_tokens = 0
+
+ hops = self.kg.get_2nd_degree_hops(
+ [n.uuid for n in new_nodes],
+ flattened=True,
+ vector_store_adapter=self.vector_store,
+ brain_id=brain_id,
+ )
+
+ self._get_agent(
+ tools=[
+ JanitorAgentExecuteGraphOperationTool(
+ self,
+ self.kg,
+ self.database_desc,
+ brain_id=brain_id,
+ )
+ ],
+ brain_id=brain_id,
+ type_="graph-janitor",
+ )
+
+ def _invoke_agent():
+ return self.agent.invoke(
+ {
+ "messages": [
+ {
+ "role": "user",
+ "content": JANITOR_AGENT_GRAPH_NORMALIZATOR_PROMPT.format(
+ hops=hops,
+ text=text,
+ ),
+ }
+ ],
+ },
+ config={"recursion_limit": 25},
+ )
+
+ @retry(
+ stop=stop_after_attempt(max_retries),
+ wait=wait_exponential(multiplier=1, min=2, max=30),
+ retry=retry_if_exception_type(TimeoutError),
+ reraise=True,
+ )
+ def _invoke_agent_with_retry():
+ try:
+ with ThreadPoolExecutor(max_workers=1) as executor:
+ future = executor.submit(_invoke_agent)
+ response = future.result(timeout=timeout)
+ return response
+ except FutureTimeoutError:
+ raise TimeoutError(
+ f"Graph janitor normalizer agent invoke timed out after {timeout} seconds. "
+ "This may indicate a network issue or the LLM service is unresponsive."
+ )
+
+ try:
+ response = _invoke_agent_with_retry()
+ except RetryError as e:
+ last_attempt = e.last_attempt
+ raise TimeoutError(
+ f"Graph janitor normalizer agent invoke failed after {last_attempt.attempt_number} attempts. "
+ f"Last error: {last_attempt.exception()}"
+ ) from last_attempt.exception()
+ except TimeoutError:
+ raise
+
+ def _extract_tokens(r):
+ response_metadata = r.get("response_metadata", {})
+ token_usage = response_metadata.get("token_usage", {})
+ if token_usage:
+ return token_usage.get("prompt_tokens", 0), token_usage.get(
+ "completion_tokens", 0
+ )
+ usage_metadata = r.get("usage_metadata", {})
+ if usage_metadata:
+ return usage_metadata.get("input_tokens", 0), usage_metadata.get(
+ "output_tokens", 0
+ )
+ input_tokens = r.get("input_tokens", 0)
+ output_tokens = r.get("output_tokens", 0)
+ return input_tokens, output_tokens
+
+ input_tokens, output_tokens = _extract_tokens(response)
+ return input_tokens, output_tokens
+
+ def run(
+ self,
+ input_output: JanitorAgentInputOutput,
+ text: str,
+ targeting: Optional[Node] = None,
+ brain_id: str = "default",
+ timeout: int = 90,
+ max_retries: int = 3,
+ ) -> JanitorAgentInputOutput:
+ """
+ Run the janitor agent.
+ """
+
+ self._get_agent(
+ output_schema=JanitorAgentInputOutput, brain_id=brain_id, type_="janitor"
+ )
+
+ def _invoke_agent():
+ return self.agent.invoke(
+ {
+ "messages": [
+ {
+ "role": "user",
+ "content": JANITOR_AGENT_NORMALIZE_INSERTION_PROMPT.format(
+ unit_of_work=input_output.model_dump_json(),
+ text=text,
+ targeting=(
+ f"""
+ The information is related to:
+ "{targeting.name}": {targeting.description}
+ {targeting.properties}
+ """
+ if targeting
+ else ""
+ ),
+ ),
+ }
+ ],
+ },
+ config={"recursion_limit": 25},
+ )
+
+ @retry(
+ stop=stop_after_attempt(max_retries),
+ wait=wait_exponential(multiplier=1, min=2, max=30),
+ retry=retry_if_exception_type(TimeoutError),
+ reraise=True,
+ )
+ def _invoke_agent_with_retry():
+ try:
+ with ThreadPoolExecutor(max_workers=1) as executor:
+ future = executor.submit(_invoke_agent)
+ response = future.result(timeout=timeout)
+ return response
+ except FutureTimeoutError:
+ raise TimeoutError(
+ f"Janitor agent invoke timed out after {timeout} seconds. "
+ "This may indicate a network issue or the LLM service is unresponsive."
+ )
+
+ try:
+ response = _invoke_agent_with_retry()
+ except RetryError as e:
+ last_attempt = e.last_attempt
+ raise TimeoutError(
+ f"Janitor agent invoke failed after {last_attempt.attempt_number} attempts. "
+ f"Last error: {last_attempt.exception()}"
+ ) from last_attempt.exception()
+ except TimeoutError:
+ raise
+
+ def _extract_tokens(r):
+ response_metadata = r.get("response_metadata", {})
+ token_usage = response_metadata.get("token_usage", {})
+ if token_usage:
+ return token_usage.get("prompt_tokens", 0), token_usage.get(
+ "completion_tokens", 0
+ )
+ usage_metadata = r.get("usage_metadata", {})
+ if usage_metadata:
+ return usage_metadata.get("input_tokens", 0), usage_metadata.get(
+ "output_tokens", 0
+ )
+ input_tokens = r.get("input_tokens", 0)
+ output_tokens = r.get("output_tokens", 0)
+ return input_tokens, output_tokens
+
+ input_tokens, output_tokens = _extract_tokens(response)
+ structured_response = response.get("structured_response")
+ if structured_response:
+ return JanitorAgentInputOutput(
+ relationship=structured_response.relationship,
+ virtual_node=structured_response.virtual_node,
+ entity=structured_response.entity,
+ input_tokens=input_tokens,
+ output_tokens=output_tokens,
+ )
+ else:
+ return JanitorAgentInputOutput(
+ relationship=None,
+ virtual_node=None,
+ entity=None,
+ input_tokens=input_tokens,
+ output_tokens=output_tokens,
+ )
diff --git a/src/core/agents/scout_agent.py b/src/core/agents/scout_agent.py
new file mode 100644
index 0000000..e8388d4
--- /dev/null
+++ b/src/core/agents/scout_agent.py
@@ -0,0 +1,210 @@
+"""
+File: /scout_agent.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 2:27:56 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from typing import List, Optional
+import uuid
+from langchain.agents import create_agent
+from langchain.tools import BaseTool
+from pydantic import BaseModel, Field
+import os
+from concurrent.futures import ThreadPoolExecutor, TimeoutError as FutureTimeoutError
+from tenacity import (
+ retry,
+ stop_after_attempt,
+ wait_exponential,
+ retry_if_exception_type,
+ RetryError,
+)
+from src.adapters.embeddings import EmbeddingsAdapter, VectorStoreAdapter
+from src.adapters.cache import CacheAdapter
+from src.adapters.graph import GraphAdapter
+from src.adapters.llm import LLMAdapter
+from src.constants.kg import Node
+from src.constants.prompts.scout_agent import (
+ SCOUT_AGENT_EXTRACT_ENTITIES_PROMPT,
+ SCOUT_AGENT_SYSTEM_PROMPT,
+)
+
+
+class _ScoutEntity(BaseModel):
+ """
+ Scout entity.
+ """
+
+ type: str
+ name: str
+ properties: Optional[dict] = Field(default_factory=dict)
+ description: Optional[str] = None
+
+
+class ScoutEntity(_ScoutEntity):
+ """
+ Scout entity.
+ """
+
+ uuid: str = Field(default_factory=lambda: str(uuid.uuid4()))
+
+
+class _ScoutAgentResponse(BaseModel):
+ """
+ Scout agent response containing the extracted entities.
+ """
+
+ entities: List[_ScoutEntity]
+
+
+class ScoutAgentResponse(BaseModel):
+ """
+ Scout agent response containing the extracted entities (subjects and objects)
+ from the text with their properties.
+ """
+
+ entities: List[ScoutEntity]
+ input_tokens: int
+ output_tokens: int
+
+
+class ScoutAgent:
+ """
+ Scout agent.
+ """
+
+ def __init__(
+ self,
+ llm_adapter: LLMAdapter,
+ cache_adapter: CacheAdapter,
+ kg: GraphAdapter,
+ vector_store: VectorStoreAdapter,
+ embeddings: EmbeddingsAdapter,
+ ):
+ self.llm_adapter = llm_adapter
+ self.cache_adapter = cache_adapter
+ self.kg = kg
+ self.vector_store = vector_store
+ self.embeddings = embeddings
+ self.agent = None
+
+ def _get_tools(self, brain_id: str = "default") -> List[BaseTool]:
+ return []
+
+ def _get_agent(
+ self,
+ tools: Optional[List[BaseTool]] = None,
+ output_schema: Optional[BaseModel] = None,
+ extra_system_prompt: Optional[dict] = None,
+ brain_id: str = "default",
+ ):
+ system_prompt = SCOUT_AGENT_SYSTEM_PROMPT.format(
+ extra_system_prompt=extra_system_prompt if extra_system_prompt else ""
+ )
+
+ self.agent = create_agent(
+ model=self.llm_adapter.llm.langchain_model,
+ tools=(tools if tools else self._get_tools(brain_id)),
+ system_prompt=system_prompt,
+ response_format=output_schema if output_schema else None,
+ debug=os.environ.get("DEBUG", "false").lower() == "true",
+ )
+
+ def run(
+ self,
+ text: str,
+ targeting: Optional[Node] = None,
+ brain_id: str = "default",
+ timeout: int = 90,
+ max_retries: int = 3,
+ ) -> ScoutAgentResponse:
+ """
+ Run the scout agent.
+ """
+
+ self._get_agent(
+ output_schema=_ScoutAgentResponse,
+ brain_id=brain_id,
+ )
+
+ def _invoke_agent():
+ return self.agent.invoke(
+ {
+ "messages": [
+ {
+ "role": "user",
+ "content": SCOUT_AGENT_EXTRACT_ENTITIES_PROMPT.format(
+ text=text,
+ targeting=(
+ f"""
+ The information is related to:
+ "{targeting.name}": {targeting.description}
+ {targeting.properties}
+ """
+ if targeting
+ else ""
+ ),
+ ),
+ }
+ ],
+ },
+ )
+
+ @retry(
+ stop=stop_after_attempt(max_retries),
+ wait=wait_exponential(multiplier=1, min=2, max=30),
+ retry=retry_if_exception_type(TimeoutError),
+ reraise=True,
+ )
+ def _invoke_agent_with_retry():
+ try:
+ with ThreadPoolExecutor(max_workers=1) as executor:
+ future = executor.submit(_invoke_agent)
+ response = future.result(timeout=timeout)
+ return response
+ except FutureTimeoutError:
+ raise TimeoutError(
+ f"Scout agent invoke timed out after {timeout} seconds. "
+ "This may indicate a network issue or the LLM service is unresponsive."
+ )
+
+ try:
+ response = _invoke_agent_with_retry()
+ except RetryError as e:
+ last_attempt = e.last_attempt
+ raise TimeoutError(
+ f"Scout agent invoke failed after {last_attempt.attempt_number} attempts. "
+ f"Last error: {last_attempt.exception()}"
+ ) from last_attempt.exception()
+ except TimeoutError:
+ raise
+
+ def _extract_tokens(r):
+ response_metadata = r.get("response_metadata", {})
+ token_usage = response_metadata.get("token_usage", {})
+ if token_usage:
+ return token_usage.get("prompt_tokens", 0), token_usage.get(
+ "completion_tokens", 0
+ )
+ usage_metadata = r.get("usage_metadata", {})
+ if usage_metadata:
+ return usage_metadata.get("input_tokens", 0), usage_metadata.get(
+ "output_tokens", 0
+ )
+ input_tokens = r.get("input_tokens", 0)
+ output_tokens = r.get("output_tokens", 0)
+ return input_tokens, output_tokens
+
+ input_tokens, output_tokens = _extract_tokens(response)
+
+ return ScoutAgentResponse(
+ entities=[
+ ScoutEntity(**entity.model_dump(mode="json"))
+ for entity in response.get("structured_response", []).entities
+ ],
+ input_tokens=input_tokens,
+ output_tokens=output_tokens,
+ )
diff --git a/src/core/agents/temporal_agent.py b/src/core/agents/temporal_agent.py
new file mode 100644
index 0000000..2678101
--- /dev/null
+++ b/src/core/agents/temporal_agent.py
@@ -0,0 +1,9 @@
+"""
+File: /temporal_agent.py
+Created Date: Sunday January 4th 2026
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday January 4th 2026 6:14:27 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/core/agents/tools/janitor_agent/JanitorAgentExecuteGraphOperationTool.py b/src/core/agents/tools/janitor_agent/JanitorAgentExecuteGraphOperationTool.py
new file mode 100644
index 0000000..5917e82
--- /dev/null
+++ b/src/core/agents/tools/janitor_agent/JanitorAgentExecuteGraphOperationTool.py
@@ -0,0 +1,74 @@
+"""
+File: /JanitorAgentExecuteGraphOperationTool.py
+Created Date: Friday January 2nd 2026
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Friday January 2nd 2026 11:42:24 am
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from langchain.tools import BaseTool
+
+from src.adapters.graph import GraphAdapter
+
+
+class JanitorAgentExecuteGraphOperationTool(BaseTool):
+ """
+ Tool for executing a graph operation.
+ """
+
+ name: str = "execute_graph_read_operation"
+
+ janitor_agent: object
+ kg: GraphAdapter
+ brain_id: str = "default"
+
+ args_schema: dict = {
+ "type": "object",
+ "properties": {
+ "query": {
+ "type": "string",
+ "description": "The query to execute on the knowledge graph. Should be a valid graph read only operation depending on the graph database type.",
+ },
+ },
+ "required": ["query"],
+ }
+
+ def __init__(
+ self,
+ janitor_agent,
+ kg: GraphAdapter,
+ database_desc: str,
+ brain_id: str = "default",
+ ):
+ description: str = (
+ "Tool for executing read only operations on the knowledge graph. "
+ "Use this tool to read information from the knowledge graph. "
+ "The query should be a valid graph read only operation depending on the graph database type."
+ "The query should be a valid JSON object with a 'query' key. "
+ "{database_desc}."
+ "If you get an error, try again after fixing your query and don't give up. "
+ "If you get a result, return the result as a JSON object."
+ )
+ formatted_description = description.format(database_desc=database_desc)
+ super().__init__(
+ janitor_agent=janitor_agent,
+ kg=kg,
+ description=formatted_description,
+ brain_id=brain_id,
+ )
+
+ def _run(self, *args, **kwargs) -> str:
+ _query = ""
+ if len(args) > 0:
+ _query = args[0]
+ else:
+ _query = kwargs.get("query", "")
+
+ if len(_query) == 0:
+ return "No query provided in the arguments or kwargs"
+
+ response = self.kg.execute_operation(_query, brain_id=self.brain_id)
+
+ return response
diff --git a/src/core/agents/tools/janitor_agent/JanitorAgentExecuteGraphReadOperationTool.py b/src/core/agents/tools/janitor_agent/JanitorAgentExecuteGraphReadOperationTool.py
new file mode 100644
index 0000000..181c7cd
--- /dev/null
+++ b/src/core/agents/tools/janitor_agent/JanitorAgentExecuteGraphReadOperationTool.py
@@ -0,0 +1,74 @@
+"""
+File: /JanitorAgentExecuteGraphReadOperationTool.py
+Created Date: Wednesday December 24th 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Wednesday December 24th 2025 9:26:30 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from langchain.tools import BaseTool
+
+from src.adapters.graph import GraphAdapter
+
+
+class JanitorAgentExecuteGraphReadOperationTool(BaseTool):
+ """
+ Tool for executing a graph read only operation.
+ """
+
+ name: str = "execute_graph_read_operation"
+
+ janitor_agent: object
+ kg: GraphAdapter
+ brain_id: str = "default"
+
+ args_schema: dict = {
+ "type": "object",
+ "properties": {
+ "query": {
+ "type": "string",
+ "description": "The query to execute on the knowledge graph. Should be a valid graph read only operation depending on the graph database type.",
+ },
+ },
+ "required": ["query"],
+ }
+
+ def __init__(
+ self,
+ janitor_agent,
+ kg: GraphAdapter,
+ database_desc: str,
+ brain_id: str = "default",
+ ):
+ description: str = (
+ "Tool for executing read only operations on the knowledge graph. "
+ "Use this tool to read information from the knowledge graph. "
+ "The query should be a valid graph read only operation depending on the graph database type."
+ "The query should be a valid JSON object with a 'query' key. "
+ "{database_desc}."
+ "If you get an error, try again after fixing your query and don't give up. "
+ "If you get a result, return the result as a JSON object."
+ )
+ formatted_description = description.format(database_desc=database_desc)
+ super().__init__(
+ janitor_agent=janitor_agent,
+ kg=kg,
+ description=formatted_description,
+ brain_id=brain_id,
+ )
+
+ def _run(self, *args, **kwargs) -> str:
+ _query = ""
+ if len(args) > 0:
+ _query = args[0]
+ else:
+ _query = kwargs.get("query", "")
+
+ if len(_query) == 0:
+ return "No query provided in the arguments or kwargs"
+
+ response = self.kg.execute_operation(_query, brain_id=self.brain_id)
+
+ return response
diff --git a/src/core/agents/tools/janitor_agent/JanitorAgentGetSchemaTool.py b/src/core/agents/tools/janitor_agent/JanitorAgentGetSchemaTool.py
new file mode 100644
index 0000000..bc81a21
--- /dev/null
+++ b/src/core/agents/tools/janitor_agent/JanitorAgentGetSchemaTool.py
@@ -0,0 +1,67 @@
+"""
+File: /get_schema.py
+Created Date: Tuesday December 23rd 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Tuesday December 23rd 2025 11:07:15 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+import json
+from langchain.tools import BaseTool
+
+from src.adapters.graph import GraphAdapter
+
+
+class JanitorAgentGetSchemaTool(BaseTool):
+ """
+ Tool for getting the schema of the knowledge graph.
+ """
+
+ name: str = "get_schema"
+ janitor_agent: object
+ kg: GraphAdapter
+ brain_id: str = "default"
+
+ args_schema: dict = {
+ "type": "object",
+ "properties": {
+ "target": {
+ "type": "string",
+ "description": "The target to get the schema of. (node_labels or relationship_types)",
+ "enum": ["node_labels", "relationship_types"],
+ },
+ },
+ "required": ["target"],
+ }
+
+ def __init__(
+ self,
+ janitor_agent,
+ kg: GraphAdapter,
+ brain_id: str = "default",
+ ):
+ description: str = (
+ "Tool for getting the schema of the knowledge graph. "
+ "This tool will return the schema/ontology of the knowledge graph."
+ )
+ super().__init__(
+ janitor_agent=janitor_agent,
+ kg=kg,
+ description=description,
+ brain_id=brain_id,
+ )
+
+ def _run(self, *args, **kwargs) -> str:
+ _target = kwargs.get("target", "node_labels").lower()
+
+ schema_result = self.kg.get_schema(brain_id=self.brain_id)
+
+ if _target == "node_labels":
+ labels = schema_result.get("labels", [])
+ return json.dumps(labels, indent=4)
+ elif _target == "relationship_types":
+ relationships = schema_result.get("relationships", [])
+ return json.dumps(relationships, indent=4)
+ return "Invalid target parameter. It must be either 'node_labels' or 'relationship_types'"
diff --git a/src/core/agents/tools/janitor_agent/JanitorAgentSearchEntitiesTool.py b/src/core/agents/tools/janitor_agent/JanitorAgentSearchEntitiesTool.py
new file mode 100644
index 0000000..0446978
--- /dev/null
+++ b/src/core/agents/tools/janitor_agent/JanitorAgentSearchEntitiesTool.py
@@ -0,0 +1,109 @@
+"""
+File: /JanitorAgentSearchEntitiesTool.py
+Created Date: Tuesday December 23rd 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Tuesday December 23rd 2025 11:21:54 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+import json
+from typing import List
+from langchain.tools import BaseTool
+
+from src.adapters.embeddings import EmbeddingsAdapter, VectorStoreAdapter
+from src.adapters.graph import GraphAdapter
+from src.constants.kg import Node
+
+
+class JanitorAgentSearchEntitiesTool(BaseTool):
+ """
+ Tool for searching the entities of the knowledge graph.
+ """
+
+ name: str = "search_entities"
+ janitor_agent: object
+ kg: GraphAdapter
+ embeddings: EmbeddingsAdapter
+ vector_store: VectorStoreAdapter
+ brain_id: str = "default"
+
+ args_schema: dict = {
+ "type": "object",
+ "properties": {
+ "query": {
+ "type": "string",
+ "description": "The plain text query to search for entities in the knowledge graph within their names.",
+ },
+ },
+ "required": ["query"],
+ }
+
+ def __init__(
+ self,
+ janitor_agent,
+ kg: GraphAdapter,
+ embeddings: EmbeddingsAdapter,
+ vector_store: VectorStoreAdapter,
+ brain_id: str = "default",
+ ):
+ description: str = (
+ "Tool for searching the entities of the knowledge graph by plain text name. "
+ "This tool will return the entities that were found in the knowledge graph."
+ "Example input: { 'query': 'John Doe' }"
+ )
+ super().__init__(
+ janitor_agent=janitor_agent,
+ kg=kg,
+ embeddings=embeddings,
+ vector_store=vector_store,
+ description=description,
+ brain_id=brain_id,
+ )
+
+ def _run(self, *args, **kwargs) -> str:
+ _query = ""
+ if len(args) > 0:
+ _query = args[0]
+ else:
+ _query = kwargs.get("query", "")
+
+ if len(_query) == 0:
+ return "No query provided in the arguments or kwargs"
+
+ kg_results = self.kg.search_entities(brain_id=self.brain_id, query_text=_query)
+
+ found_entities: List[Node] = []
+
+ for kg_result in kg_results.results:
+ found_entities.append(kg_result)
+
+ try:
+ query_vector = self.embeddings.embed_text(_query)
+ if query_vector.embeddings and len(query_vector.embeddings) > 0:
+ v_results = self.vector_store.search_vectors(
+ query_vector.embeddings,
+ store="nodes",
+ brain_id=self.brain_id,
+ )
+ if len(v_results) > 0:
+ found_entities.extend(
+ self.kg.get_nodes_by_uuid(
+ [
+ v_result.metadata.get("uuid")
+ for v_result in v_results
+ if v_result.metadata.get("uuid") is not None
+ ],
+ brain_id=self.brain_id,
+ )
+ )
+ except Exception as e:
+ print(f"Vector search failed, using KG results only: {e}")
+
+ if len(found_entities) == 0:
+ return "Knowledge graph does not contain any entities that match the query"
+
+ return json.dumps(
+ [entity.model_dump(mode="json") for entity in found_entities], indent=4
+ )
diff --git a/src/core/agents/tools/janitor_agent/__init__.py b/src/core/agents/tools/janitor_agent/__init__.py
new file mode 100644
index 0000000..4061f44
--- /dev/null
+++ b/src/core/agents/tools/janitor_agent/__init__.py
@@ -0,0 +1,23 @@
+"""
+File: /__init__.py
+Created Date: Tuesday December 23rd 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Tuesday December 23rd 2025 11:07:06 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from .JanitorAgentGetSchemaTool import JanitorAgentGetSchemaTool
+from .JanitorAgentSearchEntitiesTool import JanitorAgentSearchEntitiesTool
+from .JanitorAgentExecuteGraphOperationTool import JanitorAgentExecuteGraphOperationTool
+from .JanitorAgentExecuteGraphReadOperationTool import (
+ JanitorAgentExecuteGraphReadOperationTool,
+)
+
+__all__ = [
+ "JanitorAgentGetSchemaTool",
+ "JanitorAgentSearchEntitiesTool",
+ "JanitorAgentExecuteGraphReadOperationTool",
+ "JanitorAgentExecuteGraphOperationTool",
+]
diff --git a/src/core/agents/validator_agent.py b/src/core/agents/validator_agent.py
new file mode 100644
index 0000000..f2efcf5
--- /dev/null
+++ b/src/core/agents/validator_agent.py
@@ -0,0 +1,9 @@
+"""
+File: /validator_agent.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 2:28:22 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/core/files/__init__.py b/src/core/files/__init__.py
new file mode 100644
index 0000000..486c559
--- /dev/null
+++ b/src/core/files/__init__.py
@@ -0,0 +1,9 @@
+"""
+File: /__init__.py
+Created Date: Saturday December 13th 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Saturday December 13th 2025 8:44:20 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/core/layers/__init__.py b/src/core/layers/__init__.py
new file mode 100644
index 0000000..4f9e46f
--- /dev/null
+++ b/src/core/layers/__init__.py
@@ -0,0 +1,9 @@
+"""
+File: /__init__.py
+Created Date: Wednesday December 31st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Wednesday December 31st 2025 12:21:53 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/core/layers/errors/__init__.py b/src/core/layers/errors/__init__.py
new file mode 100644
index 0000000..a0cf96e
--- /dev/null
+++ b/src/core/layers/errors/__init__.py
@@ -0,0 +1,9 @@
+"""
+File: /__init__.py
+Created Date: Wednesday December 31st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Wednesday December 31st 2025 12:22:04 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/core/layers/errors/cypher_operations.py b/src/core/layers/errors/cypher_operations.py
new file mode 100644
index 0000000..0fc9bba
--- /dev/null
+++ b/src/core/layers/errors/cypher_operations.py
@@ -0,0 +1,9 @@
+"""
+File: /cypher_operations.py
+Created Date: Wednesday December 31st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Wednesday December 31st 2025 12:22:14 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/core/saving/__init__.py b/src/core/saving/__init__.py
new file mode 100644
index 0000000..3d3477c
--- /dev/null
+++ b/src/core/saving/__init__.py
@@ -0,0 +1,9 @@
+"""
+File: /__init__.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 2:26:49 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/core/saving/auto_kg.py b/src/core/saving/auto_kg.py
new file mode 100644
index 0000000..f8d578d
--- /dev/null
+++ b/src/core/saving/auto_kg.py
@@ -0,0 +1,266 @@
+"""
+File: /auto_kg.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 2:29:01 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from concurrent.futures import ThreadPoolExecutor, TimeoutError as FutureTimeoutError
+from typing import Optional
+
+from src.adapters.embeddings import EmbeddingsAdapter, VectorStoreAdapter
+from src.adapters.graph import GraphAdapter
+from src.constants.kg import Node, Predicate
+from src.core.agents.janitor_agent import JanitorAgentInputOutput
+from src.core.agents.scout_agent import ScoutEntity
+from src.core.agents.architect_agent import ArchitectAgentRelationship
+from src.services.input.agents import (
+ embeddings_adapter,
+ graph_adapter,
+ janitor_agent,
+ scout_agent,
+ architect_agent,
+ vector_store_adapter,
+)
+
+
+class IngestionManager:
+ def __init__(
+ self,
+ embeddings_adapter: EmbeddingsAdapter,
+ vector_store_adapter: VectorStoreAdapter,
+ graph_adapter: GraphAdapter,
+ ):
+ self.embeddings = embeddings_adapter
+ self.vector_store = vector_store_adapter
+ self.kg = graph_adapter
+ self.resolved_cache = {}
+
+ def process_node_vectors(self, node_data: ScoutEntity, brain_id):
+ if node_data.name in self.resolved_cache:
+ node_data.uuid = self.resolved_cache[node_data.name]
+ return node_data.uuid
+
+ v_sub = self.embeddings.embed_text(node_data.name)
+ v_sub.metadata = {
+ "labels": [node_data.type],
+ "name": node_data.name,
+ "uuid": node_data.uuid,
+ }
+ if v_sub.embeddings:
+ v_ids = self.vector_store.add_vectors(
+ [v_sub], store="nodes", brain_id=brain_id
+ )
+ node_data.properties = {
+ **(node_data.properties or {}),
+ "v_id": v_ids[0],
+ }
+ self.resolved_cache[node_data.name] = v_ids[0]
+ return node_data.uuid
+ else:
+ print("[ ! ]Node not embedded:", node_data)
+ return node_data.uuid
+
+ def process_rel_vectors(self, rel_data: ArchitectAgentRelationship, brain_id):
+ if hasattr(rel_data, "description") and rel_data.description:
+ v_rel = self.embeddings.embed_text(rel_data.description)
+ v_rel.id = rel_data.uuid
+ v_rel.metadata = {
+ **(self.metadata or {}),
+ "uuid": rel_data.uuid,
+ "node_ids": [rel_data.tail.uuid, rel_data.tip.uuid],
+ "predicate": rel_data.name,
+ }
+ if v_rel.embeddings:
+ v_ids = self.vector_store.add_vectors(
+ [v_rel], store="relationships", brain_id=brain_id
+ )
+ rel_data.properties = {
+ **(rel_data.properties or {}),
+ "v_id": v_ids[0],
+ }
+ else:
+ print("[ ! ]Relationship not embedded:", rel_data)
+ return rel_data.uuid
+
+
+def enrich_kg_from_input(
+ input: str, targeting: Optional[Node] = None, brain_id: str = "default"
+) -> str:
+ """
+ Enrich the knowledge graph from the input.
+ """
+
+ input_tokens = 0
+ output_tokens = 0
+
+ manager = IngestionManager(embeddings_adapter, vector_store_adapter, graph_adapter)
+
+ entities = scout_agent.run(input, targeting=targeting, brain_id=brain_id)
+ input_tokens += entities.input_tokens
+ output_tokens += entities.output_tokens
+ # logtable(
+ # [entity.model_dump(mode="json") for entity in entities.entities],
+ # title="Entities",
+ # )
+
+ architect_response = architect_agent.run(
+ input, entities.entities, targeting=targeting, brain_id=brain_id
+ )
+ input_tokens += architect_response.input_tokens
+ output_tokens += architect_response.output_tokens
+ # logtable(
+ # [new_node.model_dump(mode="json") for new_node in architect_response.new_nodes],
+ # title="New Nodes",
+ # )
+ # logtable(
+ # [
+ # relationship.model_dump(mode="json")
+ # for relationship in architect_response.relationships
+ # ],
+ # title="Relationships",
+ # )
+
+ normalized_entities = []
+ normalized_virtual_nodes = []
+ normalized_relationships = []
+
+ with ThreadPoolExecutor(max_workers=10) as executor:
+ entity_futures = [
+ executor.submit(
+ janitor_agent.run,
+ JanitorAgentInputOutput(entity=entity),
+ text=input,
+ targeting=targeting,
+ brain_id=brain_id,
+ )
+ for entity in entities.entities
+ ]
+
+ virtual_node_futures = [
+ executor.submit(
+ janitor_agent.run,
+ JanitorAgentInputOutput(virtual_node=new_node),
+ text=input,
+ targeting=targeting,
+ brain_id=brain_id,
+ )
+ for new_node in architect_response.new_nodes
+ ]
+
+ all_futures = list(entity_futures) + list(virtual_node_futures)
+
+ for future in all_futures:
+ try:
+ normalized_result = future.result(timeout=90)
+ input_tokens += normalized_result.input_tokens or 0
+ output_tokens += normalized_result.output_tokens or 0
+ if normalized_result.entity:
+ normalized_entities.append(normalized_result.entity)
+ elif normalized_result.virtual_node:
+ normalized_virtual_nodes.append(normalized_result.virtual_node)
+ else:
+ print("Entity/Virtual node not normalized:", normalized_result)
+ except FutureTimeoutError:
+ print(
+ "[!] Janitor agent entity/virtual_node future timed out, skipping"
+ )
+ continue
+ except Exception as e:
+ print(f"[!] Janitor agent entity/virtual_node future failed: {e}")
+ continue
+
+ relationship_futures = [
+ executor.submit(
+ janitor_agent.run,
+ JanitorAgentInputOutput(relationship=relationship),
+ text=input,
+ targeting=targeting,
+ brain_id=brain_id,
+ )
+ for relationship in architect_response.relationships
+ ]
+
+ for future in relationship_futures:
+ try:
+ normalized_result = future.result(timeout=90)
+ input_tokens += normalized_result.input_tokens or 0
+ output_tokens += normalized_result.output_tokens or 0
+ if normalized_result.relationship:
+ normalized_relationships.append(normalized_result.relationship)
+ else:
+ print("Relationship not normalized:", normalized_result)
+ except FutureTimeoutError:
+ print("[!] Janitor agent relationship future timed out, skipping")
+ continue
+ except Exception as e:
+ print(f"[!] Janitor agent relationship future failed: {e}")
+ continue
+
+ graph_nodes = []
+
+ with ThreadPoolExecutor(max_workers=10) as io_executor:
+ node_embedding_futures = []
+
+ for entity in normalized_entities:
+ future = io_executor.submit(manager.process_node_vectors, entity, brain_id)
+ node_embedding_futures.append((future, entity))
+
+ for virtual_node in normalized_virtual_nodes:
+ future = io_executor.submit(
+ manager.process_node_vectors, virtual_node, brain_id
+ )
+ node_embedding_futures.append((future, virtual_node))
+
+ for future, node_data in node_embedding_futures:
+ try:
+ future.result(timeout=60)
+ graph_nodes.append(
+ Node(
+ uuid=node_data.uuid,
+ labels=[node_data.type],
+ name=node_data.name,
+ description=node_data.description,
+ properties=node_data.properties,
+ )
+ )
+ except FutureTimeoutError:
+ print(
+ f"[!] Node embedding future timed out for {node_data.name}, skipping"
+ )
+ continue
+ except Exception as e:
+ print(f"[!] Node embedding future failed for {node_data.name}: {e}")
+ continue
+
+ graph_adapter.add_nodes(graph_nodes, brain_id=brain_id)
+
+ for relationship in normalized_relationships:
+ io_executor.submit(manager.process_rel_vectors, relationship, brain_id)
+ graph_adapter.add_relationship(
+ Node(
+ uuid=relationship.tail.uuid,
+ labels=[relationship.tail.type],
+ name=relationship.tail.name,
+ ),
+ Predicate(
+ uuid=relationship.uuid,
+ name=relationship.name,
+ description=relationship.description,
+ properties=relationship.properties,
+ ),
+ Node(
+ uuid=relationship.tip.uuid,
+ labels=[relationship.tip.type],
+ name=relationship.tip.name,
+ ),
+ brain_id=brain_id,
+ )
+
+ print("-----------------------------------")
+ print("> Input tokens: ", input_tokens)
+ print("> Output tokens: ", output_tokens)
+ print("-----------------------------------")
diff --git a/src/lib/embeddings/client.py b/src/lib/embeddings/client.py
index eaa4353..2268a5c 100644
--- a/src/lib/embeddings/client.py
+++ b/src/lib/embeddings/client.py
@@ -11,11 +11,25 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
import requests
import base64
import struct
+from tenacity import (
+ retry,
+ stop_after_attempt,
+ wait_exponential,
+ retry_if_exception_type,
+ RetryError,
+)
+from requests.exceptions import ConnectionError, Timeout, RequestException
from src.config import config
from src.adapters.interfaces.embeddings import EmbeddingsClient
+class EmbeddingError(Exception):
+ """Custom exception for embedding failures after retries."""
+
+ pass
+
+
class EmbeddingsClient(EmbeddingsClient):
"""
Embeddings client.
@@ -24,27 +38,58 @@ class EmbeddingsClient(EmbeddingsClient):
def __init__(self):
self.embeddings = None
+ @retry(
+ stop=stop_after_attempt(5),
+ wait=wait_exponential(multiplier=1, min=2, max=30),
+ retry=retry_if_exception_type((ConnectionError, Timeout)),
+ reraise=False,
+ )
+ def _embed_text_with_retry(self, text: str) -> list[float]:
+ """
+ Internal method to embed text with retry logic for network errors.
+ """
+ response = requests.post(
+ config.azure.embedding_full_endpoint,
+ json={"input": [text], "encoding_format": "base64"},
+ headers={
+ "api-key": config.azure.embedding_key,
+ "Content-Type": "application/json",
+ },
+ timeout=60.0,
+ )
+ response.raise_for_status()
+ _b64_result = response.json()["data"][0]["embedding"]
+ decoded_bytes = base64.b64decode(_b64_result)
+ result = list(struct.unpack(f"<{len(decoded_bytes)//4}f", decoded_bytes))
+ return result
+
def embed_text(self, text: str) -> list[float]:
"""
Embed a text and return a list of floats.
+ Handles connection errors with retry logic.
"""
try:
- response = requests.post(
- config.azure.embedding_full_endpoint,
- json={"input": [text], "encoding_format": "base64"},
- headers={
- "api-key": config.azure.embedding_key,
- "Content-Type": "application/json",
- },
- timeout=60.0,
+ return self._embed_text_with_retry(text)
+ except RetryError as e:
+ last_attempt = e.last_attempt
+ error_msg = (
+ f"Embedding failed after {last_attempt.attempt_number} attempts. "
+ f"Last error: {last_attempt.exception()}"
)
- _b64_result = response.json()["data"][0]["embedding"]
- decoded_bytes = base64.b64decode(_b64_result)
- result = list(struct.unpack(f"<{len(decoded_bytes)//4}f", decoded_bytes))
- return result
+ print(f"Embedding encoding failed: {error_msg}")
+ raise EmbeddingError(error_msg) from last_attempt.exception()
+ except (ConnectionError, Timeout) as e:
+ error_msg = f"Network error during embedding: {e}"
+ print(f"Embedding encoding failed: {error_msg}")
+ raise EmbeddingError(error_msg) from e
+ except RequestException as e:
+ error_msg = f"Request error during embedding: {e}"
+ print(f"Embedding encoding failed: {error_msg}")
+ raise EmbeddingError(error_msg) from e
except Exception as e:
- print(f"Embedding encoding failed: {e}")
- raise
+ error_msg = f"Unexpected error during embedding: {e}"
+ print(f"Embedding encoding failed: {error_msg}")
+ raise EmbeddingError(error_msg) from e
_embeddings_client = EmbeddingsClient()
diff --git a/src/lib/embeddings/client_small.py b/src/lib/embeddings/client_small.py
new file mode 100644
index 0000000..c91bb03
--- /dev/null
+++ b/src/lib/embeddings/client_small.py
@@ -0,0 +1,25 @@
+"""
+File: /client_small.py
+Created Date: Wednesday December 31st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Wednesday December 31st 2025 9:55:46 am
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from sentence_transformers import SentenceTransformer
+
+from src.adapters.interfaces.embeddings import EmbeddingsClient
+from src.config import config
+
+_model = SentenceTransformer(config.embeddings.small_model)
+
+
+class EmbeddingsClientSmall(EmbeddingsClient):
+ def __init__(self):
+ self.model = _model
+
+ def embed_text(self, text: str) -> list[float]:
+ embedding = self.model.encode(text, convert_to_numpy=True)
+ return embedding.tolist()
diff --git a/src/lib/llm/client_large.py b/src/lib/llm/client_large.py
index b2c2840..fd080e7 100644
--- a/src/lib/llm/client_large.py
+++ b/src/lib/llm/client_large.py
@@ -45,7 +45,7 @@ class LLMClientLarge(LLM):
response = self.client.chat.completions.create(
model=self.model,
messages=[{"role": "user", "content": prompt}],
- max_tokens=max_new_tokens,
+ **({"max_tokens": max_new_tokens} if max_new_tokens else {}),
)
return response.choices[0].message.content
@@ -61,7 +61,7 @@ class LLMClientLarge(LLM):
_response = self.client.chat.completions.create(
model=self.model,
messages=[{"role": "user", "content": prompt}],
- max_tokens=max_new_tokens,
+ **({"max_tokens": max_new_tokens} if max_new_tokens else {}),
response_format={"type": "json_object"},
)
_response = (
diff --git a/src/lib/llm/client_small.py b/src/lib/llm/client_small.py
new file mode 100644
index 0000000..471b3ec
--- /dev/null
+++ b/src/lib/llm/client_small.py
@@ -0,0 +1,213 @@
+"""
+File: /client_small.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 3:43:44 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+import json
+import os
+from concurrent.futures import ThreadPoolExecutor, TimeoutError as FutureTimeoutError
+import threading
+
+os.environ["GRPC_DNS_RESOLVER"] = "native"
+
+from tenacity import (
+ retry,
+ stop_after_attempt,
+ wait_exponential,
+ retry_if_exception_type,
+ RetryError,
+)
+
+from src.adapters.interfaces.llm import LLM
+from src.config import config
+
+_parent_pid = os.getpid()
+
+
+class LLMClientSmall(LLM):
+ """
+ Large language model client, used for main agents and other high-level tasks.
+ """
+
+ def __init__(self):
+ self._client = None
+ self._model = None
+ self._langchain_model = None
+ self._lock = threading.Lock()
+ self._pid = os.getpid()
+ self.default_timeout = 120
+
+ def _check_fork(self):
+ if os.getpid() != self._pid:
+ self._client = None
+ self._langchain_model = None
+ self._pid = os.getpid()
+
+ @property
+ def client(self):
+ self._check_fork()
+ if self._client is None:
+ with self._lock:
+ if self._client is None:
+ from google import genai
+
+ self._client = genai.Client(
+ vertexai=True,
+ project=config.gcp.project_id,
+ location="global",
+ http_options={"api_version": "v1"},
+ )
+ return self._client
+
+ @property
+ def model(self):
+ if self._model is None:
+ self._model = config.gcp.small_llm_model
+ return self._model
+
+ @property
+ def langchain_model(self):
+ if self._langchain_model is None:
+ with self._lock:
+ if self._langchain_model is None:
+ from langchain_google_vertexai import ChatVertexAI
+
+ os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = (
+ config.gcp.credentials_path
+ )
+ self._langchain_model = ChatVertexAI(
+ model_name=self.model,
+ project=config.gcp.project_id,
+ max_retries=5,
+ location="global",
+ request_timeout=120,
+ streaming=False,
+ wait_exponential_kwargs={
+ "multiplier": 1,
+ "min": 2,
+ "max": 60,
+ },
+ )
+ return self._langchain_model
+
+ def generate_text(
+ self, prompt: str, max_new_tokens: int = None, timeout: int = None
+ ) -> str:
+ if not prompt or len(prompt.strip()) == 0:
+ return "Input prompt is empty"
+
+ timeout = timeout or self.default_timeout
+ from google.genai.types import GenerateContentConfig
+
+ def _generate():
+ return self.client.models.generate_content(
+ model=self.model,
+ contents=[prompt],
+ config=GenerateContentConfig(
+ response_mime_type="text/plain",
+ **({"max_new_tokens": max_new_tokens} if max_new_tokens else {}),
+ ),
+ )
+
+ @retry(
+ stop=stop_after_attempt(3),
+ wait=wait_exponential(multiplier=1, min=2, max=30),
+ retry=retry_if_exception_type((TimeoutError, Exception)),
+ reraise=True,
+ )
+ def _generate_with_retry():
+ executor = ThreadPoolExecutor(max_workers=1)
+ future = None
+ try:
+ future = executor.submit(_generate)
+ response = future.result(timeout=timeout)
+ return response.text
+ except FutureTimeoutError:
+ if future:
+ future.cancel()
+ raise TimeoutError(
+ f"LLM generate_text timed out after {timeout} seconds. "
+ "This may indicate a network issue or the LLM service is unresponsive."
+ )
+ finally:
+ executor.shutdown(wait=False, cancel_futures=True)
+
+ try:
+ return _generate_with_retry()
+ except RetryError as e:
+ last_attempt = e.last_attempt
+ raise TimeoutError(
+ f"LLM generate_text failed after {last_attempt.attempt_number} attempts. "
+ f"Last error: {last_attempt.exception()}"
+ ) from last_attempt.exception()
+ except TimeoutError:
+ raise
+
+ def generate_json(
+ self,
+ prompt: str,
+ max_new_tokens: int = None,
+ max_retries: int = 3,
+ timeout: int = None,
+ ) -> dict:
+ timeout = timeout or self.default_timeout
+ from google.genai.types import GenerateContentConfig
+
+ def _generate():
+ _response = self.client.models.generate_content(
+ model=self.model,
+ contents=[prompt],
+ max_new_tokens=max_new_tokens,
+ config=GenerateContentConfig(
+ response_mime_type="application/json",
+ **({"max_new_tokens": max_new_tokens} if max_new_tokens else {}),
+ ),
+ )
+ _response = _response.text.strip("").strip("```")
+ return json.loads(_response)
+
+ @retry(
+ stop=stop_after_attempt(max_retries),
+ wait=wait_exponential(multiplier=1, min=2, max=30),
+ retry=retry_if_exception_type(
+ (TimeoutError, json.JSONDecodeError, Exception)
+ ),
+ reraise=True,
+ )
+ def _generate_with_retry():
+ executor = ThreadPoolExecutor(max_workers=1)
+ future = None
+ try:
+ future = executor.submit(_generate)
+ response = future.result(timeout=timeout)
+ return response
+ except FutureTimeoutError:
+ if future:
+ future.cancel()
+ raise TimeoutError(
+ f"LLM generate_json timed out after {timeout} seconds. "
+ "This may indicate a network issue or the LLM service is unresponsive."
+ )
+ except json.JSONDecodeError as e:
+ raise json.JSONDecodeError(f"Failed to parse JSON: {e}", e.doc, e.pos)
+ finally:
+ executor.shutdown(wait=False, cancel_futures=True)
+
+ try:
+ return _generate_with_retry()
+ except RetryError as e:
+ last_attempt = e.last_attempt
+ raise TimeoutError(
+ f"LLM generate_json failed after {last_attempt.attempt_number} attempts. "
+ f"Last error: {last_attempt.exception()}"
+ ) from last_attempt.exception()
+ except (TimeoutError, json.JSONDecodeError):
+ raise
+
+
+_llm_small_client = LLMClientSmall()
diff --git a/src/lib/milvus/client.py b/src/lib/milvus/client.py
index 4b8df7d..568c8cf 100644
--- a/src/lib/milvus/client.py
+++ b/src/lib/milvus/client.py
@@ -19,6 +19,7 @@ if os.getenv("MILVUS_URI") and not os.getenv("MILVUS_URI").startswith(
os.environ["MILVUS_URI"] = f"https://{os.getenv('MILVUS_URI')}"
from pymilvus import MilvusClient as Milvus
+from pymilvus import connections, db
from src.adapters.interfaces.embeddings import VectorStoreClient
from src.config import config
@@ -36,7 +37,8 @@ class MilvusClient(VectorStoreClient):
"""
def __init__(self):
- self._client = None
+ self._clients = {}
+ self._default_client = None
self._lock = None
self._pid = None
@@ -51,50 +53,118 @@ class MilvusClient(VectorStoreClient):
import os as os_module
current_pid = os_module.getpid()
- if self._pid is not None and self._pid != current_pid:
- if self._client is not None:
+ if hasattr(self, "_pid") and self._pid is not None and self._pid != current_pid:
+ for brain_id in list(self._clients.keys()):
try:
- self._client.close()
+ self._clients[brain_id].close()
except Exception:
pass
- self._client = None
+ del self._clients[brain_id]
+ if self._default_client is not None:
+ try:
+ self._default_client.close()
+ except Exception:
+ pass
+ self._default_client = None
self._pid = current_pid
- @property
- def client(self):
+ def _get_default_client(self):
"""
- Lazy initialization of the Milvus client.
+ Get or create a default Milvus client (without db_name) for database management operations.
"""
self._reset_client_if_forked()
- if self._client is None:
+ if self._default_client is None:
with self._get_lock():
self._reset_client_if_forked()
- if self._client is None:
+ if self._default_client is None:
if config.milvus.uri and config.milvus.token:
- self._client = Milvus(
+ self._default_client = Milvus(
uri=config.milvus.uri,
token=config.milvus.token,
+ timeout=30,
)
elif config.milvus.host and config.milvus.port:
uri = f"http://{config.milvus.host}:{config.milvus.port}"
- self._client = Milvus(
+ self._default_client = Milvus(
uri=uri,
token=config.milvus.token if config.milvus.token else None,
+ timeout=30,
)
else:
raise ValueError("Invalid Milvus configuration")
- return self._client
+ return self._default_client
+
+ def _ensure_database(self, brain_id: str):
+ """
+ Ensure the database exists, creating it if necessary.
+ """
+ try:
+ if config.milvus.uri and config.milvus.token:
+ connections.connect(
+ uri=config.milvus.uri,
+ token=config.milvus.token,
+ timeout=30,
+ )
+ elif config.milvus.host and config.milvus.port:
+ uri = f"http://{config.milvus.host}:{config.milvus.port}"
+ connections.connect(
+ uri=uri,
+ token=config.milvus.token if config.milvus.token else None,
+ timeout=30,
+ )
+ else:
+ raise ValueError("Invalid Milvus configuration")
+
+ databases = db.list_database()
+ if brain_id not in databases:
+ db.create_database(brain_id)
+ except Exception as e:
+ error_msg = str(e).lower()
+ if (
+ "already exists" not in error_msg
+ and "database not found" not in error_msg
+ and "already connected" not in error_msg
+ ):
+ raise
+
+ def _get_client(self, brain_id: str):
+ """
+ Get or create a Milvus client for the specified database (brain_id).
+ """
+ self._reset_client_if_forked()
+ if brain_id not in self._clients:
+ with self._get_lock():
+ self._reset_client_if_forked()
+ if brain_id not in self._clients:
+ self._ensure_database(brain_id)
+ if config.milvus.uri and config.milvus.token:
+ self._clients[brain_id] = Milvus(
+ uri=config.milvus.uri,
+ token=config.milvus.token,
+ db_name=brain_id,
+ )
+ elif config.milvus.host and config.milvus.port:
+ uri = f"http://{config.milvus.host}:{config.milvus.port}"
+ self._clients[brain_id] = Milvus(
+ uri=uri,
+ token=config.milvus.token if config.milvus.token else None,
+ db_name=brain_id,
+ )
+ else:
+ raise ValueError("Invalid Milvus configuration")
+ return self._clients[brain_id]
def _ensure_store(self, store: str, brain_id: str) -> None:
"""
- Ensure the store exists and is loaded.
+ Ensure the store exists and is loaded in the specified database.
"""
+ client = self._get_client(brain_id)
if store not in EMBEDDING_STORES_SIZES:
raise ValueError(f"Store {store} not available")
collection_created = False
- if not self.client.has_collection(store):
- self.client.create_collection(
+ if not client.has_collection(store):
+ client.create_collection(
store,
dimension=EMBEDDING_STORES_SIZES[store],
vector_field_name="embeddings",
@@ -107,7 +177,7 @@ class MilvusClient(VectorStoreClient):
"metric_type": "COSINE",
"index_type": "AUTOINDEX",
}
- self.client.create_index(
+ client.create_index(
collection_name=store,
field_name="embeddings",
index_params=index_params,
@@ -116,47 +186,48 @@ class MilvusClient(VectorStoreClient):
print(f"[Milvus] Error creating index for collection {store}: {e}")
try:
- has_partition = self.client.has_partition(store, brain_id)
- if not has_partition:
- self.client.load_collection(store)
+ client.load_collection(store)
except Exception:
- try:
- self.client.load_collection(store)
- except Exception:
- pass
+ pass
- def add_vectors(self, vectors: list[Vector], store: str, brain_id: str) -> None:
+ def add_vectors(
+ self, vectors: list[Vector], store: str, brain_id: str
+ ) -> list[str]:
"""
Add vectors to the vector store.
"""
+ client = self._get_client(brain_id)
self._ensure_store(store, brain_id)
- self.client.insert(
+ vs = [
+ {
+ "id": hash(vector.id) % (2**63),
+ "embeddings": vector.embeddings,
+ "uuid": vector.id,
+ **(vector.metadata or {}),
+ }
+ for vector in vectors
+ ]
+ client.insert(
store,
- [
- {
- "id": hash(vector.id) % (2**63),
- "embeddings": vector.embeddings,
- "uuid": vector.id,
- **(vector.metadata or {}),
- }
- for vector in vectors
- ],
+ vs,
)
+ return [v["id"] for v in vs]
def search_vectors(
- self, data_vector: list[float], store: str, brain_id: str, k: int = 10
+ self, data_vector: list[float], brain_id: str, store: str, k: int = 10
) -> list[Vector]:
"""
Search vectors in the vector store and return the top k vectors.
"""
+ client = self._get_client(brain_id)
self._ensure_store(store, brain_id)
try:
- self.client.load_collection(store)
+ client.load_collection(store)
except Exception:
pass
- _results = self.client.search(
+ _results = client.search(
store, data=[data_vector], limit=k, output_fields=["$meta"]
)
results = []
@@ -173,20 +244,33 @@ class MilvusClient(VectorStoreClient):
distance=result["distance"],
)
)
+ results.sort(key=lambda x: x.distance)
return results
def get_by_ids(self, ids: list[str], store: str, brain_id: str) -> list[Vector]:
"""
- Get vectors by their IDs.
+ Get vectors by their IDs from the specified database (brain_id).
"""
+ if not ids:
+ return []
+ client = self._get_client(brain_id)
self._ensure_store(store, brain_id)
- collection = self.client.query(
+ collection = client.query(
collection_name=store,
- ids=[hash(id) % (2**63) for id in ids],
- output_fields=["$meta"],
+ ids=ids,
+ output_fields=["embeddings", "$meta"],
)
return [
- Vector(id=result["id"], metadata=result["entity"]) for result in collection
+ Vector(
+ id=result.get("uuid", str(result["id"])),
+ embeddings=result.get("embeddings"),
+ metadata={
+ k: v
+ for k, v in result.items()
+ if k not in ["id", "embeddings", "distance"]
+ },
+ )
+ for result in collection
]
def search_similar_by_ids(
@@ -197,17 +281,18 @@ class MilvusClient(VectorStoreClient):
min_similarity: float,
limit: int = 10,
) -> dict[str, list[Vector]]:
+ client = self._get_client(brain_id)
self._ensure_store(store, brain_id)
try:
- self.client.load_collection(store)
+ client.load_collection(store)
except Exception:
pass
if not vector_ids:
return {}
- expr = "uuid in [" + ",".join(f"'{v}'" for v in vector_ids) + "]"
- queried = self.client.query(
+ expr = "id in [" + ",".join(str(v) for v in vector_ids) + "]"
+ queried = client.query(
collection_name=store,
filter=expr,
output_fields=["embeddings", "$meta"],
@@ -216,7 +301,7 @@ class MilvusClient(VectorStoreClient):
for item in queried or []:
emb = item.get("embeddings") or item.get("embeddings")
- uuid = item.get("uuid")
+ uuid = item.get("id")
if emb is not None and uuid:
id_to_emb[uuid] = emb
@@ -235,7 +320,7 @@ class MilvusClient(VectorStoreClient):
chunk_embeddings = batch_embeddings[start:end]
chunk_ids = batch_ids[start:end]
- raw_results = self.client.search(
+ raw_results = client.search(
collection_name=store,
data=chunk_embeddings,
limit=max(limit * 5, limit),
diff --git a/src/lib/mongo/client.py b/src/lib/mongo/client.py
index b93bcbe..8dedab6 100644
--- a/src/lib/mongo/client.py
+++ b/src/lib/mongo/client.py
@@ -88,7 +88,7 @@ class MongoClient(DataClient):
return SearchResult(text_chunks=text_chunks, observations=observations)
def get_text_chunks_by_ids(
- self, ids: List[str], brain_id: str, with_observations: bool = False
+ self, ids: List[str], with_observations: bool = False, brain_id: str = "default"
) -> List[TextChunk]:
chunks_collection = self.get_collection("text_chunks", database=brain_id)
text_chunks = chunks_collection.find({"id": {"$in": ids}})
@@ -133,7 +133,7 @@ class MongoClient(DataClient):
return structured_data
def create_brain(self, name_key: str) -> Brain:
- collection = self.get_collection("brains", "system")
+ collection = self.get_collection("brains", config.mongo.system_database)
brain = Brain(name_key=name_key)
brain_dict = brain.model_dump(mode="json", exclude={"id"})
result = collection.insert_one(brain_dict)
@@ -168,9 +168,7 @@ class MongoClient(DataClient):
collection.insert_one(kg_changes.model_dump(mode="json"))
return kg_changes
- def get_structured_data_by_id(
- self, id: str, brain_id: str
- ) -> StructuredData:
+ def get_structured_data_by_id(self, id: str, brain_id: str) -> StructuredData:
collection = self.get_collection("structured_data", database=brain_id)
result = collection.find_one({"id": id})
if not result:
@@ -184,20 +182,25 @@ class MongoClient(DataClient):
)
def get_structured_data_list(
- self, brain_id: str, limit: int = 10, skip: int = 0, types: list[str] = None, query_text: str = None
+ self,
+ brain_id: str,
+ limit: int = 10,
+ skip: int = 0,
+ types: list[str] = None,
+ query_text: str = None,
) -> list[StructuredData]:
collection = self.get_collection("structured_data", database=brain_id)
query = {}
if types:
query["types"] = {"$in": types}
-
+
if query_text:
query["$or"] = [
{"data": {"$regex": query_text, "$options": "i"}},
{"types": {"$regex": query_text, "$options": "i"}},
- {"metadata": {"$regex": query_text, "$options": "i"}}
+ {"metadata": {"$regex": query_text, "$options": "i"}},
]
-
+
results = collection.find(query).skip(skip).limit(limit)
return [
StructuredData(
@@ -209,20 +212,18 @@ class MongoClient(DataClient):
)
for result in results
]
-
+
def get_structured_data_types(self, brain_id: str) -> list[str]:
collection = self.get_collection("structured_data", database=brain_id)
pipeline = [
{"$unwind": "$types"},
{"$group": {"_id": "$types"}},
- {"$sort": {"_id": 1}}
+ {"$sort": {"_id": 1}},
]
results = collection.aggregate(pipeline)
return [result["_id"] for result in results]
- def get_observation_by_id(
- self, id: str, brain_id: str
- ) -> Observation:
+ def get_observation_by_id(self, id: str, brain_id: str) -> Observation:
collection = self.get_collection("observations", database=brain_id)
result = collection.find_one({"id": id})
if not result:
@@ -236,13 +237,13 @@ class MongoClient(DataClient):
)
def get_observations_list(
- self,
- brain_id: str,
- limit: int = 10,
- skip: int = 0,
+ self,
+ brain_id: str,
+ limit: int = 10,
+ skip: int = 0,
resource_id: str = None,
labels: list[str] = None,
- query_text: str = None
+ query_text: str = None,
) -> list[Observation]:
collection = self.get_collection("observations", database=brain_id)
query = {}
@@ -250,14 +251,14 @@ class MongoClient(DataClient):
query["resource_id"] = resource_id
if labels:
query["metadata.labels"] = {"$in": labels}
-
+
if query_text:
query["$or"] = [
{"text": {"$regex": query_text, "$options": "i"}},
{"resource_id": {"$regex": query_text, "$options": "i"}},
- {"metadata": {"$regex": query_text, "$options": "i"}}
+ {"metadata": {"$regex": query_text, "$options": "i"}},
]
-
+
results = collection.find(query).skip(skip).limit(limit)
return [
Observation(
@@ -269,16 +270,17 @@ class MongoClient(DataClient):
)
for result in results
]
-
+
def get_observation_labels(self, brain_id: str) -> list[str]:
collection = self.get_collection("observations", database=brain_id)
pipeline = [
{"$match": {"metadata.labels": {"$exists": True}}},
{"$unwind": "$metadata.labels"},
{"$group": {"_id": "$metadata.labels"}},
- {"$sort": {"_id": 1}}
+ {"$sort": {"_id": 1}},
]
results = collection.aggregate(pipeline)
return [result["_id"] for result in results]
+
_mongo_client = MongoClient()
diff --git a/src/lib/neo4j/client.py b/src/lib/neo4j/client.py
index cbf0ee6..c77fcf0 100644
--- a/src/lib/neo4j/client.py
+++ b/src/lib/neo4j/client.py
@@ -9,8 +9,11 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
"""
import os
-from typing import Any, Literal, Optional, Tuple
+import time
+from typing import Any, Dict, List, Literal, Optional, Tuple
from neo4j import GraphDatabase
+from neo4j.exceptions import ClientError
+from src.adapters.interfaces.embeddings import VectorStoreClient
from src.adapters.interfaces.graph import GraphClient
from src.config import config
from src.constants.kg import (
@@ -33,6 +36,9 @@ class Neo4jClient(GraphClient):
self.driver = GraphDatabase.driver(
f"bolt://{config.neo4j.host}:{config.neo4j.port}",
auth=(config.neo4j.username, config.neo4j.password),
+ connection_timeout=30,
+ max_connection_lifetime=300,
+ connection_acquisition_timeout=60,
)
def execute_operation(self, operation: str, brain_id: str) -> str:
@@ -62,6 +68,47 @@ class Neo4jClient(GraphClient):
else:
raise
+ def _verify_database_accessible(self, database: str) -> bool:
+ """
+ Verify that a database is accessible by executing a simple query.
+ """
+ try:
+ self.driver.execute_query("RETURN 1 AS test", database_=database)
+ return True
+ except ClientError as e:
+ error_code = getattr(e, "code", None)
+ if error_code == "Neo.ClientError.Database.DatabaseNotFound":
+ return False
+ raise
+
+ def _execute_query_with_retry(
+ self, query: str, database: str, max_retries: int = 3, retry_delay: float = 0.1
+ ):
+ """
+ Execute a query with retry logic for DatabaseNotFound errors.
+ Verifies database accessibility instead of using sleep.
+ """
+ last_exception = None
+ for attempt in range(max_retries):
+ try:
+ return self.driver.execute_query(query, database_=database)
+ except ClientError as e:
+ error_code = getattr(e, "code", None)
+ if error_code == "Neo.ClientError.Database.DatabaseNotFound":
+ last_exception = e
+ if attempt < max_retries - 1:
+ self.ensure_database(database)
+ retries = 0
+ while retries < 10 and not self._verify_database_accessible(
+ database
+ ):
+ time.sleep(retry_delay)
+ retries += 1
+ continue
+ raise
+ if last_exception:
+ raise last_exception
+
@property
def graphdb_type(self) -> str:
"""
@@ -131,8 +178,10 @@ class Neo4jClient(GraphClient):
Add nodes to the graph.
"""
results = []
+ self.ensure_database(brain_id)
+
for node in nodes:
- identification_dict = {"Name": node.name}
+ identification_dict = {"name": node.name}
all_properties = {
**(node.properties or {}),
@@ -141,24 +190,15 @@ class Neo4jClient(GraphClient):
if identification_params:
for key, value in identification_params.items():
- identification_dict[key] = value
+ normalized_key = self._clean_property_key(key)
+ if normalized_key != "name":
+ identification_dict[normalized_key] = value
identification_items = []
for key, value in identification_dict.items():
cypher_key = self._format_property_key(key)
-
- if isinstance(value, str):
- escaped_value = self._format_value(value)
- identification_items.append(f"{cypher_key}: {escaped_value}")
- elif isinstance(value, (int, float, bool)):
- identification_items.append(
- f"{cypher_key}: {self._format_value(value)}"
- )
- elif value is None:
- identification_items.append(f"{cypher_key}: null")
- else:
- escaped_value = self._format_value(value)
- identification_items.append(f"{cypher_key}: {escaped_value}")
+ escaped_value = self._format_value(value)
+ identification_items.append(f"{cypher_key}: {escaped_value}")
identification_set_str = f"{{{', '.join(identification_items)}}}"
@@ -168,19 +208,8 @@ class Neo4jClient(GraphClient):
property_assignments = []
for key, value in all_properties.items():
cypher_key = self._format_property_key(key)
-
- if isinstance(value, str):
- escaped_value = self._format_value(value)
- property_assignments.append(f"n.{cypher_key} = {escaped_value}")
- elif isinstance(value, (int, float, bool)):
- property_assignments.append(
- f"n.{cypher_key} = {self._format_value(value)}"
- )
- elif value is None:
- property_assignments.append(f"n.{cypher_key} = null")
- else:
- escaped_value = self._format_value(value)
- property_assignments.append(f"n.{cypher_key} = {escaped_value}")
+ escaped_value = self._format_value(value)
+ property_assignments.append(f"n.{cypher_key} = {escaped_value}")
property_assignments.append(f"n.uuid = '{node.uuid}'")
@@ -192,9 +221,8 @@ class Neo4jClient(GraphClient):
SET {properties_set}
RETURN n
"""
- self.ensure_database(brain_id)
try:
- result = self.driver.execute_query(cypher_query, database_=brain_id)
+ result = self._execute_query_with_retry(cypher_query, brain_id)
results.append(result)
log("Nodes added: ", results)
except Exception as e:
@@ -222,13 +250,11 @@ class Neo4jClient(GraphClient):
"""
Add a relationship between two nodes to the graph.
"""
- safe_desc = predicate.description.replace("'", "\\'")
-
cypher_query = f"""
- MATCH (a:{":".join(self._clean_labels(subject.labels))}) WHERE a.name = '{subject.name}'
- MATCH (b:{":".join(self._clean_labels(to_object.labels))}) WHERE b.name = '{to_object.name}'
+ MATCH (a:{":".join(self._clean_labels(subject.labels))}) WHERE a.name = {self._format_value(subject.name)}
+ MATCH (b:{":".join(self._clean_labels(to_object.labels))}) WHERE b.name = {self._format_value(to_object.name)}
MERGE (a)-[r:{":".join(self._clean_labels([predicate.name]))}]->(b)
- ON CREATE SET r.description = '{safe_desc}', r.uuid = '{predicate.uuid}'
+ ON CREATE SET r.description = {self._format_value(predicate.description)}, r.uuid = {self._format_value(predicate.uuid)}
RETURN a, b
"""
@@ -245,7 +271,7 @@ class Neo4jClient(GraphClient):
queries = []
for node in nodes:
- query = f"""MATCH (n:{":".join(self._clean_labels(node.labels))}) WHERE n.name = '{node.name}'
+ query = f"""MATCH (n:{":".join(self._clean_labels(node.labels))}) WHERE n.name = {self._format_value(node.name)}
OPTIONAL MATCH (n)-[r*1]-(m)
RETURN n, r, m"""
queries.append(query)
@@ -261,7 +287,7 @@ class Neo4jClient(GraphClient):
"""
cypher_query = f"""
MATCH (n)
- WHERE toLower(n.name) CONTAINS toLower('{text}')
+ WHERE toLower(n.name) CONTAINS toLower({self._format_value(text)})
RETURN n
"""
self.ensure_database(brain_id)
@@ -416,11 +442,11 @@ class Neo4jClient(GraphClient):
result = self.driver.execute_query(cypher_query, database_=brain_id)
return [
Node(
- uuid=record["uuid"],
- name=record["name"],
- labels=record["labels"],
- description=record["description"],
- properties=record["properties"],
+ uuid=record.get("uuid", ""),
+ name=record.get("name", ""),
+ labels=record.get("labels", []),
+ description=record.get("description", ""),
+ properties=record.get("properties", {}),
)
for record in result.records
]
@@ -476,60 +502,77 @@ class Neo4jClient(GraphClient):
return [record["propertyKey"] for record in result.records]
def get_neighbors(
- self, node: Node, limit: int, brain_id: str
- ) -> list[Tuple[Node, Predicate, Node]]:
+ self,
+ nodes: list[Node | str],
+ brain_id: str,
+ same_type_only: bool = False,
+ limit: int | None = None,
+ of_types: Optional[list[str]] = None,
+ ) -> Dict[str, List[Tuple[Predicate, Node]]]:
"""
Get the neighbors of a node.
"""
+ if len(nodes) == 0:
+ return {}
+
+ if isinstance(nodes[0], str):
+ node_uuids = nodes
+ else:
+ node_uuids = [node.uuid for node in nodes]
+ uuids_list = '", "'.join(node_uuids)
cypher_query = f"""
- MATCH (n {{uuid: '{node.uuid}'}})-[r]-(c)-[r2]-(m)
- WHERE size([l IN labels(n) WHERE l IN labels(m)]) > 0
- RETURN m.uuid AS uuid, m.name AS name, labels(m) AS labels, m.description AS description, properties(m) AS properties, r2 AS rel,
- CASE WHEN startNode(r2) = c THEN 'out' ELSE 'in' END AS direction,
+ MATCH (n)-[r]-(c)
+ WHERE n.uuid IN ["{uuids_list}"]
+ """
+
+ if same_type_only:
+ cypher_query += " AND size([l IN labels(n) WHERE l IN labels(c)]) > 0"
+
+ if of_types:
+ cypher_query += (
+ " AND ANY(l IN labels(c) WHERE l IN ["
+ + ",".join(f"'{t}'" for t in self._clean_labels(of_types))
+ + "])"
+ )
+
+ cypher_query += """
+ RETURN n.uuid AS uuid, n.name AS name, labels(n) AS labels, n.description AS description, properties(n) AS properties, r AS rel,
+ CASE WHEN startNode(r) = n THEN 'out' ELSE 'in' END AS direction,
+ type(r) AS rel_type, r.description AS rel_description,
c.uuid AS c_uuid, c.name AS c_name, labels(c) AS c_labels, c.description AS c_description, properties(c) AS c_properties
"""
+
+ if limit:
+ cypher_query += f" LIMIT {limit}"
+
self.ensure_database(brain_id)
result = self.driver.execute_query(cypher_query, database_=brain_id)
- neighbors = []
- for record in result.records:
- rel = record["rel"]
- rel_type = getattr(rel, "type", None)
- rel_desc = ""
- try:
- rel_desc = rel.get("description", "")
- except Exception:
- try:
- rel_desc = rel["description"]
- except Exception:
- rel_desc = ""
- direction = record.get("direction", "out")
+ neighbors_dict: Dict[str, List[Tuple[Predicate, Node]]] = {
+ uuid: [] for uuid in node_uuids
+ }
- neighbors.append(
- (
- Node(
- uuid=record.get("uuid", ""),
- name=record.get("name", "") or "",
- labels=record.get("labels", []) or [],
- description=record.get("description", "") or "",
- properties=record.get("properties", {}) or {},
- ),
- Predicate(
- name=rel_type or "",
- description=rel_desc or "",
- direction=direction,
- ),
- Node(
- uuid=record.get("c_uuid", ""),
- name=record.get("c_name", "") or "",
- labels=record.get("c_labels", []) or [],
- description=record.get("c_description", "") or "",
- properties=record.get("c_properties", {}) or {},
- ),
- )
+ for record in result.records:
+ source_uuid = record["uuid"]
+ neighbor = (
+ Predicate(
+ name=record.get("rel_type", "") or "",
+ description=record.get("rel_description", "") or "",
+ direction=record.get("direction", "neutral"),
+ ),
+ Node(
+ uuid=record.get("c_uuid", ""),
+ name=record.get("c_name", "") or "",
+ labels=record.get("c_labels", []) or [],
+ description=record.get("c_description", "") or "",
+ properties=record.get("c_properties", {}) or {},
+ ),
)
- return [(n, p, c) for n, p, c in neighbors]
+ if source_uuid in neighbors_dict:
+ neighbors_dict[source_uuid].append(neighbor)
+
+ return neighbors_dict
def get_node_with_rel_by_uuid(
self, rel_ids_with_node_ids: list[tuple[str, str]], brain_id: str
@@ -859,7 +902,7 @@ class Neo4jClient(GraphClient):
filters.append(f"n.uuid IN [{','.join(node_uuids)}]")
if query_text:
filters.append(
- f"(toLower(coalesce(n.name, n.name, '')) CONTAINS toLower('{query_text}'))"
+ f"(toLower(coalesce(n.name, n.name, '')) CONTAINS toLower({self._format_value(query_text)}))"
)
cypher_query = f"""
MATCH (n)
@@ -874,8 +917,8 @@ class Neo4jClient(GraphClient):
RETURN count(n) AS total
"""
self.ensure_database(brain_id)
- result = self.driver.execute_query(cypher_query, database_=brain_id)
- count_result = self.driver.execute_query(cypher_count, database_=brain_id)
+ result = self._execute_query_with_retry(cypher_query, brain_id)
+ count_result = self._execute_query_with_retry(cypher_count, brain_id)
total = 0
if count_result and count_result.records:
total = count_result.records[0].get("total") or 0
@@ -1022,5 +1065,40 @@ class Neo4jClient(GraphClient):
)
return None
+ def get_schema(self, brain_id: str) -> dict:
+ """
+ Get the schema/ontology of the graph.
+ Returns all node labels and relationship types in JSON format.
+ """
+ self.ensure_database(brain_id)
+
+ labels_query = "CALL db.labels() YIELD label RETURN label"
+ relationships_query = (
+ "CALL db.relationshipTypes() YIELD relationshipType RETURN relationshipType"
+ )
+
+ labels_result = self.driver.execute_query(labels_query, database_=brain_id)
+ relationships_result = self.driver.execute_query(
+ relationships_query, database_=brain_id
+ )
+
+ labels = [record["label"] for record in labels_result.records]
+ relationships = [
+ record["relationshipType"] for record in relationships_result.records
+ ]
+
+ return {"labels": labels, "relationships": relationships}
+
+ def get_2nd_degree_hops(
+ self,
+ from_: List[str],
+ flattened: bool,
+ vector_store_adapter: VectorStoreClient,
+ brain_id: str,
+ ) -> Dict[str, List[Tuple[Predicate, Node, List[Tuple[Predicate, Node]]]]]:
+ return super().get_2nd_degree_hops(
+ from_, flattened, vector_store_adapter, brain_id
+ )
+
_neo4j_client = Neo4jClient()
diff --git a/src/services/api/constants/requests.py b/src/services/api/constants/requests.py
index 285703d..c4fcedb 100644
--- a/src/services/api/constants/requests.py
+++ b/src/services/api/constants/requests.py
@@ -11,7 +11,7 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
from typing import List, Any, Optional
from pydantic import BaseModel, Field, field_serializer
from src.constants.data import Observation, TextChunk
-from src.constants.kg import IdentificationParams, Node, Predicate, Relationship
+from src.constants.kg import IdentificationParams, Node, Predicate
from src.constants.tasks.ingestion import IngestionTaskArgs
@@ -173,6 +173,9 @@ class RetrieveNeighborsWithIdentificationParamsRequestBody(BaseModel):
brain_id: str = Field(
default="default", description="The brain identifier to store the data in."
)
+ look_for: Optional[str] = Field(
+ None, description="Optional filter for what type of neighbors to look for."
+ )
class CreateBrainRequest(BaseModel):
diff --git a/src/services/api/constants/tool_schemas.py b/src/services/api/constants/tool_schemas.py
index 68baa4e..32f7b72 100644
--- a/src/services/api/constants/tool_schemas.py
+++ b/src/services/api/constants/tool_schemas.py
@@ -43,9 +43,12 @@ NODE_SCHEMA = {
"type": "object",
"description": (
"All the extra properties that will be added to the node "
- "and provide additional context."
+ "and provide additional context. "
+ "This object accepts any key-value pairs dynamically."
),
- "additionalProperties": True,
+ "patternProperties": {
+ ".*": {"description": "Any additional property value"}
+ },
},
},
"required": ["labels", "name"],
diff --git a/src/services/api/controllers/kg.py b/src/services/api/controllers/kg.py
new file mode 100644
index 0000000..0dbe1fa
--- /dev/null
+++ b/src/services/api/controllers/kg.py
@@ -0,0 +1,41 @@
+"""
+File: /kg.py
+Created Date: Wednesday December 31st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Wednesday December 31st 2025 7:45:55 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+import asyncio
+from src.services.kg_agent.main import (
+ embeddings_adapter,
+ graph_adapter,
+ vector_store_adapter,
+)
+
+
+async def get_hops(
+ query: str, degrees: int = 2, flattened: bool = True, brain_id: str = "default"
+):
+ """
+ Get the hops in the graph for a given query.
+ """
+ text_embeddings = embeddings_adapter.embed_text(query)
+ data_vectors = vector_store_adapter.search_vectors(
+ text_embeddings.embeddings, store="nodes", brain_id=brain_id
+ )
+ node_uuids = [v.metadata.get("uuid") for v in data_vectors]
+ print("[+] Getting 2nd degree hops for nodes:", node_uuids)
+ if len(node_uuids) == 0:
+ return []
+
+ hops = await asyncio.to_thread(
+ graph_adapter.get_2nd_degree_hops,
+ node_uuids,
+ flattened=flattened,
+ vector_store_adapter=vector_store_adapter,
+ brain_id=brain_id,
+ )
+ return hops
diff --git a/src/services/api/controllers/retrieve.py b/src/services/api/controllers/retrieve.py
index 0dd7b24..ec76214 100644
--- a/src/services/api/controllers/retrieve.py
+++ b/src/services/api/controllers/retrieve.py
@@ -9,13 +9,13 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
"""
import asyncio
-import time
-from typing import List, Optional
+from typing import Optional
from fastapi import HTTPException
from starlette.responses import JSONResponse
-from src.constants.kg import IdentificationParams, Node, Predicate, Relationship
+from src.constants.embeddings import Vector
+from src.constants.kg import IdentificationParams, Node, Predicate
from src.core.search.entities import search_entities
from src.core.search.relationships import search_relationships
from src.services.api.constants.requests import (
@@ -26,7 +26,7 @@ from src.services.api.constants.requests import (
from src.services.kg_agent.main import graph_adapter, kg_agent
from src.services.data.main import data_adapter
from src.services.kg_agent.main import embeddings_adapter, vector_store_adapter
-from src.utils.logging import log, logt
+from src.utils.similarity.vectors import cosine_similarity
async def retrieve_data(
@@ -93,203 +93,129 @@ async def retrieve_data(
async def retrieve_neighbors(
uuid: Optional[str] = None,
+ look_for: Optional[str] = None,
identification_params: Optional[IdentificationParams] = None,
limit: int = 10,
brain_id: str = "default",
) -> RetrieveNeighborsRequestResponse:
- def _get_neighbors():
+ async def _get_neighbors():
+ # ---------------------------------------------------------
# ================= GETTING THE MAIN NODE =================
- node = None
- if uuid:
- node = graph_adapter.get_by_uuid(uuid, brain_id)
- elif identification_params:
- node = graph_adapter.get_by_identification_params(
- identification_params,
- brain_id=brain_id,
- entity_types=identification_params.entity_types,
- )
- if not node:
- raise HTTPException(status_code=404, detail="Entity not found")
-
- # ================= GETTING THE 2nd LEVEL NEIGHBORS =================
- # This gets the 2nd level neighbors (main)-[r1]-(common)-[r2]-(neighbor)
- # That share a common node with the main node
- # The neighbors are of the same type (share at least one label) of the
- # main node
- raw = graph_adapter.get_neighbors(node, limit, brain_id)
-
- normalized: List[RetrievedNeighborNode] = []
-
- for item in raw:
- if isinstance(item, tuple) and len(item) >= 2:
- n, pred, common = item
- else:
- n, pred = item, None
-
- if isinstance(pred, Predicate):
- relation = Relationship(
- direction=pred.direction or "out", predicate=pred
+ # ---------------------------------------------------------
+ def _get_node() -> Node:
+ node = None
+ if uuid:
+ node = graph_adapter.get_by_uuid(uuid, brain_id)
+ elif identification_params:
+ node = graph_adapter.get_by_identification_params(
+ identification_params,
+ brain_id=brain_id,
+ entity_types=identification_params.entity_types,
)
- else:
- relation = Relationship(
- direction="out",
- predicate=Predicate(name="RELATED_TO", description=""),
+ if not node:
+ raise HTTPException(status_code=404, detail="Entity not found")
+ return node
+
+ node = await asyncio.to_thread(_get_node)
+ target_node_types = node.labels
+
+ looking_for_v = embeddings_adapter.embed_text(look_for) if look_for else None
+
+ # ---------------------------------------------------------
+ # ===== Getting 1st degree neighbors of the main node =====
+ # ---------------------------------------------------------
+ def _get_fd_neighbors() -> (
+ tuple[dict[str, list[tuple[Predicate, Node]]], list[str]]
+ ):
+ fd_neighbors = graph_adapter.get_neighbors(
+ [node.uuid], limit=limit, brain_id=brain_id
+ )
+ fd_v_neighbors_ids = [
+ fd[1].properties["v_id"] for fd in fd_neighbors[node.uuid]
+ ]
+ if look_for:
+ fd_v_neighbors_embeddings = vector_store_adapter.get_by_ids(
+ fd_v_neighbors_ids, brain_id=brain_id, store="nodes"
)
-
- if not n.uuid == node.uuid:
- normalized.append(
- RetrievedNeighborNode(
- neighbor=Node(**n.model_dump()),
- relationship=Predicate(
- name=relation.predicate.name,
- description=relation.predicate.description,
- direction=relation.predicate.direction,
- observations=[],
- level="1",
- ),
- most_common=Node(**common.model_dump()),
- )
+ fd_v_neighbors_embeddings_map = {
+ v.id: v.embeddings
+ for v in fd_v_neighbors_embeddings
+ if cosine_similarity(looking_for_v.embeddings, v.embeddings) > 0.5
+ }
+ fd_v_neighbors_ids = list(fd_v_neighbors_embeddings_map.keys())
+
+ return fd_neighbors, fd_v_neighbors_ids
+
+ fd_neighbors, fd_v_neighbors_ids = await asyncio.to_thread(_get_fd_neighbors)
+
+ # ---------------------------------------------------------
+ # === Getting nodes similar to the 1st degree neighbors ===
+ # ---------------------------------------------------------
+ fd_v_similar_node_futures = []
+ for fd_v_neighbor_id in fd_v_neighbors_ids:
+ fd_v_similar_node_futures.append(
+ asyncio.to_thread(
+ vector_store_adapter.search_similar_by_ids,
+ [fd_v_neighbor_id],
+ brain_id,
+ "nodes",
+ 0.5,
+ limit,
)
-
- # ================= GETTING THE SIMILAR NEIGHBORS =================
- # If not enough direct 2nd level connected neighbors are found,
- # Search for nodes that are similar to the 1st level connected nodes of the
- # main node and than get the connected nodes that share
- # at least one label with the main node
- if len(normalized) < limit:
- neighbor_nodes = graph_adapter.get_nodes_by_uuid(
- uuids=[node.uuid], brain_id=brain_id, with_relationships=True
)
-
- # Mapping the ids and the nodes into a dictionary and ids array
- related_nodes = {}
- related_node_ids = []
- for n_dict in neighbor_nodes:
- k = n_dict.get("related_nodes").uuid
- rel_node = n_dict.get("related_nodes")
- related_nodes[k] = rel_node
- related_node_ids.append(k)
-
- # Searching for similar nodes of the 1st level connected nodes
- # Returns a dictionary where the keys are the searched ids
- # And the values are the similar nodes found, respectively
- v_neighbors = vector_store_adapter.search_similar_by_ids(
- vector_ids=related_node_ids,
+ fd_v_similar_nodes_results: list[dict[str, list[Vector]]] = (
+ await asyncio.gather(*fd_v_similar_node_futures)
+ )
+ fd_similar_node_ids = [
+ v.metadata["uuid"]
+ for result_dict in fd_v_similar_nodes_results
+ for vectors in result_dict.values()
+ for v in vectors
+ ]
+ fd_similar_nodes = await asyncio.to_thread(
+ graph_adapter.get_by_uuids, fd_similar_node_ids, brain_id
+ )
+ fd_similar_nodes_by_uuid = {n.uuid: n for n in fd_similar_nodes}
+
+ # ---------------------------------------------------------
+ # === Getting neighbors of the 1st degree similar nodes ===
+ # ---------------------------------------------------------
+ def _get_fd_similar_node_neighbors() -> dict[str, list[tuple[Predicate, Node]]]:
+ fd_similar_node_neighbors = graph_adapter.get_neighbors(
+ fd_similar_node_ids,
+ limit=limit,
brain_id=brain_id,
- store="nodes",
- min_similarity=0.2,
- limit=(limit - len(normalized)) * 10,
+ of_types=list(set(target_node_types)),
)
- node_labels_lower = [n.lower() for n in node.labels]
- same_main_labels_v_neighbors = {}
- others_v_neighbors = {}
-
- for k, vectors in v_neighbors.items():
- # Filtering the vectors that are of the same labels as the main node
- # Directly similar nodes to the directly 1st level connected nodes
- matching_vectors = [
- vector
- for vector in vectors
- if any(
- label.lower() in node_labels_lower
- for label in vector.metadata.get("labels", [])
- )
- ]
- log("[found same label vectors]", len(matching_vectors))
-
- # Filtering the vectors that are NOT of the same labels as the main node
- # Similar nodes to the directly 1st level, a step to get the connected nodes
- # of the same label as the main node is needed
- non_matching_vectors = [
- vector
- for vector in vectors
- if not any(
- label.lower() in node_labels_lower
- for label in vector.metadata.get("labels", [])
- )
- ]
- log("[found non same label vectors]", len(non_matching_vectors))
-
- if matching_vectors:
- same_main_labels_v_neighbors[k] = matching_vectors
- if non_matching_vectors:
- others_v_neighbors[k] = non_matching_vectors
-
- # Getting and adding directly the similar nodes of same label as the main node
- for k, v in same_main_labels_v_neighbors.items():
- neighbor_nodes = graph_adapter.get_by_uuids(
- uuids=[vector.metadata.get("uuid") for vector in v],
- brain_id=brain_id,
- )
- for n in neighbor_nodes:
- if len(normalized) >= limit:
- break
- if not any(
- [
- norm.neighbor.uuid == n.uuid
- or norm.most_common.uuid == related_nodes[k].uuid
- for norm in normalized
- ]
- ):
- normalized.append(
- RetrievedNeighborNode(
- neighbor=Node(**n.model_dump()),
- relationship=Predicate(
- name="<SIMILAR_TO>",
- description=f"<SYS_DESCRIPTION>The neighbor and the most common are similar. Most common is directly connected to {node.name}.</SYS_DESCRIPTION>",
- direction="neutral",
- level="2",
- ),
- most_common=related_nodes[k],
- observations=[],
- )
- )
+ return fd_similar_node_neighbors
- # Getting the connected nodes of the similar nodes and filtering
- # the ones the are with same label as the main node
- for k, v in others_v_neighbors.items():
- neighbor_nodes = graph_adapter.get_connected_nodes(
- brain_id=brain_id,
- uuids=[vector.metadata.get("uuid") for vector in v],
- limit=limit - len(normalized),
- with_labels=node.labels,
- )
- for n, pred, common in neighbor_nodes:
- if len(normalized) >= limit:
- break
- if not any([norm.neighbor.uuid == n.uuid for norm in normalized]):
- normalized.append(
- RetrievedNeighborNode(
- neighbor=Node(**n.model_dump()),
- relationship=Predicate(
- name=pred.name,
- description=pred.description,
- direction=pred.direction,
- level="3",
- ),
- most_common=Node(**common.model_dump()),
- )
+ fd_similar_node_neighbors = await asyncio.to_thread(
+ _get_fd_similar_node_neighbors
+ )
+
+ seen_neighbor_uuids = set()
+ unique_neighbors = []
+ for source_uuid, neighbors_list in fd_similar_node_neighbors.items():
+ for neighbor_tuple in neighbors_list:
+ neighbor_uuid = neighbor_tuple[1].uuid
+ if neighbor_uuid not in seen_neighbor_uuids:
+ seen_neighbor_uuids.add(neighbor_uuid)
+ unique_neighbors.append(
+ RetrievedNeighborNode(
+ neighbor=neighbor_tuple[1],
+ relationship=neighbor_tuple[0],
+ most_common=fd_similar_nodes_by_uuid.get(source_uuid),
)
+ )
- # if len(normalized) < limit:
- # v_data = vector_store_adapter.search_similar_by_ids(
- # vector_ids=[node.uuid],
- # store="data",
- # min_similarity=0.5,
- # limit=limit - len(normalized),
- # )
- # print("[v_data]", v_data) # === same as above ===
- # # TODO: get v_neighbor nodes by ids and the k (the common)
- # # TODO + push to normalized
- # # TODO (directly the nodes with label same as main, the others search for neighbors with same label of main)
-
- # Returning all the nodes found respecting the limit
return RetrieveNeighborsRequestResponse(
- count=len(normalized), main_node=node, neighbors=normalized
+ count=len(unique_neighbors),
+ main_node=node,
+ neighbors=unique_neighbors[:limit],
)
- return await asyncio.to_thread(_get_neighbors)
+ return await _get_neighbors()
async def retrieve_neighbors_ai_mode(
diff --git a/src/services/api/routes/ingest.py b/src/services/api/routes/ingest.py
index 97a905f..32a3052 100644
--- a/src/services/api/routes/ingest.py
+++ b/src/services/api/routes/ingest.py
@@ -9,6 +9,9 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
"""
from fastapi import APIRouter
+from typing import Literal
+from typing_extensions import Annotated
+from fastapi import Form, UploadFile
from starlette.responses import JSONResponse
from src.services.api.constants.requests import (
@@ -45,3 +48,17 @@ async def ingest_structured_data(data: IngestionStructuredRequestBody):
return JSONResponse(
content={"message": "Structured data ingested successfully", "task_id": task.id}
)
+
+
+@ingest_router.post(path="/file")
+async def ingest_file(
+ file: Annotated[UploadFile, Form()],
+ brain_id: str = Form(default="default"),
+ understanding_level: str = Annotated[
+ Literal["basic", "deep"], Form(default="deep")
+ ],
+):
+ """
+ Ingest a file into the processing pipeline and save to the memory.
+ """
+ return JSONResponse(content={"message": "File ingested successfully"})
diff --git a/src/services/api/routes/retrieve.py b/src/services/api/routes/retrieve.py
index f60c427..e4ba530 100644
--- a/src/services/api/routes/retrieve.py
+++ b/src/services/api/routes/retrieve.py
@@ -8,7 +8,7 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
-----
"""
-from typing import Optional
+from typing import Literal, Optional
from fastapi import APIRouter, Body, Query
from src.services.api.constants.requests import (
RetrieveNeighborsAiModeRequestBody,
@@ -22,6 +22,7 @@ from src.services.api.controllers.retrieve import (
get_relationships as retrieve_get_relationships_controller,
get_entities as retrieve_get_entities_controller,
)
+from src.services.api.controllers.kg import get_hops as get_hops_controller
from src.services.api.controllers.retrieve import (
retrieve_data as retrieve_data_controller,
)
@@ -61,13 +62,17 @@ async def retrieve(
async def get_neighbors(
uuid: str = Query(..., description="The UUID of the entity to get neighbors for."),
limit: int = Query(10, description="The number of neighbors to return."),
+ look_for: Optional[str] = Query(
+ None,
+ description="The description of what in the neighbors should share with the target.",
+ ),
brain_id: str = "default",
):
"""
Get the neighbors of an entity.
"""
return await retrieve_neighbors_controller(
- uuid=uuid, limit=limit, brain_id=brain_id
+ uuid=uuid, limit=limit, look_for=look_for, brain_id=brain_id
)
@@ -83,6 +88,7 @@ async def get_neighbors_with_identification_params(
return await retrieve_neighbors_controller(
identification_params=request.identification_params,
limit=request.limit,
+ look_for=request.look_for if request.look_for else None,
brain_id=request.brain_id,
)
@@ -157,6 +163,7 @@ async def get_entities(
limit, skip, node_labels, query_text, brain_id
)
+
@retrieve_router.get(path="/structured-data/types")
async def get_structured_data_types(
brain_id: str = "default",
@@ -166,6 +173,7 @@ async def get_structured_data_types(
"""
return await get_structured_data_types_controller(brain_id)
+
@retrieve_router.get(path="/structured-data/{id}")
async def get_structured_data_by_id(
id: str,
@@ -176,6 +184,7 @@ async def get_structured_data_by_id(
"""
return await get_structured_data_by_id_controller(id, brain_id)
+
@retrieve_router.get(path="/structured-data")
async def get_structured_data_list(
limit: int = 10,
@@ -189,7 +198,10 @@ async def get_structured_data_list(
"""
if types:
types = types.split(",")
- return await get_structured_data_list_controller(limit, skip, types, query_text, brain_id)
+ return await get_structured_data_list_controller(
+ limit, skip, types, query_text, brain_id
+ )
+
@retrieve_router.get(path="/observations/labels")
async def get_observation_labels(
@@ -200,6 +212,7 @@ async def get_observation_labels(
"""
return await get_observation_labels_controller(brain_id)
+
@retrieve_router.get(path="/observations/{id}")
async def get_observation_by_id(
id: str,
@@ -210,6 +223,7 @@ async def get_observation_by_id(
"""
return await get_observation_by_id_controller(id, brain_id)
+
@retrieve_router.get(path="/observations")
async def get_observations_list(
limit: int = 10,
@@ -224,4 +238,19 @@ async def get_observations_list(
"""
if labels:
labels = labels.split(",")
- return await get_observations_list_controller(limit, skip, resource_id, labels, query_text, brain_id)
\ No newline at end of file
+ return await get_observations_list_controller(
+ limit, skip, resource_id, labels, query_text, brain_id
+ )
+
+
+@retrieve_router.get(path="/hops")
+async def get_hops(
+ query: str,
+ degrees: Literal[2] = 2,
+ flattened: bool = True,
+ brain_id: str = "default",
+): # noqa: F821
+ """
+ Get the hops in the graph for a given query.
+ """
+ return await get_hops_controller(query, degrees, flattened, brain_id)
diff --git a/src/services/input/__input__.py b/src/services/input/__input__.py
new file mode 100644
index 0000000..ab8a62a
--- /dev/null
+++ b/src/services/input/__input__.py
@@ -0,0 +1,9 @@
+"""
+File: /__input__.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 4:17:23 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/services/input/agents.py b/src/services/input/agents.py
new file mode 100644
index 0000000..a603ea4
--- /dev/null
+++ b/src/services/input/agents.py
@@ -0,0 +1,68 @@
+"""
+File: /agents.py
+Created Date: Sunday December 21st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 21st 2025 4:17:39 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from src.adapters.cache import CacheAdapter
+from src.adapters.embeddings import EmbeddingsAdapter
+from src.adapters.graph import GraphAdapter
+from src.adapters.llm import LLMAdapter
+
+from src.adapters.embeddings import VectorStoreAdapter
+from src.core.agents.architect_agent import ArchitectAgent
+from src.core.agents.janitor_agent import JanitorAgent
+from src.core.agents.scout_agent import ScoutAgent
+
+from src.lib.llm.client_small import _llm_small_client
+from src.lib.redis.client import _redis_client
+from src.lib.neo4j.client import _neo4j_client
+from src.lib.embeddings.client import _embeddings_client
+from src.lib.milvus.client import _milvus_client
+
+
+# Initialze the adapters ================================
+llm_small_adapter = LLMAdapter()
+llm_small_adapter.add_client(_llm_small_client)
+
+cache_adapter = CacheAdapter()
+cache_adapter.add_client(_redis_client)
+
+graph_adapter = GraphAdapter()
+graph_adapter.add_client(_neo4j_client)
+
+embeddings_adapter = EmbeddingsAdapter()
+embeddings_adapter.add_client(_embeddings_client)
+
+vector_store_adapter = VectorStoreAdapter()
+vector_store_adapter.add_client(_milvus_client)
+
+
+# Initialize the agents ================================
+scout_agent = ScoutAgent(
+ llm_small_adapter,
+ cache_adapter,
+ kg=graph_adapter,
+ vector_store=vector_store_adapter,
+ embeddings=embeddings_adapter,
+ # database_desc=_neo4j_client.graphdb_description,
+)
+architect_agent = ArchitectAgent(
+ llm_small_adapter,
+ cache_adapter,
+ kg=graph_adapter,
+ vector_store=vector_store_adapter,
+ embeddings=embeddings_adapter,
+ # database_desc=_neo4j_client.graphdb_description,
+)
+janitor_agent = JanitorAgent(
+ llm_small_adapter,
+ kg=graph_adapter,
+ vector_store=vector_store_adapter,
+ embeddings=embeddings_adapter,
+ database_desc=_neo4j_client.graphdb_description,
+)
diff --git a/src/utils/debug/__init__.py b/src/utils/debug/__init__.py
new file mode 100644
index 0000000..fcd412a
--- /dev/null
+++ b/src/utils/debug/__init__.py
@@ -0,0 +1,9 @@
+"""
+File: /__init__.py
+Created Date: Sunday December 28th 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 28th 2025 12:00:51 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/utils/debug/logtable.py b/src/utils/debug/logtable.py
new file mode 100644
index 0000000..2ab9deb
--- /dev/null
+++ b/src/utils/debug/logtable.py
@@ -0,0 +1,40 @@
+"""
+File: /logtable.py
+Created Date: Sunday December 28th 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday December 28th 2025 12:01:04 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from datetime import datetime
+import os
+from rich.table import Table
+from rich.console import Console
+
+
+def logtable(table: list[dict], title: str = ""):
+ if not table:
+ return
+
+ all_keys = set()
+ for row in table:
+ all_keys.update(row.keys())
+
+ headers = sorted(all_keys)
+
+ rich_table = Table(title=title)
+ for header in headers:
+ rich_table.add_column(header)
+
+ for row in table:
+ rich_table.add_row(*[str(row.get(key, "")) for key in headers])
+
+ tmp_folder = os.getcwd() + "/tmp/logtable"
+ os.makedirs(tmp_folder, exist_ok=True)
+ now_timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
+ tmp_file = os.path.join(tmp_folder, f"{title}-{now_timestamp}.txt")
+ with open(tmp_file, "w") as f:
+ console = Console(file=f, force_terminal=False)
+ console.print(rich_table)
diff --git a/src/utils/normalization/__init__.py b/src/utils/normalization/__init__.py
new file mode 100644
index 0000000..05496ca
--- /dev/null
+++ b/src/utils/normalization/__init__.py
@@ -0,0 +1,9 @@
+"""
+File: /__init__.py
+Created Date: Wednesday December 31st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Wednesday December 31st 2025 9:44:37 am
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/utils/normalization/list_reduction.py b/src/utils/normalization/list_reduction.py
new file mode 100644
index 0000000..31bf0a0
--- /dev/null
+++ b/src/utils/normalization/list_reduction.py
@@ -0,0 +1,142 @@
+"""
+File: /list_reduction.py
+Created Date: Wednesday December 31st 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Wednesday December 31st 2025 9:44:49 am
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from typing import List, Optional, TypeVar
+from src.utils.similarity.vectors import cosine_similarity
+from pydantic import BaseModel
+
+from src.lib.embeddings.client_small import EmbeddingsClientSmall
+
+T = TypeVar("T")
+
+
+def _get_nested_value(obj, key_path: str):
+ """
+ Get a value from an object using a dot-separated key path.
+ Supports both object attributes and dictionary keys.
+
+ Example: _get_nested_value(obj, "a.b.c") returns obj.a.b.c or obj["a"]["b"]["c"]
+ """
+ keys = key_path.split(".")
+ current = obj
+
+ for key in keys:
+ if isinstance(current, dict):
+ if key not in current:
+ return None
+ current = current[key]
+ else:
+ if not hasattr(current, key):
+ return None
+ current = getattr(current, key)
+
+ return current
+
+
+def _is_vector(value) -> bool:
+ """
+ Check if a value is a vector (list of numbers).
+ """
+ if not isinstance(value, (list, tuple)):
+ return False
+ if len(value) == 0:
+ return False
+ return all(isinstance(x, (int, float)) for x in value)
+
+
+class Rerank(BaseModel):
+ local: str
+ with_: str
+
+
+def reduce_list(
+ list_: List[T],
+ access_key: Optional[str] = None,
+ similarity_threshold: float = 0.92,
+ by_vector: Optional[list[float]] = None,
+ rerank: Optional[Rerank] = None,
+) -> List[T]:
+ """
+ Reduce a list of items by grouping similar items together.
+ Returns a list with one representative item from each similarity group.
+
+ If access_key points to a vector (list of floats), it will be used directly.
+ If access_key points to a string, embeddings will be computed.
+
+ If by_vector is provided, items are compared to by_vector instead of each other.
+ """
+ if not list_:
+ return []
+
+ embeddings_client = EmbeddingsClientSmall()
+ reduced_list = []
+ item_embeddings = []
+
+ if rerank and isinstance(rerank, dict):
+ rerank = Rerank(**rerank)
+
+ for item in list_:
+ if access_key:
+ accessed_value = _get_nested_value(item, access_key)
+ if accessed_value is None:
+ continue
+
+ if _is_vector(accessed_value):
+ vector_item = list(accessed_value)
+ else:
+ text = str(accessed_value)
+ vector_item = embeddings_client.embed_text(text)
+ else:
+ text = str(item)
+ vector_item = embeddings_client.embed_text(text)
+ if by_vector is not None:
+ similarity = cosine_similarity(vector_item, by_vector)
+
+ rerank_similarity = None
+ if rerank and rerank.local:
+ txt_value = _get_nested_value(item, rerank.local)
+ if txt_value:
+ vector_txt_value = embeddings_client.embed_text(txt_value)
+ v_comp_txt_value = embeddings_client.embed_text(rerank.with_)
+ rerank_similarity = cosine_similarity(
+ vector_txt_value, v_comp_txt_value
+ )
+
+ if similarity >= similarity_threshold or (
+ rerank_similarity and rerank_similarity >= similarity_threshold
+ ):
+ reduced_list.append(item)
+ else:
+ is_similar = False
+
+ for i, existing_vector in enumerate(item_embeddings):
+ similarity = cosine_similarity(vector_item, existing_vector)
+
+ rerank_similarity = None
+ if rerank and rerank.local:
+ txt_value = _get_nested_value(item, rerank.local)
+ if txt_value:
+ vector_txt_value = embeddings_client.embed_text(txt_value)
+ v_comp_txt_value = embeddings_client.embed_text(rerank.with_)
+ rerank_similarity = cosine_similarity(
+ vector_txt_value, v_comp_txt_value
+ )
+
+ if similarity >= similarity_threshold or (
+ rerank_similarity and rerank_similarity >= similarity_threshold
+ ):
+ is_similar = True
+ break
+
+ if not is_similar:
+ reduced_list.append(item)
+ item_embeddings.append(vector_item)
+
+ return reduced_list
diff --git a/src/utils/serialization/natural_language.py b/src/utils/serialization/natural_language.py
new file mode 100644
index 0000000..4b3adc7
--- /dev/null
+++ b/src/utils/serialization/natural_language.py
@@ -0,0 +1,23 @@
+"""
+File: /natural_language.py
+Created Date: Friday January 2nd 2026
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Friday January 2nd 2026 10:59:44 am
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from typing import List, Tuple
+
+
+from src.constants.kg import Node, Predicate
+
+
+def hops_to_natural_language(
+ hops: List[Tuple[Node, List[Tuple[Predicate, Node, List[Tuple[Predicate, Node]]]]]],
+) -> str:
+ """
+ Currently only supports 2nd degree hops.
+ """
+ pass
diff --git a/src/utils/similarity/__init__.py b/src/utils/similarity/__init__.py
new file mode 100644
index 0000000..afa84c3
--- /dev/null
+++ b/src/utils/similarity/__init__.py
@@ -0,0 +1,9 @@
+"""
+File: /__init__.py
+Created Date: Sunday January 4th 2026
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday January 4th 2026 12:32:20 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/utils/similarity/vectors.py b/src/utils/similarity/vectors.py
new file mode 100644
index 0000000..22ebfa1
--- /dev/null
+++ b/src/utils/similarity/vectors.py
@@ -0,0 +1,29 @@
+"""
+File: /vectors.py
+Created Date: Sunday January 4th 2026
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday January 4th 2026 12:32:25 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+import numpy as np
+from typing import List
+
+
+def cosine_similarity(vec1: List[float], vec2: List[float]) -> float:
+ vec1_np = np.array(vec1)
+ vec2_np = np.array(vec2)
+ dot_product = np.dot(vec1_np, vec2_np)
+ norm1 = np.linalg.norm(vec1_np)
+ norm2 = np.linalg.norm(vec2_np)
+ if norm1 == 0 or norm2 == 0:
+ return 0.0
+ return dot_product / (norm1 * norm2)
+
+
+def euclidean_distance(vec1: List[float], vec2: List[float]) -> float:
+ vec1_np = np.array(vec1)
+ vec2_np = np.array(vec2)
+ return np.linalg.norm(vec1_np - vec2_np)
diff --git a/src/workers/app.py b/src/workers/app.py
index 400f702..18321fe 100644
--- a/src/workers/app.py
+++ b/src/workers/app.py
@@ -11,6 +11,8 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
import os
from celery import Celery
+os.environ.setdefault("GRPC_ENABLE_FORK_SUPPORT", "1")
+
REDIS_HOST = os.getenv("REDIS_HOST", "localhost")
REDIS_PORT = os.getenv("REDIS_PORT", "6379")
@@ -28,3 +30,11 @@ ingestion_app = Celery(
),
include=["src.workers.tasks.ingestion"],
)
+
+ingestion_app.conf.update(
+ worker_max_tasks_per_child=50,
+ worker_prefetch_multiplier=1,
+ task_acks_late=True,
+ task_reject_on_worker_lost=True,
+ worker_pool="threads",
+)
diff --git a/src/workers/tasks/ingestion.py b/src/workers/tasks/ingestion.py
index 9f5cb4e..af88b47 100644
--- a/src/workers/tasks/ingestion.py
+++ b/src/workers/tasks/ingestion.py
@@ -9,6 +9,8 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
"""
import json
+import tomllib
+from pathlib import Path
from uuid import uuid4
from src.constants.data import (
KGChangeLogPredicateUpdatedProperty,
@@ -21,12 +23,14 @@ from src.constants.data import (
KGChangeLogNodePropertiesUpdated,
)
from src.constants.kg import Node
+from src.constants.prompts.misc import NODE_DESCRIPTION_PROMPT
+from src.core.saving.auto_kg import enrich_kg_from_input
from src.services.api.constants.requests import IngestionStructuredRequestBody
from src.services.data.main import data_adapter
+from src.services.input.agents import llm_small_adapter
from src.services.kg_agent.main import (
embeddings_adapter,
graph_adapter,
- kg_agent,
vector_store_adapter,
)
from src.services.observations.main import observations_agent
@@ -35,9 +39,26 @@ from src.constants.tasks.ingestion import (
IngestionTaskArgs,
IngestionTaskDataType,
)
-import json
from src.services.kg_agent.main import cache_adapter
+PYPROJECT_PATH = Path(__file__).parent.parent.parent.parent / "pyproject.toml"
+with open(PYPROJECT_PATH, "rb") as f:
+ BRAIN_VERSION = tomllib.load(f)["project"]["version"]
+
+
+def format_textual_data(data: dict, include_keys: bool = True) -> str:
+ def format_value(v):
+ if isinstance(v, str):
+ return v
+ if isinstance(v, list):
+ return ", ".join(str(item) for item in v)
+ return str(v)
+
+ if include_keys:
+ return "\n".join(f"{k}: {format_value(v)}" for k, v in data.items())
+ return "\n".join(format_value(v) for v in data.values())
+
+
@ingestion_app.task(bind=True)
def ingest_data(self, args: dict):
"""
@@ -77,12 +98,13 @@ def ingest_data(self, args: dict):
else json.dumps(payload.data.json_data)
),
metadata=payload.meta_keys,
+ brain_version=BRAIN_VERSION,
),
brain_id=payload.brain_id,
)
text_chunk_vector = embeddings_adapter.embed_text(text_chunk.text)
text_chunk_vector.metadata = {
- **payload.meta_keys,
+ **(payload.meta_keys if payload.meta_keys else {}),
"resource_id": text_chunk.id,
}
vector_store_adapter.add_vectors(
@@ -116,51 +138,32 @@ def ingest_data(self, args: dict):
# ================================================
# ------------ Triplet Extraction ----------------
# ================================================
- information = f"""
- {payload.data.text_data
- if payload.data.data_type == IngestionTaskDataType.TEXT.value
- else json.dumps(payload.data.json_data)}
-
- Annotations:
- {observations}
- """
-
- kg_agent.update_kg(
- information=information,
- metadata={**payload.meta_keys, "resource_id": text_chunk.id},
- identification_params=payload.identification_params,
- preferred_entities=payload.preferred_extraction_entities,
- brain_id=payload.brain_id,
- )
+ enrich_kg_from_input(payload.data.text_data, brain_id=payload.brain_id)
result = {
"status": "completed",
"task_id": self.request.id,
"text_chunk_id": text_chunk.id,
- "observations_count": len(observations)
+ "observations_count": len(observations),
}
-
+
cache_adapter.set(
- f"task:{self.request.id}",
- json.dumps(result),
- expires_in=3600
+ f"task:{self.request.id}", json.dumps(result), expires_in=3600
)
return self.request.id
-
+
except Exception as e:
error_result = {
"status": "failed",
"task_id": self.request.id,
"error": str(e),
}
-
+
cache_adapter.set(
- f"task:{self.request.id}",
- json.dumps(error_result),
- expires_in=3600
+ f"task:{self.request.id}", json.dumps(error_result), expires_in=3600
)
-
+
raise
@@ -174,12 +177,24 @@ def ingest_structured_data(self, args: dict):
for element in payload.data:
uuid = str(uuid4())
+ description = llm_small_adapter.generate_text(
+ prompt=NODE_DESCRIPTION_PROMPT.format(
+ element=json.dumps(element.model_dump(mode="json"), indent=2),
+ element_type=", ".join(element.types) if element.types else "thing",
+ element_name=(
+ element.identification_params.name
+ if element.identification_params
+ else "the thing"
+ ),
+ )
+ )
node = graph_adapter.add_nodes(
[
Node(
uuid=uuid,
labels=element.types,
name=element.identification_params.name,
+ description=description,
properties={
**(element.json_data if element.json_data else {}),
**(
@@ -191,7 +206,9 @@ def ingest_structured_data(self, args: dict):
)
],
brain_id=payload.brain_id,
- identification_params=element.identification_params.model_dump(mode="json"),
+ identification_params=element.identification_params.model_dump(
+ mode="json"
+ ),
metadata=element.textual_data,
)[0]
@@ -234,22 +251,18 @@ def ingest_structured_data(self, args: dict):
"labels": element.types,
"name": element.identification_params.name,
},
+ brain_version=BRAIN_VERSION,
),
brain_id=payload.brain_id,
)
vector = embeddings_adapter.embed_text(
- "\n".join(
- [
- (
- v
- if isinstance(v, str)
- else (", ".join(v) if isinstance(v, list) else str(v))
- )
- for v in element.textual_data.values()
- ]
- )
+ format_textual_data(element.textual_data, include_keys=False)
+ "\n"
- + (", ".join(node.labels) if isinstance(node.labels, list) else node.labels)
+ + (
+ ", ".join(node.labels)
+ if isinstance(node.labels, list)
+ else node.labels
+ )
+ "\n"
+ node.name,
)
@@ -261,16 +274,7 @@ def ingest_structured_data(self, args: dict):
}
vector_store_adapter.add_vectors(vectors=[vector], store="data")
- text_content = "\n".join(
- [
- (
- f"{k}: {v}"
- if isinstance(v, str)
- else (f"{k}: {', '.join(v) if isinstance(v, list) else str(v)}")
- )
- for k, v in element.textual_data.items()
- ]
- )
+ text_content = format_textual_data(element.textual_data)
observations = observations_agent.observe(
text=text_content,
observate_for=payload.observate_for,
@@ -283,7 +287,9 @@ def ingest_structured_data(self, args: dict):
"labels": node.labels,
"name": node.name,
}
- vector_store_adapter.add_vectors(vectors=[obs_vector], store="observations")
+ vector_store_adapter.add_vectors(
+ vectors=[obs_vector], store="observations"
+ )
if len(observations) > 0:
data_adapter.save_observations(
[
@@ -301,39 +307,31 @@ def ingest_structured_data(self, args: dict):
brain_id=payload.brain_id,
)
- # TODO: + vectorize the predicates and new nodes + save changelog&vectors
- kg_agent.structured_update_kg(
- main_node=node,
- textual_data=element.textual_data,
- identification_params=element.identification_params.model_dump(mode="json"),
- brain_id=payload.brain_id,
+ enrich_kg_from_input(
+ element.textual_data, targeting=node, brain_id=payload.brain_id
)
result = {
"status": "completed",
"task_id": self.request.id,
- "ingested_count": len(payload.data)
+ "ingested_count": len(payload.data),
}
-
+
cache_adapter.set(
- f"task:{self.request.id}",
- json.dumps(result),
- expires_in=3600
+ f"task:{self.request.id}", json.dumps(result), expires_in=3600
)
return self.request.id
-
+
except Exception as e:
error_result = {
"status": "failed",
"task_id": self.request.id,
"error": str(e),
}
-
+
cache_adapter.set(
- f"task:{self.request.id}",
- json.dumps(error_result),
- expires_in=3600
+ f"task:{self.request.id}", json.dumps(error_result), expires_in=3600
)
-
- raise
\ No newline at end of file
+
+ raise