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(gcp client): credentials initialization

Christian21b16005a03c
diff --git a/Dockerfile b/Dockerfile
index b86a1d1..c41ed7e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -10,6 +10,7 @@ LABEL build_date="${BUILD_DATE}" \
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PATH="/app/.venv/bin:$PATH" \
+ HF_HOME=/app/.cache \
TRANSFORMERS_CACHE=/app/.cache \
SENTENCE_TRANSFORMERS_HOME=/app/.cache \
POETRY_NO_INTERACTION=1 \
diff --git a/src/config.py b/src/config.py
index e1f3395..912ca53 100644
--- a/src/config.py
+++ b/src/config.py
@@ -3,7 +3,7 @@ File: /config.py
Created Date: Sunday October 19th 2025
Author: Christian Nonis <[email protected]>
-----
-Last Modified: Thursday February 19th 2026 7:45:12 pm
+Last Modified: Wednesday March 4th 2026 9:35:41 pm
Modified By: Christian Nonis <[email protected]>
-----
"""
@@ -60,12 +60,13 @@ class GCPConfig:
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."
)
-
+ print("[GCPConfig] credentials_path: ", credentials_path)
self.credentials_path = credentials_path
self.project_id = os.getenv("GCP_PROJECT_ID")
self.small_llm_model = os.getenv("GCP_SMALL_LLM_MODEL")
diff --git a/src/lib/llm/client_small.py b/src/lib/llm/client_small.py
index 95a45ed..99970b0 100644
--- a/src/lib/llm/client_small.py
+++ b/src/lib/llm/client_small.py
@@ -56,6 +56,9 @@ class LLMClientSmall(LLM):
if self._client is None:
from google import genai
+ os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = (
+ config.gcp.credentials_path
+ )
self._client = genai.Client(
vertexai=True,
project=config.gcp.project_id,