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.

wip

Christian2b7d919f9c28
diff --git a/Makefile b/Makefile
index 4ca856e..bcef7a2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,11 @@
start-milvus:
- docker compose -f src/lib/milvus/docker-compose.yml up -d
+ docker compose -f src/lib/milvus/docker-compose.yaml up -d
stop-milvus:
- docker compose -f src/lib/milvus/docker-compose.yml down
+ docker compose -f src/lib/milvus/docker-compose.yaml down
delete-milvus-volumes:
- docker compose -f src/lib/milvus/docker-compose.yml down -v --remove-orphans
+ docker compose -f src/lib/milvus/docker-compose.yaml down -v --remove-orphans
start-rabbitmq:
docker compose -f src/lib/rabbitmq/docker-compose.yaml up -d
@@ -16,9 +16,20 @@ stop-rabbitmq:
delete-rabbitmq-volumes:
docker compose -f src/lib/rabbitmq/docker-compose.yaml down -v --remove-orphans
+start-redis:
+ docker compose -f src/lib/redis/docker-compose.yaml up -d
+
+stop-redis:
+ docker compose -f src/lib/redis/docker-compose.yaml down
+
+delete-redis-volumes:
+ docker compose -f src/lib/redis/docker-compose.yaml down -v --remove-orphans
+
+
start-all:
start-milvus
start-rabbitmq
+ start-redis
@bash -c `
poetry run celery -A src.workers.app worker --loglevel=info
`
@@ -26,8 +37,10 @@ start-all:
stop-all:
stop-milvus
stop-rabbitmq
+ stop-redis
pkill -f celery
clear-all-volumes:
delete-milvus-volumes
- delete-rabbitmq-volumes
\ No newline at end of file
+ delete-rabbitmq-volumes
+ delete-redis-volumes
\ No newline at end of file
diff --git a/poetry.lock b/poetry.lock
index e25cb45..435d900 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -420,6 +420,28 @@ idna = ["idna (>=3.10)"]
trio = ["trio (>=0.30)"]
wmi = ["wmi (>=1.5.1) ; platform_system == \"Windows\""]
+[[package]]
+name = "fastapi"
+version = "0.119.0"
+description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
+optional = false
+python-versions = ">=3.8"
+groups = ["main"]
+files = [
+ {file = "fastapi-0.119.0-py3-none-any.whl", hash = "sha256:90a2e49ed19515320abb864df570dd766be0662c5d577688f1600170f7f73cf2"},
+ {file = "fastapi-0.119.0.tar.gz", hash = "sha256:451082403a2c1f0b99c6bd57c09110ed5463856804c8078d38e5a1f1035dbbb7"},
+]
+
+[package.dependencies]
+pydantic = ">=1.7.4,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0 || >2.0.0,<2.0.1 || >2.0.1,<2.1.0 || >2.1.0,<3.0.0"
+starlette = ">=0.40.0,<0.49.0"
+typing-extensions = ">=4.8.0"
+
+[package.extras]
+all = ["email-validator (>=2.0.0)", "fastapi-cli[standard] (>=0.0.8)", "httpx (>=0.23.0,<1.0.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=3.1.5)", "orjson (>=3.2.1)", "pydantic-extra-types (>=2.0.0)", "pydantic-settings (>=2.0.0)", "python-multipart (>=0.0.18)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"]
+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 = "h11"
version = "0.16.0"
@@ -1594,6 +1616,25 @@ files = [
{file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"},
]
+[[package]]
+name = "starlette"
+version = "0.48.0"
+description = "The little ASGI library that shines."
+optional = false
+python-versions = ">=3.9"
+groups = ["main"]
+files = [
+ {file = "starlette-0.48.0-py3-none-any.whl", hash = "sha256:0764ca97b097582558ecb498132ed0c7d942f233f365b86ba37770e026510659"},
+ {file = "starlette-0.48.0.tar.gz", hash = "sha256:7e8cee469a8ab2352911528110ce9088fdc6a37d9876926e73da7ce4aa4c7a46"},
+]
+
+[package.dependencies]
+anyio = ">=3.6.2,<5"
+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 = "tenacity"
version = "9.1.2"
@@ -1990,4 +2031,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 = "460e2d6ff91a7bdbcd71fd3b902dadc09dbdfd9f29c21d512deed38e3d038610"
+content-hash = "c9da0560aaa8985829f13611af2e74224ebac9c2795f7c5cf6fe0dec43f70a49"
diff --git a/pyproject.toml b/pyproject.toml
index 8b2039c..effbd15 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -17,7 +17,9 @@ dependencies = [
"langchain (>=1.0.0,<2.0.0)",
"openai (>=2.5.0,<3.0.0)",
"celery (>=5.5.3,<6.0.0)",
- "kombu[rabbitmq] (>=5.3.0,<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)"
]
[tool.poetry]
diff --git a/src/adapters/cache.py b/src/adapters/cache.py
index 85dd400..1c347d9 100644
--- a/src/adapters/cache.py
+++ b/src/adapters/cache.py
@@ -7,3 +7,38 @@ Last Modified: Sunday October 19th 2025 9:00:36 am
Modified By: the developer formerly known as Christian Nonis at <[email protected]>
-----
"""
+
+from .interfaces.cache import CacheClient
+
+
+class CacheAdapter:
+ """
+ Adapter for the cache client.
+ """
+
+ def __init__(self):
+ self.cache = None
+
+ def add_client(self, client: CacheClient) -> None:
+ """
+ Add a cache client to the adapter.
+ """
+ self.cache = client
+
+ def get(self, key: str) -> str:
+ """
+ Get a value from the cache.
+ """
+ return self.cache.get(key)
+
+ def set(self, key: str, value: str, expires_in: int) -> bool:
+ """
+ Set a value in the cache with an expiration time.
+ """
+ return self.cache.set(key, value, expires_in)
+
+ def delete(self, key: str) -> bool:
+ """
+ Delete a value from the cache.
+ """
+ return self.cache.delete(key)
diff --git a/src/adapters/graph.py b/src/adapters/graph.py
index c837470..2f95e46 100644
--- a/src/adapters/graph.py
+++ b/src/adapters/graph.py
@@ -7,3 +7,37 @@ Last Modified: Sunday October 19th 2025 8:59:28 am
Modified By: the developer formerly known as Christian Nonis at <[email protected]>
-----
"""
+
+from src.adapters.interfaces.graph import GraphClient
+
+
+class GraphAdapter:
+ """
+ Adapter for the graph client.
+ """
+
+ def __init__(self):
+ self.graph = None
+
+ @property
+ def graphdb_type(self) -> str:
+ """
+ This is the type of the graph database.
+ It is used to let the agent know which syntax to use.
+ """
+ return self.graph.graphdb_type
+
+ def add_client(self, client: GraphClient) -> None:
+ """
+ Add a graph client to the adapter.
+ """
+ self.graph = client
+
+ def execute_operation(self, operation: str) -> str:
+ """
+ Execute a graph operation.
+ """
+ return self.graph.execute_operation(operation)
+
+
+_graph_adapter = GraphAdapter()
diff --git a/src/adapters/interfaces/cache.py b/src/adapters/interfaces/cache.py
index 5caf30f..0329db6 100644
--- a/src/adapters/interfaces/cache.py
+++ b/src/adapters/interfaces/cache.py
@@ -7,3 +7,40 @@ Last Modified: Sunday October 19th 2025 9:01:18 am
Modified By: the developer formerly known as Christian Nonis at <[email protected]>
-----
"""
+
+from abc import ABC, abstractmethod
+
+
+class CacheClient(ABC):
+ """
+ Abstract base class for cache clients.
+ """
+
+ @abstractmethod
+ def get(self, key: str) -> str:
+ """
+ Get a value from the cache.
+ """
+ raise NotImplementedError("get method not implemented")
+
+ @abstractmethod
+ def set(self, key: str, value: str, expires_in: int) -> bool:
+ """
+ Set a value in the cache with an expiration time.
+
+ Args:
+ key: The key to set.
+ value: The value to set.
+ expires_in: The expiration time in seconds.
+
+ Returns:
+ True if the value was set, False otherwise.
+ """
+ raise NotImplementedError("set method not implemented")
+
+ @abstractmethod
+ def delete(self, key: str) -> bool:
+ """
+ Delete a value from the cache.
+ """
+ raise NotImplementedError("delete method not implemented")
diff --git a/src/adapters/interfaces/graph.py b/src/adapters/interfaces/graph.py
index 4b91c01..1fd1959 100644
--- a/src/adapters/interfaces/graph.py
+++ b/src/adapters/interfaces/graph.py
@@ -7,3 +7,26 @@ Last Modified: Sunday October 19th 2025 9:01:05 am
Modified By: the developer formerly known as Christian Nonis at <[email protected]>
-----
"""
+
+from abc import ABC, abstractmethod
+
+
+class GraphClient(ABC):
+ """
+ Abstract base class for graph clients.
+ """
+
+ @property
+ @abstractmethod
+ def graphdb_type(self) -> str:
+ """
+ Get the type of graph database.
+ """
+ raise NotImplementedError("graphdb_type method not implemented")
+
+ @abstractmethod
+ def execute_operation(self, operation: str) -> str:
+ """
+ Execute a graph operation.
+ """
+ raise NotImplementedError("execute_operation method not implemented")
diff --git a/src/config.py b/src/config.py
index 18b414b..b7e32c2 100644
--- a/src/config.py
+++ b/src/config.py
@@ -33,6 +33,34 @@ class AzureConfig:
raise ValueError("Azure configuration is not complete")
+class RedisConfig:
+ """
+ Configuration class for the Redis configuration.
+ """
+
+ def __init__(self):
+ self.host = os.getenv("REDIS_HOST")
+ self.port = os.getenv("REDIS_PORT")
+
+ if [self.host, self.port].count(None) > 0:
+ raise ValueError("Redis configuration is not complete")
+
+
+class Neo4jConfig:
+ """
+ Configuration class for the Neo4j configuration.
+ """
+
+ def __init__(self):
+ self.host = os.getenv("NEO4J_HOST")
+ self.port = os.getenv("NEO4J_PORT")
+ self.username = os.getenv("NEO4J_USERNAME")
+ self.password = os.getenv("NEO4J_PASSWORD")
+
+ if [self.host, self.port, self.username, self.password].count(None) > 0:
+ raise ValueError("Neo4j configuration is not complete")
+
+
class Config:
"""
Configuration class for the application.
@@ -40,6 +68,8 @@ class Config:
def __init__(self):
self.azure = AzureConfig()
+ self.redis = RedisConfig()
+ self.neo4j = Neo4jConfig()
config = Config()
diff --git a/src/constants/tasks/__init__.py b/src/constants/tasks/__init__.py
new file mode 100644
index 0000000..08642b0
--- /dev/null
+++ b/src/constants/tasks/__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 12:21:38 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/constants/tasks/ingestion.py b/src/constants/tasks/ingestion.py
new file mode 100644
index 0000000..02a260f
--- /dev/null
+++ b/src/constants/tasks/ingestion.py
@@ -0,0 +1,63 @@
+"""
+File: /ingestion.py
+Created Date: Sunday October 19th 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday October 19th 2025 12:21:59 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from enum import Enum
+from typing import List, Union, Annotated
+from pydantic import BaseModel, Field, Discriminator
+
+
+class IngestionTaskDataType(Enum):
+ """
+ Data type for the ingestion task.
+ """
+
+ TEXT = "text"
+ JSON = "json"
+
+
+class IngestionTaskJsonArgs(BaseModel):
+ """
+ Arguments for the ingestion task when the data type is JSON.
+ """
+
+ data_type: IngestionTaskDataType = Field(
+ default=IngestionTaskDataType.JSON, discriminator=True
+ )
+ json_data: dict
+ meta_keys: List[str] = Field(
+ default=[],
+ description=(
+ "The shared keys that shuld not be treated as nodes. "
+ "(eg: email becasue each person has an email). "
+ "The keys specified here will not be analyzed "
+ "but just added to the metadata."
+ ),
+ )
+
+
+class IngestionTaskTextArgs(BaseModel):
+ """
+ Arguments for the ingestion task when the data type is TEXT.
+ """
+
+ data_type: IngestionTaskDataType = Field(
+ default=IngestionTaskDataType.TEXT, discriminator=True
+ )
+ text_data: str
+
+
+class IngestionTaskArgs(BaseModel):
+ """
+ Arguments for the ingestion task.
+ """
+
+ data: Annotated[
+ Union[IngestionTaskJsonArgs, IngestionTaskTextArgs], Discriminator("data_type")
+ ]
diff --git a/src/core/agents/kg_agent.py b/src/core/agents/kg_agent.py
index be506c1..a59b858 100644
--- a/src/core/agents/kg_agent.py
+++ b/src/core/agents/kg_agent.py
@@ -8,10 +8,68 @@ 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.tools import BaseTool
+
+from src.adapters.cache import CacheAdapter
+from src.adapters.graph import GraphAdapter
+from src.adapters.llm import LLMAdapter
+
class KGAgent:
+ """
+ Knowledge Graph Agent. Used to update the knowledge graph with new information.
+ Not used for batch updates.
+ """
+
+ def __init__(
+ self, llm_adapter: LLMAdapter, cache_adapter: CacheAdapter, kg: GraphAdapter
+ ):
+ self.llm_adapter = llm_adapter
+ self.cache_adapter = cache_adapter
+ self.kg = kg
+
async def _execute_graph_operation(self, operation: str) -> str:
- pass
+ try:
+ self.kg.execute_operation(operation)
+ return f"Graph operation executed successfully: {operation}"
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(f"Error executing graph operation: {e}")
+ return (
+ f"Error executing graph operation: {e},"
+ f"the db type is {type(self.kg.graphdb_type)}, "
+ "use the appropriate syntax."
+ )
+
+ async def _get_tools(self) -> List[BaseTool]:
+ return []
+
+ 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
+
+ async def search_kg(self, query: str) -> str:
+ """
+ Search the knowledge graph for information.
+ """
- async def process_information(self, information: str) -> str:
- pass
+ async def update_kg(self, information: str, metadata: Optional[dict]) -> str:
+ """
+ Update the knowledge graph with new information.
+ """
diff --git a/src/lib/milvus/docker-compose.yml b/src/lib/milvus/docker-compose.yaml
similarity index 100%
rename from src/lib/milvus/docker-compose.yml
rename to src/lib/milvus/docker-compose.yaml
diff --git a/src/lib/neo4j/__init__.py b/src/lib/neo4j/__init__.py
new file mode 100644
index 0000000..56055c6
--- /dev/null
+++ b/src/lib/neo4j/__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 12:57:05 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/lib/neo4j/client.py b/src/lib/neo4j/client.py
new file mode 100644
index 0000000..8374505
--- /dev/null
+++ b/src/lib/neo4j/client.py
@@ -0,0 +1,41 @@
+"""
+File: /client.py
+Created Date: Sunday October 19th 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday October 19th 2025 12:58:06 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from neo4j import GraphDatabase
+from src.adapters.interfaces.graph import GraphClient
+from src.config import config
+
+
+class Neo4jClient(GraphClient):
+ """
+ Neo4j client.
+ """
+
+ def __init__(self):
+ self.driver = GraphDatabase.driver(
+ f"bolt://{config.neo4j.host}:{config.neo4j.port}",
+ auth=(config.neo4j.username, config.neo4j.password),
+ )
+
+ @property
+ def graphdb_type(self) -> str:
+ """
+ Get the type of graph database.
+ """
+ return "neo4j"
+
+ def execute_operation(self, operation: str) -> str:
+ """
+ Execute a Neo4j operation.
+ """
+ return self.driver.execute_query(operation)
+
+
+_neo4j_client = Neo4jClient()
diff --git a/src/lib/neo4j/docker-compose.yaml b/src/lib/neo4j/docker-compose.yaml
new file mode 100644
index 0000000..4c6e9d8
--- /dev/null
+++ b/src/lib/neo4j/docker-compose.yaml
@@ -0,0 +1,24 @@
+services:
+ neo4j:
+ image: neo4j:latest
+ volumes:
+ - /$HOME/neo4j/logs:/logs
+ - /$HOME/neo4j/config:/config
+ - /$HOME/neo4j/data:/data
+ - /$HOME/neo4j/plugins:/plugins
+ environment:
+ - NEO4J_AUTH=neo4j/your_password
+ ports:
+ - "7474:7474"
+ - "7687:7687"
+ restart: always
+
+volumes:
+ neo4j-data:
+ driver: local
+ neo4j-logs:
+ driver: local
+ neo4j-config:
+ driver: local
+ neo4j-plugins:
+ driver: local
\ No newline at end of file
diff --git a/src/lib/redis/__init__.py b/src/lib/redis/__init__.py
new file mode 100644
index 0000000..9a7d492
--- /dev/null
+++ b/src/lib/redis/__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 12:31:48 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/lib/redis/client.py b/src/lib/redis/client.py
new file mode 100644
index 0000000..faedb2a
--- /dev/null
+++ b/src/lib/redis/client.py
@@ -0,0 +1,43 @@
+"""
+File: /client.py
+Created Date: Sunday October 19th 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday October 19th 2025 12:37:27 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
+
+from redis import Redis
+from src.adapters.interfaces.cache import CacheClient
+from src.config import config
+
+
+class RedisClient(CacheClient):
+ """
+ Redis client.
+ """
+
+ def __init__(self):
+ self.client = Redis(host=config.redis.host, port=config.redis.port)
+
+ def get(self, key: str) -> str:
+ """
+ Get a value from the cache.
+ """
+ return self.client.get(key)
+
+ def set(self, key: str, value: str, expires_in: int) -> bool:
+ """
+ Set a value in the cache with an expiration time.
+ """
+ return self.client.set(key, value, ex=expires_in)
+
+ def delete(self, key: str) -> bool:
+ """
+ Delete a value from the cache.
+ """
+ return self.client.delete(key)
+
+
+_redis_client = RedisClient()
diff --git a/src/lib/redis/docker-compose.yaml b/src/lib/redis/docker-compose.yaml
new file mode 100644
index 0000000..f1fbf17
--- /dev/null
+++ b/src/lib/redis/docker-compose.yaml
@@ -0,0 +1,16 @@
+services:
+ redis:
+ image: redis
+ container_name: redis
+ command: redis-server /usr/local/etc/redis/redis.conf
+ ports:
+ - "6379:6379"
+ volumes:
+ - redis-data:/data
+ - redis-conf:/usr/local/etc/redis/redis.conf
+
+volumes:
+ redis-data:
+ driver: local
+ redis-conf:
+ driver: local
\ No newline at end of file
diff --git a/src/services/api/controllers/__init__.py b/src/services/api/controllers/__init__.py
new file mode 100644
index 0000000..1009579
--- /dev/null
+++ b/src/services/api/controllers/__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 12:41:17 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/services/api/routes/__init__.py b/src/services/api/routes/__init__.py
new file mode 100644
index 0000000..8a7b995
--- /dev/null
+++ b/src/services/api/routes/__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 12:41:12 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/services/api/routes/ingest.py b/src/services/api/routes/ingest.py
new file mode 100644
index 0000000..bcb740f
--- /dev/null
+++ b/src/services/api/routes/ingest.py
@@ -0,0 +1,9 @@
+"""
+File: /ingest.py
+Created Date: Sunday October 19th 2025
+Author: Christian Nonis <[email protected]>
+-----
+Last Modified: Sunday October 19th 2025 12:41:30 pm
+Modified By: the developer formerly known as Christian Nonis at <[email protected]>
+-----
+"""
diff --git a/src/services/kg_agent/main.py b/src/services/kg_agent/main.py
index 9d3c77d..0640462 100644
--- a/src/services/kg_agent/main.py
+++ b/src/services/kg_agent/main.py
@@ -8,10 +8,25 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
-----
"""
+from src.adapters.graph import GraphAdapter
from src.adapters.llm import LLMAdapter
+from src.core.agents.kg_agent import KGAgent
from src.lib.llm.client_large import _llm_large_client
+from src.lib.redis.client import _redis_client
+from src.adapters.cache import CacheAdapter
+from src.lib.neo4j.client import _neo4j_client
+
# Initialze the adapters
llm_large_adapter = LLMAdapter()
llm_large_adapter.add_client(_llm_large_client)
+
+cache_adapter = CacheAdapter()
+cache_adapter.add_client(_redis_client)
+
+graph_adapter = GraphAdapter()
+graph_adapter.add_client(_neo4j_client)
+
+# Initialize the knowledge graph agent
+kg_agent = KGAgent(llm_large_adapter, cache_adapter, kg=graph_adapter)
diff --git a/src/workers/app.py b/src/workers/app.py
index 11f2c59..a86088b 100644
--- a/src/workers/app.py
+++ b/src/workers/app.py
@@ -11,9 +11,9 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
from celery import Celery
-injection_app = Celery(
- "injection_app",
+ingestion_app = Celery(
+ "ingestion_app",
broker="amqp://kalo:kalo@localhost:5672//",
backend="rpc://",
- include=["src.workers.tasks.injestion"],
+ include=["src.workers.tasks.ingestion"],
)
diff --git a/src/workers/tasks/injestion.py b/src/workers/tasks/ingestion.py
similarity index 68%
rename from src/workers/tasks/injestion.py
rename to src/workers/tasks/ingestion.py
index 1707603..e14ffb2 100644
--- a/src/workers/tasks/injestion.py
+++ b/src/workers/tasks/ingestion.py
@@ -1,5 +1,5 @@
"""
-File: /injestion.py
+File: /ingestion.py
Created Date: Sunday October 19th 2025
Author: Christian Nonis <[email protected]>
-----
@@ -10,10 +10,11 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
from celery import shared_task
+from src.constants.tasks.ingestion import IngestionTaskArgs
-@shared_task
-def inject_data(data: dict):
+
+@shared_task(bind=True)
+def ingest_data(self, args: IngestionTaskArgs):
"""
Ingest data into the database.
"""
- print(data)