Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
refacto: Centralize seed and temperature configurations
Clémence Lesnécea8d0e5e1a9
diff --git a/helpers/config_models/llm.py b/helpers/config_models/llm.pyindex 1e5bbe7..598c37e 100644--- a/helpers/config_models/llm.py+++ b/helpers/config_models/llm.py@@ -21,7 +21,9 @@ class AbstractPlatformModel(BaseModel):}context: intmodel: str+ seed: int = 42 # Reproducible resultsstreaming: bool+ temperature: float = 0.0 # Most focused and deterministic@abstractmethodasync def instance(@@ -32,6 +34,7 @@ class AbstractPlatformModel(BaseModel):class AzureOpenaiPlatformModel(AbstractPlatformModel):_client: AsyncAzureOpenAI | None = None+ api_version: str = "2024-06-01"deployment: strendpoint: str@@ -40,7 +43,7 @@ class AzureOpenaiPlatformModel(AbstractPlatformModel):self._client = AsyncAzureOpenAI(**self._client_kwargs,# Deployment- api_version="2024-06-01",+ api_version=self.api_version,azure_deployment=self.deployment,azure_endpoint=self.endpoint,# Authenticationdiff --git a/helpers/llm_worker.py b/helpers/llm_worker.pyindex 6dfa2fe..bb594bc 100644--- a/helpers/llm_worker.py+++ b/helpers/llm_worker.py@@ -166,8 +166,8 @@ async def _completion_stream_worker( # noqa: PLR0912"max_tokens": max_tokens,"messages": prompt,"model": platform.model,- "seed": 42, # Reproducible results- "temperature": 0, # Most focused and deterministic+ "seed": platform.seed,+ "temperature": platform.temperature,**extra,} # Shared kwargs for both streaming and non-streamingmaximum_tokens_reached = False@@ -345,8 +345,8 @@ async def _completion_sync_worker(max_tokens=max_tokens,messages=prompt,model=platform.model,- seed=42, # Reproducible results- temperature=0, # Most focused and deterministic+ seed=platform.seed,+ temperature=platform.temperature,**extra,)except BadRequestError as e:diff --git a/tests/conftest.py b/tests/conftest.pyindex 7e5cd7a..bd7955e 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -139,11 +139,11 @@ class DeepEvalAzureOpenAI(GPTModel):_langchain_kwargs = {# Repeatability"model_kwargs": {- "seed": 42,+ "seed": platform.seed,},- "temperature": 0,+ "temperature": platform.temperature,# Deployment- "api_version": "2023-12-01-preview",+ "api_version": platform.api_version,"azure_deployment": platform.deployment,"azure_endpoint": platform.endpoint,"model": platform.model,