Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

refacto: VERSION var management in Python

Clémence Lesné7edc9c3e765e
diff --git a/helpers/config_models/api.py b/helpers/config_models/api.py
index 6102506..2d3de94 100644
--- a/helpers/config_models/api.py
+++ b/helpers/config_models/api.py
@@ -1,5 +1,7 @@
-from pydantic import BaseModel
+from os import environ
+from pydantic import BaseModel, Field
class ApiModel(BaseModel):
root_path: str = ""
+ version: str = Field(default=environ["VERSION"], frozen=True)
diff --git a/helpers/version.py b/helpers/version.py
deleted file mode 100644
index f4aafe6..0000000
--- a/helpers/version.py
+++ /dev/null
@@ -1,4 +0,0 @@
-import os
-
-
-VERSION: str = os.getenv("VERSION", "0.0.0-unknown")
diff --git a/main.py b/main.py
index 27d89b7..55e466c 100644
--- a/main.py
+++ b/main.py
@@ -24,7 +24,6 @@ from fastapi.responses import JSONResponse
from helpers.config import CONFIG
from helpers.logging import build_logger
from helpers.prompts import LLM as LLMPrompt, TTS as TTSPrompt, Sounds as SoundPrompt
-from helpers.version import VERSION
from models.action import ActionModel, Indent as IndentAction
from models.reminder import ReminderModel
from pydantic.json import pydantic_encoder
@@ -109,7 +108,7 @@ api = FastAPI(
lifespan=lifespan,
root_path=ROOT_PATH,
title="claim-ai-phone-bot",
- version=VERSION,
+ version=CONFIG.api.version,
)
api.add_middleware(