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

feat: Make LLM more repeatable

Clémence Lesnéf804daa9ebad
diff --git a/helpers/llm_worker.py b/helpers/llm_worker.py
index 2e30a67..e32cae3 100644
--- a/helpers/llm_worker.py
+++ b/helpers/llm_worker.py
@@ -90,6 +90,7 @@ async def completion_stream(
max_tokens=max_tokens,
messages=prompt,
model=model,
+ seed=42, # Reproducible results
stream=True,
temperature=0, # Most focused and deterministic
**extra,
@@ -139,6 +140,7 @@ async def completion_sync(
max_tokens=max_tokens,
messages=prompt,
model=model,
+ seed=42, # Reproducible results
temperature=0, # Most focused and deterministic
**extra,
)
diff --git a/test.py b/test.py
index c5b3c2a..3db7ea4 100644
--- a/test.py
+++ b/test.py
@@ -38,9 +38,13 @@ class DeepEvalAzureOpenAI(DeepEvalBaseLLM):
def __init__(self):
self._model = AzureChatOpenAI(
+ # Repeatability
+ model_kwargs={
+ "seed": 42,
+ },
+ temperature=0,
# Reliability
max_retries=3,
- temperature=0,
timeout=60,
# Azure deployment
api_version="2023-12-01-preview",