Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,13 @@ def evaluate_resume(self, resume_text: str) -> BaseModel:
],
"options": {
"stream": False,
"temperature": self.model_params.get("temperature", 0.5),
"top_p": self.model_params.get("top_p", 0.9),
# Defaults here silently re-added sampling params that
# providers.json had deliberately left out.
**{
k: self.model_params[k]
for k in ("temperature", "top_p")
if k in self.model_params
},
},
}

Expand Down
13 changes: 9 additions & 4 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,15 @@ def chat(

options = options or {}
body: Dict[str, Any] = {"model": model, "messages": messages, "stream": False}
if "temperature" in options:
body["temperature"] = options["temperature"]
if "top_p" in options:
body["top_p"] = options["top_p"]
sampling = {k: options[k] for k in ("temperature", "top_p") if k in options}
# Anthropic's OpenAI-compatible endpoint 400s when temperature and top_p are
# both set ("cannot both be specified for this model"). Every other provider
# here accepts the pair. Dropping one where the body is actually assembled
# means no call site can reintroduce it by defaulting, and top_p is the one
# to drop: temperature is what keeps scoring runs reproducible.
if len(sampling) == 2 and "api.anthropic.com" in self.base_url:
sampling.pop("top_p")
body.update(sampling)

# Structured-output translation: evaluator passes format=<json schema>.
if "format" in kwargs and self.structured_output != "none":
Expand Down
9 changes: 7 additions & 2 deletions pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,13 @@ def _call_llm_for_section(
],
"options": {
"stream": False,
"temperature": model_params["temperature"],
"top_p": model_params["top_p"],
# Only forward what the model actually configures. Indexing here
# raised KeyError for any model with no sampling params set.
**{
k: model_params[k]
for k in ("temperature", "top_p")
if k in model_params
},
},
}

Expand Down
8 changes: 4 additions & 4 deletions providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"anthropic": {
"base_url": "https://api.anthropic.com/v1",
"api_key_env": "ANTHROPIC_API_KEY",
"structured_output": "json_object",
"structured_output": "none",
"models": {
"claude-opus-4-8": { "temperature": 0.1, "top_p": 0.9 },
"claude-sonnet-5": { "temperature": 0.1, "top_p": 0.9 },
"claude-haiku-4-5": { "temperature": 0.1, "top_p": 0.9 }
"claude-opus-4-8": { "temperature": 0.1 },
"claude-sonnet-5": { "temperature": 0.1 },
"claude-haiku-4-5": { "temperature": 0.1 }
}
}
}
Expand Down