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.

fix(brain creation): request

Christianb7293d1c5e13
diff --git a/pyproject.toml b/pyproject.toml
index 5f9af38..3779ac8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "brainapi2"
-version = "1.6.5-dev"
+version = "1.6.6-dev"
description = "Version 1.x.x of the BrainAPI memory layer."
authors = [
{name = "Christian",email = "[email protected]"}
diff --git a/src/services/api/controllers/system.py b/src/services/api/controllers/system.py
index b96ca0c..b291cbd 100644
--- a/src/services/api/controllers/system.py
+++ b/src/services/api/controllers/system.py
@@ -9,6 +9,8 @@ Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@
"""
import asyncio
+
+from pydantic import BaseModel
from src.services.data.main import data_adapter
@@ -20,9 +22,17 @@ async def get_brains_list():
return result
-async def create_new_brain(brain_id: str):
+class CreateBrainRequest(BaseModel):
+ """
+ Request body for the create brain endpoint.
+ """
+
+ brain_id: str
+
+
+async def create_new_brain(request: CreateBrainRequest):
"""
Create a new brain
"""
- result = await asyncio.to_thread(data_adapter.create_brain, brain_id)
+ result = await asyncio.to_thread(data_adapter.create_brain, request.brain_id)
return result