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.
Python ai-agentsai-memoryknowledge-graphknowledge-managementknowledge-representationreccomendation-system
wip(kg agent)
Christianf754da77bb7b
diff --git a/.gitignore b/.gitignoreindex a5c8936..d69adcf 100644--- a/.gitignore+++ b/.gitignore@@ -1,2 +1,4 @@.vscode-.env\ No newline at end of file+.env+volumes+__pycache__diff --git a/Makefile b/Makefileindex bcef7a2..1b6c499 100644--- a/Makefile+++ b/Makefile@@ -26,21 +26,41 @@ delete-redis-volumes:docker compose -f src/lib/redis/docker-compose.yaml down -v --remove-orphans+start-neo4j:+ docker compose -f src/lib/neo4j/docker-compose.yaml up -d++stop-neo4j:+ docker compose -f src/lib/neo4j/docker-compose.yaml down++delete-neo4j-volumes:+ docker compose -f src/lib/neo4j/docker-compose.yaml down -v --remove-orphans++start-api:+ poetry run uvicorn src.services.api.app:app --host 0.0.0.0 --port 8000++stop-api:+ pkill -f uvicorn++start-all:- start-milvus- start-rabbitmq- start-redis- @bash -c `- poetry run celery -A src.workers.app worker --loglevel=info- `+ export ENV=development+ make start-milvus &+ make start-rabbitmq &+ make start-redis &+ make start-neo4j &+ make start-api &+ @bash -c "poetry run celery -A src.workers.app worker --loglevel=info"stop-all:- stop-milvus- stop-rabbitmq- stop-redis+ make stop-milvus+ make stop-rabbitmq+ make stop-redis+ make stop-neo4j+ make stop-apipkill -f celeryclear-all-volumes:- delete-milvus-volumes- delete-rabbitmq-volumes- delete-redis-volumes\ No newline at end of file+ make delete-milvus-volumes+ make delete-rabbitmq-volumes+ make delete-redis-volumes+ make delete-neo4j-volumes\ No newline at end of filediff --git a/poetry.lock b/poetry.lockindex 435d900..270b11e 100644--- a/poetry.lock+++ b/poetry.lock@@ -762,6 +762,23 @@ pyyaml = ">=5.3.0,<7.0.0"tenacity = ">=8.1.0,<8.4.0 || >8.4.0,<10.0.0"typing-extensions = ">=4.7.0,<5.0.0"+[[package]]+name = "langchain-openai"+version = "1.0.0"+description = "An integration package connecting OpenAI and LangChain"+optional = false+python-versions = "<4.0.0,>=3.10.0"+groups = ["main"]+files = [+ {file = "langchain_openai-1.0.0-py3-none-any.whl", hash = "sha256:e42b856ae53d2f6f3afd2ecb875056025d8c0b8f313a89fc66eb682c6b958111"},+ {file = "langchain_openai-1.0.0.tar.gz", hash = "sha256:14b4f8e77e2ace62e390fe4824f08718b227ed86b476983ce4f0063fa258e966"},+]++[package.dependencies]+langchain-core = ">=1.0.0,<2.0.0"+openai = ">=1.109.1,<3.0.0"+tiktoken = ">=0.7.0,<1.0.0"+[[package]]name = "langgraph"version = "1.0.0"@@ -1440,6 +1457,21 @@ files = [[package.dependencies]six = ">=1.5"+[[package]]+name = "python-dotenv"+version = "1.1.1"+description = "Read key-value pairs from a .env file and set them as environment variables"+optional = false+python-versions = ">=3.9"+groups = ["main"]+files = [+ {file = "python_dotenv-1.1.1-py3-none-any.whl", hash = "sha256:31f23644fe2602f88ff55e1f5c79ba497e01224ee7737937930c448e4d0e24dc"},+ {file = "python_dotenv-1.1.1.tar.gz", hash = "sha256:a8a6399716257f45be6a007360200409fce5cda2661e3dec71d23dc15f6189ab"},+]++[package.extras]+cli = ["click (>=5.0)"]+[[package]]name = "pytz"version = "2025.2"@@ -1555,6 +1587,131 @@ hiredis = ["hiredis (>=3.2.0)"]jwt = ["pyjwt (>=2.9.0)"]ocsp = ["cryptography (>=36.0.1)", "pyopenssl (>=20.0.1)", "requests (>=2.31.0)"]+[[package]]+name = "regex"+version = "2025.9.18"+description = "Alternative regular expression module, to replace re."+optional = false+python-versions = ">=3.9"+groups = ["main"]+files = [+ {file = "regex-2025.9.18-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:12296202480c201c98a84aecc4d210592b2f55e200a1d193235c4db92b9f6788"},+ {file = "regex-2025.9.18-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:220381f1464a581f2ea988f2220cf2a67927adcef107d47d6897ba5a2f6d51a4"},+ {file = "regex-2025.9.18-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:87f681bfca84ebd265278b5daa1dcb57f4db315da3b5d044add7c30c10442e61"},+ {file = "regex-2025.9.18-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:34d674cbba70c9398074c8a1fcc1a79739d65d1105de2a3c695e2b05ea728251"},+ {file = "regex-2025.9.18-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:385c9b769655cb65ea40b6eea6ff763cbb6d69b3ffef0b0db8208e1833d4e746"},+ {file = "regex-2025.9.18-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:8900b3208e022570ae34328712bef6696de0804c122933414014bae791437ab2"},+ {file = "regex-2025.9.18-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c204e93bf32cd7a77151d44b05eb36f469d0898e3fba141c026a26b79d9914a0"},+ {file = "regex-2025.9.18-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3acc471d1dd7e5ff82e6cacb3b286750decd949ecd4ae258696d04f019817ef8"},+ {file = "regex-2025.9.18-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:6479d5555122433728760e5f29edb4c2b79655a8deb681a141beb5c8a025baea"},+ {file = "regex-2025.9.18-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:431bd2a8726b000eb6f12429c9b438a24062a535d06783a93d2bcbad3698f8a8"},+ {file = "regex-2025.9.18-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:0cc3521060162d02bd36927e20690129200e5ac9d2c6d32b70368870b122db25"},+ {file = "regex-2025.9.18-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:a021217b01be2d51632ce056d7a837d3fa37c543ede36e39d14063176a26ae29"},+ {file = "regex-2025.9.18-cp310-cp310-win32.whl", hash = "sha256:4a12a06c268a629cb67cc1d009b7bb0be43e289d00d5111f86a2efd3b1949444"},+ {file = "regex-2025.9.18-cp310-cp310-win_amd64.whl", hash = "sha256:47acd811589301298c49db2c56bde4f9308d6396da92daf99cba781fa74aa450"},+ {file = "regex-2025.9.18-cp310-cp310-win_arm64.whl", hash = "sha256:16bd2944e77522275e5ee36f867e19995bcaa533dcb516753a26726ac7285442"},+ {file = "regex-2025.9.18-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:51076980cd08cd13c88eb7365427ae27f0d94e7cebe9ceb2bb9ffdae8fc4d82a"},+ {file = "regex-2025.9.18-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:828446870bd7dee4e0cbeed767f07961aa07f0ea3129f38b3ccecebc9742e0b8"},+ {file = "regex-2025.9.18-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c28821d5637866479ec4cc23b8c990f5bc6dd24e5e4384ba4a11d38a526e1414"},+ {file = "regex-2025.9.18-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:726177ade8e481db669e76bf99de0b278783be8acd11cef71165327abd1f170a"},+ {file = "regex-2025.9.18-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f5cca697da89b9f8ea44115ce3130f6c54c22f541943ac8e9900461edc2b8bd4"},+ {file = "regex-2025.9.18-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:dfbde38f38004703c35666a1e1c088b778e35d55348da2b7b278914491698d6a"},+ {file = "regex-2025.9.18-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f2f422214a03fab16bfa495cfec72bee4aaa5731843b771860a471282f1bf74f"},+ {file = "regex-2025.9.18-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:a295916890f4df0902e4286bc7223ee7f9e925daa6dcdec4192364255b70561a"},+ {file = "regex-2025.9.18-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:5db95ff632dbabc8c38c4e82bf545ab78d902e81160e6e455598014f0abe66b9"},+ {file = "regex-2025.9.18-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:fb967eb441b0f15ae610b7069bdb760b929f267efbf522e814bbbfffdf125ce2"},+ {file = "regex-2025.9.18-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f04d2f20da4053d96c08f7fde6e1419b7ec9dbcee89c96e3d731fca77f411b95"},+ {file = "regex-2025.9.18-cp311-cp311-win32.whl", hash = "sha256:895197241fccf18c0cea7550c80e75f185b8bd55b6924fcae269a1a92c614a07"},+ {file = "regex-2025.9.18-cp311-cp311-win_amd64.whl", hash = "sha256:7e2b414deae99166e22c005e154a5513ac31493db178d8aec92b3269c9cce8c9"},+ {file = "regex-2025.9.18-cp311-cp311-win_arm64.whl", hash = "sha256:fb137ec7c5c54f34a25ff9b31f6b7b0c2757be80176435bf367111e3f71d72df"},+ {file = "regex-2025.9.18-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:436e1b31d7efd4dcd52091d076482031c611dde58bf9c46ca6d0a26e33053a7e"},+ {file = "regex-2025.9.18-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:c190af81e5576b9c5fdc708f781a52ff20f8b96386c6e2e0557a78402b029f4a"},+ {file = "regex-2025.9.18-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e4121f1ce2b2b5eec4b397cc1b277686e577e658d8f5870b7eb2d726bd2300ab"},+ {file = "regex-2025.9.18-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:300e25dbbf8299d87205e821a201057f2ef9aa3deb29caa01cd2cac669e508d5"},+ {file = "regex-2025.9.18-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:7b47fcf9f5316c0bdaf449e879407e1b9937a23c3b369135ca94ebc8d74b1742"},+ {file = "regex-2025.9.18-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:57a161bd3acaa4b513220b49949b07e252165e6b6dc910ee7617a37ff4f5b425"},+ {file = "regex-2025.9.18-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f130c3a7845ba42de42f380fff3c8aebe89a810747d91bcf56d40a069f15352"},+ {file = "regex-2025.9.18-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:5f96fa342b6f54dcba928dd452e8d8cb9f0d63e711d1721cd765bb9f73bb048d"},+ {file = "regex-2025.9.18-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:0f0d676522d68c207828dcd01fb6f214f63f238c283d9f01d85fc664c7c85b56"},+ {file = "regex-2025.9.18-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:40532bff8a1a0621e7903ae57fce88feb2e8a9a9116d341701302c9302aef06e"},+ {file = "regex-2025.9.18-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:039f11b618ce8d71a1c364fdee37da1012f5a3e79b1b2819a9f389cd82fd6282"},+ {file = "regex-2025.9.18-cp312-cp312-win32.whl", hash = "sha256:e1dd06f981eb226edf87c55d523131ade7285137fbde837c34dc9d1bf309f459"},+ {file = "regex-2025.9.18-cp312-cp312-win_amd64.whl", hash = "sha256:3d86b5247bf25fa3715e385aa9ff272c307e0636ce0c9595f64568b41f0a9c77"},+ {file = "regex-2025.9.18-cp312-cp312-win_arm64.whl", hash = "sha256:032720248cbeeae6444c269b78cb15664458b7bb9ed02401d3da59fe4d68c3a5"},+ {file = "regex-2025.9.18-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:2a40f929cd907c7e8ac7566ac76225a77701a6221bca937bdb70d56cb61f57b2"},+ {file = "regex-2025.9.18-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:c90471671c2cdf914e58b6af62420ea9ecd06d1554d7474d50133ff26ae88feb"},+ {file = "regex-2025.9.18-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1a351aff9e07a2dabb5022ead6380cff17a4f10e4feb15f9100ee56c4d6d06af"},+ {file = "regex-2025.9.18-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bc4b8e9d16e20ddfe16430c23468a8707ccad3365b06d4536142e71823f3ca29"},+ {file = "regex-2025.9.18-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4b8cdbddf2db1c5e80338ba2daa3cfa3dec73a46fff2a7dda087c8efbf12d62f"},+ {file = "regex-2025.9.18-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a276937d9d75085b2c91fb48244349c6954f05ee97bba0963ce24a9d915b8b68"},+ {file = "regex-2025.9.18-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:92a8e375ccdc1256401c90e9dc02b8642894443d549ff5e25e36d7cf8a80c783"},+ {file = "regex-2025.9.18-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0dc6893b1f502d73037cf807a321cdc9be29ef3d6219f7970f842475873712ac"},+ {file = "regex-2025.9.18-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:a61e85bfc63d232ac14b015af1261f826260c8deb19401c0597dbb87a864361e"},+ {file = "regex-2025.9.18-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:1ef86a9ebc53f379d921fb9a7e42b92059ad3ee800fcd9e0fe6181090e9f6c23"},+ {file = "regex-2025.9.18-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:d3bc882119764ba3a119fbf2bd4f1b47bc56c1da5d42df4ed54ae1e8e66fdf8f"},+ {file = "regex-2025.9.18-cp313-cp313-win32.whl", hash = "sha256:3810a65675845c3bdfa58c3c7d88624356dd6ee2fc186628295e0969005f928d"},+ {file = "regex-2025.9.18-cp313-cp313-win_amd64.whl", hash = "sha256:16eaf74b3c4180ede88f620f299e474913ab6924d5c4b89b3833bc2345d83b3d"},+ {file = "regex-2025.9.18-cp313-cp313-win_arm64.whl", hash = "sha256:4dc98ba7dd66bd1261927a9f49bd5ee2bcb3660f7962f1ec02617280fc00f5eb"},+ {file = "regex-2025.9.18-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:fe5d50572bc885a0a799410a717c42b1a6b50e2f45872e2b40f4f288f9bce8a2"},+ {file = "regex-2025.9.18-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:1b9d9a2d6cda6621551ca8cf7a06f103adf72831153f3c0d982386110870c4d3"},+ {file = "regex-2025.9.18-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:13202e4c4ac0ef9a317fff817674b293c8f7e8c68d3190377d8d8b749f566e12"},+ {file = "regex-2025.9.18-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:874ff523b0fecffb090f80ae53dc93538f8db954c8bb5505f05b7787ab3402a0"},+ {file = "regex-2025.9.18-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d13ab0490128f2bb45d596f754148cd750411afc97e813e4b3a61cf278a23bb6"},+ {file = "regex-2025.9.18-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:05440bc172bc4b4b37fb9667e796597419404dbba62e171e1f826d7d2a9ebcef"},+ {file = "regex-2025.9.18-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5514b8e4031fdfaa3d27e92c75719cbe7f379e28cacd939807289bce76d0e35a"},+ {file = "regex-2025.9.18-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:65d3c38c39efce73e0d9dc019697b39903ba25b1ad45ebbd730d2cf32741f40d"},+ {file = "regex-2025.9.18-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:ae77e447ebc144d5a26d50055c6ddba1d6ad4a865a560ec7200b8b06bc529368"},+ {file = "regex-2025.9.18-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:e3ef8cf53dc8df49d7e28a356cf824e3623764e9833348b655cfed4524ab8a90"},+ {file = "regex-2025.9.18-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:9feb29817df349c976da9a0debf775c5c33fc1c8ad7b9f025825da99374770b7"},+ {file = "regex-2025.9.18-cp313-cp313t-win32.whl", hash = "sha256:168be0d2f9b9d13076940b1ed774f98595b4e3c7fc54584bba81b3cc4181742e"},+ {file = "regex-2025.9.18-cp313-cp313t-win_amd64.whl", hash = "sha256:d59ecf3bb549e491c8104fea7313f3563c7b048e01287db0a90485734a70a730"},+ {file = "regex-2025.9.18-cp313-cp313t-win_arm64.whl", hash = "sha256:dbef80defe9fb21310948a2595420b36c6d641d9bea4c991175829b2cc4bc06a"},+ {file = "regex-2025.9.18-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:c6db75b51acf277997f3adcd0ad89045d856190d13359f15ab5dda21581d9129"},+ {file = "regex-2025.9.18-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:8f9698b6f6895d6db810e0bda5364f9ceb9e5b11328700a90cae573574f61eea"},+ {file = "regex-2025.9.18-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:29cd86aa7cb13a37d0f0d7c21d8d949fe402ffa0ea697e635afedd97ab4b69f1"},+ {file = "regex-2025.9.18-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7c9f285a071ee55cd9583ba24dde006e53e17780bb309baa8e4289cd472bcc47"},+ {file = "regex-2025.9.18-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5adf266f730431e3be9021d3e5b8d5ee65e563fec2883ea8093944d21863b379"},+ {file = "regex-2025.9.18-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:1137cabc0f38807de79e28d3f6e3e3f2cc8cfb26bead754d02e6d1de5f679203"},+ {file = "regex-2025.9.18-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7cc9e5525cada99699ca9223cce2d52e88c52a3d2a0e842bd53de5497c604164"},+ {file = "regex-2025.9.18-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:bbb9246568f72dce29bcd433517c2be22c7791784b223a810225af3b50d1aafb"},+ {file = "regex-2025.9.18-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:6a52219a93dd3d92c675383efff6ae18c982e2d7651c792b1e6d121055808743"},+ {file = "regex-2025.9.18-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:ae9b3840c5bd456780e3ddf2f737ab55a79b790f6409182012718a35c6d43282"},+ {file = "regex-2025.9.18-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:d488c236ac497c46a5ac2005a952c1a0e22a07be9f10c3e735bc7d1209a34773"},+ {file = "regex-2025.9.18-cp314-cp314-win32.whl", hash = "sha256:0c3506682ea19beefe627a38872d8da65cc01ffa25ed3f2e422dffa1474f0788"},+ {file = "regex-2025.9.18-cp314-cp314-win_amd64.whl", hash = "sha256:57929d0f92bebb2d1a83af372cd0ffba2263f13f376e19b1e4fa32aec4efddc3"},+ {file = "regex-2025.9.18-cp314-cp314-win_arm64.whl", hash = "sha256:6a4b44df31d34fa51aa5c995d3aa3c999cec4d69b9bd414a8be51984d859f06d"},+ {file = "regex-2025.9.18-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:b176326bcd544b5e9b17d6943f807697c0cb7351f6cfb45bf5637c95ff7e6306"},+ {file = "regex-2025.9.18-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:0ffd9e230b826b15b369391bec167baed57c7ce39efc35835448618860995946"},+ {file = "regex-2025.9.18-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ec46332c41add73f2b57e2f5b642f991f6b15e50e9f86285e08ffe3a512ac39f"},+ {file = "regex-2025.9.18-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b80fa342ed1ea095168a3f116637bd1030d39c9ff38dc04e54ef7c521e01fc95"},+ {file = "regex-2025.9.18-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f4d97071c0ba40f0cf2a93ed76e660654c399a0a04ab7d85472239460f3da84b"},+ {file = "regex-2025.9.18-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:0ac936537ad87cef9e0e66c5144484206c1354224ee811ab1519a32373e411f3"},+ {file = "regex-2025.9.18-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dec57f96d4def58c422d212d414efe28218d58537b5445cf0c33afb1b4768571"},+ {file = "regex-2025.9.18-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:48317233294648bf7cd068857f248e3a57222259a5304d32c7552e2284a1b2ad"},+ {file = "regex-2025.9.18-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:274687e62ea3cf54846a9b25fc48a04459de50af30a7bd0b61a9e38015983494"},+ {file = "regex-2025.9.18-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:a78722c86a3e7e6aadf9579e3b0ad78d955f2d1f1a8ca4f67d7ca258e8719d4b"},+ {file = "regex-2025.9.18-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:06104cd203cdef3ade989a1c45b6215bf42f8b9dd705ecc220c173233f7cba41"},+ {file = "regex-2025.9.18-cp314-cp314t-win32.whl", hash = "sha256:2e1eddc06eeaffd249c0adb6fafc19e2118e6308c60df9db27919e96b5656096"},+ {file = "regex-2025.9.18-cp314-cp314t-win_amd64.whl", hash = "sha256:8620d247fb8c0683ade51217b459cb4a1081c0405a3072235ba43a40d355c09a"},+ {file = "regex-2025.9.18-cp314-cp314t-win_arm64.whl", hash = "sha256:b7531a8ef61de2c647cdf68b3229b071e46ec326b3138b2180acb4275f470b01"},+ {file = "regex-2025.9.18-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:3dbcfcaa18e9480669030d07371713c10b4f1a41f791ffa5cb1a99f24e777f40"},+ {file = "regex-2025.9.18-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1e85f73ef7095f0380208269055ae20524bfde3f27c5384126ddccf20382a638"},+ {file = "regex-2025.9.18-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9098e29b3ea4ffffeade423f6779665e2a4f8db64e699c0ed737ef0db6ba7b12"},+ {file = "regex-2025.9.18-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:90b6b7a2d0f45b7ecaaee1aec6b362184d6596ba2092dd583ffba1b78dd0231c"},+ {file = "regex-2025.9.18-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c81b892af4a38286101502eae7aec69f7cd749a893d9987a92776954f3943408"},+ {file = "regex-2025.9.18-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:3b524d010973f2e1929aeb635418d468d869a5f77b52084d9f74c272189c251d"},+ {file = "regex-2025.9.18-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6b498437c026a3d5d0be0020023ff76d70ae4d77118e92f6f26c9d0423452446"},+ {file = "regex-2025.9.18-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:0716e4d6e58853d83f6563f3cf25c281ff46cf7107e5f11879e32cb0b59797d9"},+ {file = "regex-2025.9.18-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:065b6956749379d41db2625f880b637d4acc14c0a4de0d25d609a62850e96d36"},+ {file = "regex-2025.9.18-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:d4a691494439287c08ddb9b5793da605ee80299dd31e95fa3f323fac3c33d9d4"},+ {file = "regex-2025.9.18-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:ef8d10cc0989565bcbe45fb4439f044594d5c2b8919d3d229ea2c4238f1d55b0"},+ {file = "regex-2025.9.18-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:4baeb1b16735ac969a7eeecc216f1f8b7caf60431f38a2671ae601f716a32d25"},+ {file = "regex-2025.9.18-cp39-cp39-win32.whl", hash = "sha256:8e5f41ad24a1e0b5dfcf4c4e5d9f5bd54c895feb5708dd0c1d0d35693b24d478"},+ {file = "regex-2025.9.18-cp39-cp39-win_amd64.whl", hash = "sha256:50e8290707f2fb8e314ab3831e594da71e062f1d623b05266f8cfe4db4949afd"},+ {file = "regex-2025.9.18-cp39-cp39-win_arm64.whl", hash = "sha256:039a9d7195fd88c943d7c777d4941e8ef736731947becce773c31a1009cb3c35"},+ {file = "regex-2025.9.18.tar.gz", hash = "sha256:c5ba23274c61c6fef447ba6a39333297d0c247f53059dba0bca415cac511edc4"},+]+[[package]]name = "requests"version = "2.32.5"@@ -1651,6 +1808,80 @@ files = [doc = ["reno", "sphinx"]test = ["pytest", "tornado (>=4.5)", "typeguard"]+[[package]]+name = "tiktoken"+version = "0.12.0"+description = "tiktoken is a fast BPE tokeniser for use with OpenAI's models"+optional = false+python-versions = ">=3.9"+groups = ["main"]+files = [+ {file = "tiktoken-0.12.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:3de02f5a491cfd179aec916eddb70331814bd6bf764075d39e21d5862e533970"},+ {file = "tiktoken-0.12.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b6cfb6d9b7b54d20af21a912bfe63a2727d9cfa8fbda642fd8322c70340aad16"},+ {file = "tiktoken-0.12.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:cde24cdb1b8a08368f709124f15b36ab5524aac5fa830cc3fdce9c03d4fb8030"},+ {file = "tiktoken-0.12.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:6de0da39f605992649b9cfa6f84071e3f9ef2cec458d08c5feb1b6f0ff62e134"},+ {file = "tiktoken-0.12.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:6faa0534e0eefbcafaccb75927a4a380463a2eaa7e26000f0173b920e98b720a"},+ {file = "tiktoken-0.12.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:82991e04fc860afb933efb63957affc7ad54f83e2216fe7d319007dab1ba5892"},+ {file = "tiktoken-0.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:6fb2995b487c2e31acf0a9e17647e3b242235a20832642bb7a9d1a181c0c1bb1"},+ {file = "tiktoken-0.12.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:6e227c7f96925003487c33b1b32265fad2fbcec2b7cf4817afb76d416f40f6bb"},+ {file = "tiktoken-0.12.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c06cf0fcc24c2cb2adb5e185c7082a82cba29c17575e828518c2f11a01f445aa"},+ {file = "tiktoken-0.12.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:f18f249b041851954217e9fd8e5c00b024ab2315ffda5ed77665a05fa91f42dc"},+ {file = "tiktoken-0.12.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:47a5bc270b8c3db00bb46ece01ef34ad050e364b51d406b6f9730b64ac28eded"},+ {file = "tiktoken-0.12.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:508fa71810c0efdcd1b898fda574889ee62852989f7c1667414736bcb2b9a4bd"},+ {file = "tiktoken-0.12.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a1af81a6c44f008cba48494089dd98cccb8b313f55e961a52f5b222d1e507967"},+ {file = "tiktoken-0.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:3e68e3e593637b53e56f7237be560f7a394451cb8c11079755e80ae64b9e6def"},+ {file = "tiktoken-0.12.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b97f74aca0d78a1ff21b8cd9e9925714c15a9236d6ceacf5c7327c117e6e21e8"},+ {file = "tiktoken-0.12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2b90f5ad190a4bb7c3eb30c5fa32e1e182ca1ca79f05e49b448438c3e225a49b"},+ {file = "tiktoken-0.12.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:65b26c7a780e2139e73acc193e5c63ac754021f160df919add909c1492c0fb37"},+ {file = "tiktoken-0.12.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:edde1ec917dfd21c1f2f8046b86348b0f54a2c0547f68149d8600859598769ad"},+ {file = "tiktoken-0.12.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:35a2f8ddd3824608b3d650a000c1ef71f730d0c56486845705a8248da00f9fe5"},+ {file = "tiktoken-0.12.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:83d16643edb7fa2c99eff2ab7733508aae1eebb03d5dfc46f5565862810f24e3"},+ {file = "tiktoken-0.12.0-cp312-cp312-win_amd64.whl", hash = "sha256:ffc5288f34a8bc02e1ea7047b8d041104791d2ddbf42d1e5fa07822cbffe16bd"},+ {file = "tiktoken-0.12.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:775c2c55de2310cc1bc9a3ad8826761cbdc87770e586fd7b6da7d4589e13dab3"},+ {file = "tiktoken-0.12.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a01b12f69052fbe4b080a2cfb867c4de12c704b56178edf1d1d7b273561db160"},+ {file = "tiktoken-0.12.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:01d99484dc93b129cd0964f9d34eee953f2737301f18b3c7257bf368d7615baa"},+ {file = "tiktoken-0.12.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:4a1a4fcd021f022bfc81904a911d3df0f6543b9e7627b51411da75ff2fe7a1be"},+ {file = "tiktoken-0.12.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:981a81e39812d57031efdc9ec59fa32b2a5a5524d20d4776574c4b4bd2e9014a"},+ {file = "tiktoken-0.12.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:9baf52f84a3f42eef3ff4e754a0db79a13a27921b457ca9832cf944c6be4f8f3"},+ {file = "tiktoken-0.12.0-cp313-cp313-win_amd64.whl", hash = "sha256:b8a0cd0c789a61f31bf44851defbd609e8dd1e2c8589c614cc1060940ef1f697"},+ {file = "tiktoken-0.12.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:d5f89ea5680066b68bcb797ae85219c72916c922ef0fcdd3480c7d2315ffff16"},+ {file = "tiktoken-0.12.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b4e7ed1c6a7a8a60a3230965bdedba8cc58f68926b835e519341413370e0399a"},+ {file = "tiktoken-0.12.0-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:fc530a28591a2d74bce821d10b418b26a094bf33839e69042a6e86ddb7a7fb27"},+ {file = "tiktoken-0.12.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:06a9f4f49884139013b138920a4c393aa6556b2f8f536345f11819389c703ebb"},+ {file = "tiktoken-0.12.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:04f0e6a985d95913cabc96a741c5ffec525a2c72e9df086ff17ebe35985c800e"},+ {file = "tiktoken-0.12.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:0ee8f9ae00c41770b5f9b0bb1235474768884ae157de3beb5439ca0fd70f3e25"},+ {file = "tiktoken-0.12.0-cp313-cp313t-win_amd64.whl", hash = "sha256:dc2dd125a62cb2b3d858484d6c614d136b5b848976794edfb63688d539b8b93f"},+ {file = "tiktoken-0.12.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:a90388128df3b3abeb2bfd1895b0681412a8d7dc644142519e6f0a97c2111646"},+ {file = "tiktoken-0.12.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:da900aa0ad52247d8794e307d6446bd3cdea8e192769b56276695d34d2c9aa88"},+ {file = "tiktoken-0.12.0-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:285ba9d73ea0d6171e7f9407039a290ca77efcdb026be7769dccc01d2c8d7fff"},+ {file = "tiktoken-0.12.0-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:d186a5c60c6a0213f04a7a802264083dea1bbde92a2d4c7069e1a56630aef830"},+ {file = "tiktoken-0.12.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:604831189bd05480f2b885ecd2d1986dc7686f609de48208ebbbddeea071fc0b"},+ {file = "tiktoken-0.12.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:8f317e8530bb3a222547b85a58583238c8f74fd7a7408305f9f63246d1a0958b"},+ {file = "tiktoken-0.12.0-cp314-cp314-win_amd64.whl", hash = "sha256:399c3dd672a6406719d84442299a490420b458c44d3ae65516302a99675888f3"},+ {file = "tiktoken-0.12.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:c2c714c72bc00a38ca969dae79e8266ddec999c7ceccd603cc4f0d04ccd76365"},+ {file = "tiktoken-0.12.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:cbb9a3ba275165a2cb0f9a83f5d7025afe6b9d0ab01a22b50f0e74fee2ad253e"},+ {file = "tiktoken-0.12.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:dfdfaa5ffff8993a3af94d1125870b1d27aed7cb97aa7eb8c1cefdbc87dbee63"},+ {file = "tiktoken-0.12.0-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:584c3ad3d0c74f5269906eb8a659c8bfc6144a52895d9261cdaf90a0ae5f4de0"},+ {file = "tiktoken-0.12.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:54c891b416a0e36b8e2045b12b33dd66fb34a4fe7965565f1b482da50da3e86a"},+ {file = "tiktoken-0.12.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5edb8743b88d5be814b1a8a8854494719080c28faaa1ccbef02e87354fe71ef0"},+ {file = "tiktoken-0.12.0-cp314-cp314t-win_amd64.whl", hash = "sha256:f61c0aea5565ac82e2ec50a05e02a6c44734e91b51c10510b084ea1b8e633a71"},+ {file = "tiktoken-0.12.0-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:d51d75a5bffbf26f86554d28e78bfb921eae998edc2675650fd04c7e1f0cdc1e"},+ {file = "tiktoken-0.12.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:09eb4eae62ae7e4c62364d9ec3a57c62eea707ac9a2b2c5d6bd05de6724ea179"},+ {file = "tiktoken-0.12.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:df37684ace87d10895acb44b7f447d4700349b12197a526da0d4a4149fde074c"},+ {file = "tiktoken-0.12.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:4c9614597ac94bb294544345ad8cf30dac2129c05e2db8dc53e082f355857af7"},+ {file = "tiktoken-0.12.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:20cf97135c9a50de0b157879c3c4accbb29116bcf001283d26e073ff3b345946"},+ {file = "tiktoken-0.12.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:15d875454bbaa3728be39880ddd11a5a2a9e548c29418b41e8fd8a767172b5ec"},+ {file = "tiktoken-0.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:2cff3688ba3c639ebe816f8d58ffbbb0aa7433e23e08ab1cade5d175fc973fb3"},+ {file = "tiktoken-0.12.0.tar.gz", hash = "sha256:b18ba7ee2b093863978fcb14f74b3707cdc8d4d4d3836853ce7ec60772139931"},+]++[package.dependencies]+regex = ">=2022.1.18"+requests = ">=2.26.0"++[package.extras]+blobfile = ["blobfile (>=2)"]+[[package]]name = "tomlkit"version = "0.13.3"@@ -1742,6 +1973,25 @@ h2 = ["h2 (>=4,<5)"]socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]zstd = ["zstandard (>=0.18.0)"]+[[package]]+name = "uvicorn"+version = "0.38.0"+description = "The lightning-fast ASGI server."+optional = false+python-versions = ">=3.9"+groups = ["main"]+files = [+ {file = "uvicorn-0.38.0-py3-none-any.whl", hash = "sha256:48c0afd214ceb59340075b4a052ea1ee91c16fbc2a9b1469cca0e54566977b02"},+ {file = "uvicorn-0.38.0.tar.gz", hash = "sha256:fd97093bdd120a2609fc0d3afe931d4d4ad688b6e75f0f929fde1bc36fe0e91d"},+]++[package.dependencies]+click = ">=7.0"+h11 = ">=0.8"++[package.extras]+standard = ["colorama (>=0.4) ; sys_platform == \"win32\"", "httptools (>=0.6.3)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.15.1) ; sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\"", "watchfiles (>=0.13)", "websockets (>=10.4)"]+[[package]]name = "vine"version = "5.1.0"@@ -2031,4 +2281,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 = "c9da0560aaa8985829f13611af2e74224ebac9c2795f7c5cf6fe0dec43f70a49"+content-hash = "7f9b09bf35a655c0b4569d26e655560be9ef66068474a896b6872302e335bd0b"diff --git a/pyproject.toml b/pyproject.tomlindex effbd15..5aa70c1 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -19,7 +19,10 @@ dependencies = ["celery (>=5.5.3,<6.0.0)","kombu[rabbitmq] (>=5.3.0,<6.0.0)","fastapi (>=0.119.0,<0.120.0)",- "langchain-core (>=1.0.0,<2.0.0)"+ "langchain-core (>=1.0.0,<2.0.0)",+ "uvicorn (>=0.38.0,<0.39.0)",+ "python-dotenv (>=1.1.1,<2.0.0)",+ "langchain-openai (>=1.0.0,<2.0.0)"][tool.poetry]diff --git a/src/adapters/graph.py b/src/adapters/graph.pyindex 2f95e46..bd76084 100644--- a/src/adapters/graph.py+++ b/src/adapters/graph.py@@ -27,6 +27,14 @@ class GraphAdapter:"""return self.graph.graphdb_type+ @property+ def graphdb_description(self) -> str:+ """+ This is the description of the graph database.+ It is used to let the agent know which syntax to use.+ """+ return self.graph.graphdb_description+def add_client(self, client: GraphClient) -> None:"""Add a graph client to the adapter.@@ -37,7 +45,11 @@ class GraphAdapter:"""Execute a graph operation."""- return self.graph.execute_operation(operation)+ try:+ return self.graph.execute_operation(operation)+ except Exception as e: # pylint: disable=broad-exception-caught+ print(f"Error executing graph operation: {e} - {operation}")+ return f"Error executing graph operation: {e}"_graph_adapter = GraphAdapter()diff --git a/src/adapters/interfaces/graph.py b/src/adapters/interfaces/graph.pyindex 1fd1959..4cb77ab 100644--- a/src/adapters/interfaces/graph.py+++ b/src/adapters/interfaces/graph.py@@ -16,6 +16,14 @@ class GraphClient(ABC):Abstract base class for graph clients."""+ @property+ @abstractmethod+ def graphdb_description(self) -> str:+ """+ Get the description of the graph database.+ """+ raise NotImplementedError("graphdb_description method not implemented")+@property@abstractmethoddef graphdb_type(self) -> str:diff --git a/src/adapters/interfaces/llm.py b/src/adapters/interfaces/llm.pyindex 2405592..e8a8021 100644--- a/src/adapters/interfaces/llm.py+++ b/src/adapters/interfaces/llm.py@@ -10,12 +10,16 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@from abc import ABC, abstractmethod+from langchain.chat_models.base import BaseChatModel+class LLM(ABC):"""Abstract base class for LLM clients."""+ langchain_model: BaseChatModel+@abstractmethoddef generate_text(self, prompt: str, max_new_tokens: int = None) -> str:"""diff --git a/src/config.py b/src/config.pyindex b7e32c2..83aa136 100644--- a/src/config.py+++ b/src/config.py@@ -11,6 +11,11 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@# pylint: disable=too-few-public-methodsimport os+import dotenv++dotenv.load_dotenv(+ dotenv_path=f".env{'.' + os.getenv('ENV') if os.getenv('ENV') else ''}"+)class AzureConfig:diff --git a/src/constants/prompts/kg_agent.py b/src/constants/prompts/kg_agent.pyindex 46c74cb..f45bd07 100644--- a/src/constants/prompts/kg_agent.py+++ b/src/constants/prompts/kg_agent.py@@ -7,3 +7,35 @@ Last Modified: Sunday October 19th 2025 10:38:27 amModified By: the developer formerly known as Christian Nonis at <[email protected]>-----"""++KG_AGENT_SYSTEM_PROMPT = """+You are a knowledge graph agent.+You are responsible for updating the knowledge graph with new information.+You should iterate over search sections and reasoning and update the knowledge graph with the new information.+You have access to a tool to execute graph operations.+Use this tool to operate with the knowledge graph based on the information provided.++Your workflow should be as follows:+1. Carefully read and understand the information provided.+2. Search into the knowledge graph for relevant information or existing nodes that are related to the information provided.+3. Update or create new nodes and relationships in the knowledge graph.+4. Repeat++If you get an error, try again after fixing your query and call the tool again, don't give up.++You can iterate multiple times youf workflow if you need to, to search, add, update or delete nodes and relationships.+You must not create duplicate nodes, be careful to search and match for existing nodes before creating new ones.+"""++KG_AGENT_UPDATE_PROMPT = """+This is the information to update the knowledge graph:+== START OF INFORMATION ==+{information}+== END OF INFORMATION ==++This is the metadata of the information, you must only append this metadata to the nodes, the metadata must not be used to+identify nodes or be standalone nodes:+{metadata}++Begin!+"""diff --git a/src/constants/tasks/ingestion.py b/src/constants/tasks/ingestion.pyindex 02a260f..aaa18f4 100644--- a/src/constants/tasks/ingestion.py+++ b/src/constants/tasks/ingestion.py@@ -9,7 +9,7 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@"""from enum import Enum-from typing import List, Union, Annotated+from typing import List, Union, Annotated, Literalfrom pydantic import BaseModel, Field, Discriminator@@ -27,9 +27,7 @@ class IngestionTaskJsonArgs(BaseModel):Arguments for the ingestion task when the data type is JSON."""- data_type: IngestionTaskDataType = Field(- default=IngestionTaskDataType.JSON, discriminator=True- )+ data_type: Literal["json"] = Field(default="json")json_data: dictmeta_keys: List[str] = Field(default=[],@@ -47,9 +45,7 @@ class IngestionTaskTextArgs(BaseModel):Arguments for the ingestion task when the data type is TEXT."""- data_type: IngestionTaskDataType = Field(- default=IngestionTaskDataType.TEXT, discriminator=True- )+ data_type: Literal["text"] = Field(default="text")text_data: strdiff --git a/src/core/agents/__init__.py b/src/core/agents/__init__.pynew file mode 100644index 0000000..3a29323--- /dev/null+++ b/src/core/agents/__init__.py@@ -0,0 +1,9 @@+"""+File: /__init__.py+Created Date: Sunday October 19th 2025+Author: Christian Nonis <[email protected]>+-----+Last Modified: Sunday October 19th 2025 3:36:19 pm+Modified By: the developer formerly known as Christian Nonis at <[email protected]>+-----+"""diff --git a/src/core/agents/kg_agent.py b/src/core/agents/kg_agent.pyindex a59b858..8d8a972 100644--- a/src/core/agents/kg_agent.py+++ b/src/core/agents/kg_agent.py@@ -9,12 +9,17 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@"""from typing import List, Optional-from langchain.agents import AgentExecutor, create_react_agent+from langchain.agents import create_agentfrom langchain.tools import BaseToolfrom src.adapters.cache import CacheAdapterfrom src.adapters.graph import GraphAdapterfrom src.adapters.llm import LLMAdapter+from src.constants.prompts.kg_agent import (+ KG_AGENT_SYSTEM_PROMPT,+ KG_AGENT_UPDATE_PROMPT,+)+from src.core.agents.tools.kg_agent import KGAgentExecuteGraphOperationToolclass KGAgent:@@ -29,8 +34,9 @@ class KGAgent:self.llm_adapter = llm_adapterself.cache_adapter = cache_adapterself.kg = kg+ self.agent = None- async def _execute_graph_operation(self, operation: str) -> str:+ def _execute_graph_operation(self, operation: str) -> str:try:self.kg.execute_operation(operation)return f"Graph operation executed successfully: {operation}"@@ -42,34 +48,45 @@ class KGAgent:"use the appropriate syntax.")- async def _get_tools(self) -> List[BaseTool]:- return []+ def _get_tools(self) -> List[BaseTool]:+ return [+ KGAgentExecuteGraphOperationTool(self, self.kg, self.kg.graphdb_description)+ ]- async def _get_agent(self, prompt: str) -> str:- _agent = create_react_agent(- llm=self.llm_adapter.llm,- prompt=prompt,- tools=self._get_tools(),- )- agent = AgentExecutor(- agent=_agent,- llm=self.llm_adapter.llm,- prompt=prompt,- tools=self._get_tools(),- verbose=True,- return_intermediate_steps=True,- handle_parsing_errors=True,- max_iterations=15,- early_stopping_method="generate",- )- return agent+ def _get_agent(self):+ if self.agent is None:+ system_prompt = KG_AGENT_SYSTEM_PROMPT++ self.agent = create_agent(+ model=self.llm_adapter.llm.langchain_model,+ tools=self._get_tools(),+ system_prompt=system_prompt,+ )+ return self.agent- async def search_kg(self, query: str) -> str:+ def search_kg(self, query: str) -> str:"""Search the knowledge graph for information."""+ # TODO vector search and retrieval- async def update_kg(self, information: str, metadata: Optional[dict]) -> str:+ def update_kg(self, information: str, metadata: Optional[dict]) -> str:"""Update the knowledge graph with new information."""++ self._get_agent()+ response = self.agent.invoke(+ {+ "messages": [+ {+ "role": "user",+ "content": KG_AGENT_UPDATE_PROMPT.format(+ information=information,+ metadata=metadata,+ ),+ }+ ],+ }+ )+ return responsediff --git a/src/core/agents/tools/__init__.py b/src/core/agents/tools/__init__.pynew file mode 100644index 0000000..c9eecd8--- /dev/null+++ b/src/core/agents/tools/__init__.py@@ -0,0 +1,9 @@+"""+File: /__init__.py+Created Date: Sunday October 19th 2025+Author: Christian Nonis <[email protected]>+-----+Last Modified: Sunday October 19th 2025 3:36:15 pm+Modified By: the developer formerly known as Christian Nonis at <[email protected]>+-----+"""diff --git a/src/core/agents/tools/kg_agent.py b/src/core/agents/tools/kg_agent.pynew file mode 100644index 0000000..208ec4a--- /dev/null+++ b/src/core/agents/tools/kg_agent.py@@ -0,0 +1,55 @@+"""+File: /kg_agent.py+Created Date: Sunday October 19th 2025+Author: Christian Nonis <[email protected]>+-----+Last Modified: Sunday October 19th 2025 3:36:26 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 KGAgentExecuteGraphOperationTool(BaseTool):+ """+ Tool for executing a graph operation.+ """++ name: str = "kg_agent_execute_graph_operation"++ kg_agent: object+ kg: GraphAdapter++ def __init__(self, kg_agent, kg: GraphAdapter, database_desc: str):+ description: str = (+ "Tool for executing a graph operation. "+ "The query should be a valid graph 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."+ )+ formatted_description = description.format(database_desc=database_desc)+ super().__init__(kg_agent=kg_agent, kg=kg, description=formatted_description)++ def _run(self, *args, **kwargs) -> str:+ _query = ""+ print(f"Args: {args} - Kwargs: {kwargs}")+ if len(args) > 0:+ _query = args[0]++ if len(kwargs) > 0:+ args_query = kwargs.get("args", {})+ if isinstance(args_query, dict):+ _query = args_query.get("query", "")+ elif isinstance(args_query, list):+ _query = args_query[0].get("query", "")++ if len(_query) == 0:+ return "No query provided in the arguments or kwargs"++ response = self.kg.execute_operation(_query)++ return responsediff --git a/src/lib/llm/client_large.py b/src/lib/llm/client_large.pyindex 5d7a9e1..2b649f9 100644--- a/src/lib/llm/client_large.py+++ b/src/lib/llm/client_large.py@@ -10,9 +10,10 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@import jsonfrom openai import AzureOpenAI+from langchain_openai import AzureChatOpenAI-from adapters.interfaces.llm import LLM-from config import config+from src.adapters.interfaces.llm import LLM+from src.config import configclass LLMClientLarge(LLM):@@ -28,6 +29,13 @@ class LLMClientLarge(LLM):api_key=config.azure.large_llm_subscription_key,)+ self.langchain_model = AzureChatOpenAI(+ azure_deployment=config.azure.large_llm_model,+ api_version=config.azure.large_llm_api_version,+ azure_endpoint=config.azure.large_llm_endpoint,+ api_key=config.azure.large_llm_subscription_key,+ )+def generate_text(self, prompt: str, max_new_tokens: int = None) -> str:"""Generate a text response from the model and return it as a string.diff --git a/src/lib/milvus/docker-compose.yaml b/src/lib/milvus/docker-compose.yamlindex 7bd3c01..031b3aa 100644--- a/src/lib/milvus/docker-compose.yaml+++ b/src/lib/milvus/docker-compose.yaml@@ -1,9 +1,7 @@-version: '3.5'-services:etcd:container_name: milvus-etcd- image: quay.io/coreos/etcd:v3.5.18+ image: milvusdb/etcd:latestenvironment:- ETCD_AUTO_COMPACTION_MODE=revision- ETCD_AUTO_COMPACTION_RETENTION=1000diff --git a/src/lib/neo4j/client.py b/src/lib/neo4j/client.pyindex 8374505..f4ac582 100644--- a/src/lib/neo4j/client.py+++ b/src/lib/neo4j/client.py@@ -31,6 +31,13 @@ class Neo4jClient(GraphClient):"""return "neo4j"+ @property+ def graphdb_description(self) -> str:+ """+ Get the description of the graph database. It is used to let the agent know which syntax to use.+ """+ return "The graph database is Neo4j. Cyphter is the language used to operate with it."+def execute_operation(self, operation: str) -> str:"""Execute a Neo4j operation.diff --git a/src/services/api/app.py b/src/services/api/app.pyindex 71cedf7..87c3564 100644--- a/src/services/api/app.py+++ b/src/services/api/app.py@@ -7,3 +7,17 @@ Last Modified: Sunday October 19th 2025 9:17:44 amModified By: the developer formerly known as Christian Nonis at <[email protected]>-----"""++import os++from fastapi import FastAPI+from uvicorn import run++from src.services.api.routes.ingest import ingest_router++app = FastAPI()++app.include_router(ingest_router)++if __name__ == "__main__":+ run(app, host="0.0.0.0", port=8000, reload=os.getenv("ENV") == "development")diff --git a/src/services/api/constants/__init__.py b/src/services/api/constants/__init__.pynew file mode 100644index 0000000..7530f26--- /dev/null+++ b/src/services/api/constants/__init__.py@@ -0,0 +1,9 @@+"""+File: /__init__.py+Created Date: Monday October 20th 2025+Author: Christian Nonis <[email protected]>+-----+Last Modified: Monday October 20th 2025 7:27:55 pm+Modified By: the developer formerly known as Christian Nonis at <[email protected]>+-----+"""diff --git a/src/services/api/constants/requests.py b/src/services/api/constants/requests.pynew file mode 100644index 0000000..ee4f86c--- /dev/null+++ b/src/services/api/constants/requests.py@@ -0,0 +1,17 @@+"""+File: /requests.py+Created Date: Monday October 20th 2025+Author: Christian Nonis <[email protected]>+-----+Last Modified: Monday October 20th 2025 7:29:39 pm+Modified By: the developer formerly known as Christian Nonis at <[email protected]>+-----+"""++from src.constants.tasks.ingestion import IngestionTaskTextArgs+++class IngestionRequestBody(IngestionTaskTextArgs):+ """+ Request body for the ingestion endpoint.+ """diff --git a/src/services/api/routes/ingest.py b/src/services/api/routes/ingest.pyindex bcb740f..fe70c27 100644--- a/src/services/api/routes/ingest.py+++ b/src/services/api/routes/ingest.py@@ -7,3 +7,22 @@ Last Modified: Sunday October 19th 2025 12:41:30 pmModified By: the developer formerly known as Christian Nonis at <[email protected]>-----"""++from fastapi import APIRouter+from starlette.responses import JSONResponse++from src.services.api.constants.requests import IngestionRequestBody+from src.workers.tasks.ingestion import ingest_data as ingest_data_task++ingest_router = APIRouter(prefix="/ingest", tags=["ingest"])+++@ingest_router.post(path="/")+async def ingest_data(data: IngestionRequestBody):+ """+ Ingest data to the processing pipeline and save to the memory.+ """+ task_id = ingest_data_task.delay(args=data.model_dump())+ return JSONResponse(+ content={"message": "Data ingested successfully", "task_id": task_id.id}+ )diff --git a/src/workers/app.py b/src/workers/app.pyindex a86088b..e35f54e 100644--- a/src/workers/app.py+++ b/src/workers/app.py@@ -13,7 +13,7 @@ from celery import Celeryingestion_app = Celery("ingestion_app",- broker="amqp://kalo:kalo@localhost:5672//",+ broker="amqp://kalo:kalo@localhost:5672/",backend="rpc://",include=["src.workers.tasks.ingestion"],)diff --git a/src/workers/tasks/ingestion.py b/src/workers/tasks/ingestion.pyindex e14ffb2..5805125 100644--- a/src/workers/tasks/ingestion.py+++ b/src/workers/tasks/ingestion.py@@ -8,13 +8,42 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@-----"""-from celery import shared_task+import json+from src.services.kg_agent.main import kg_agent+from src.workers.app import ingestion_app+from src.constants.tasks.ingestion import (+ IngestionTaskArgs,+ IngestionTaskDataType,+ IngestionTaskJsonArgs,+ IngestionTaskTextArgs,+)-from src.constants.tasks.ingestion import IngestionTaskArgs--@shared_task(bind=True)-def ingest_data(self, args: IngestionTaskArgs):+@ingestion_app.task(bind=True)+def ingest_data(self, args: dict):"""Ingest data into the database."""+ payload: IngestionTaskArgs = None++ if args.get("data_type") == IngestionTaskDataType.TEXT.value:+ payload = IngestionTaskTextArgs(**args)+ elif args.get("data_type") == IngestionTaskDataType.JSON.value:+ payload = IngestionTaskJsonArgs(**args)+ else:+ raise ValueError(f"Invalid data type: {args.get('data_type')}")++ response = kg_agent.update_kg(+ (+ payload.text_data+ if payload.data_type == IngestionTaskDataType.TEXT.value+ else json.dumps(payload.json_data)+ ),+ (+ payload.meta_keys+ if payload.data_type == IngestionTaskDataType.JSON.value+ else None+ ),+ )+ print(response)+ return self.request.id