pytest, so judge-model calls run as part of your normal test suite and CI pipeline.
Prerequisites
- A SambaCloud account and API key
- Python 3.9 or later
Setup
1
Install DeepEval
2
Export your SambaCloud API key
3
Point DeepEval's judge model at SambaCloud
Use DeepEval’s
OpenAIModel class with a custom base_url — this is the same class DeepEval uses for real OpenAI, just redirected:See DeepEval’s OpenAI model reference for the full parameter list. The older
GPTModel name works identically but is deprecated in favor of OpenAIModel as of DeepEval 4.x.Example: score a test case
test_sambanova.py
Output
reason string is generated by the judge model, so it explains the score rather than restating it.
Example: run as a pytest CI check
This is DeepEval’s main use case: judge-model calls inside your normal test suite.test_ci_example.py
pytest under the hood):
Output (abridged)
Plain
pytest test_ci_example.py -v also works, since DeepEval is a pytest plugin, but deepeval test run is the documented command and adds the richer test-result table shown above.Troubleshooting
DeprecationWarning: 'GPTModel' is deprecated
DeprecationWarning: 'GPTModel' is deprecated
Use
OpenAIModel instead — same constructor, same base_url support, just the current name as of DeepEval 4.x.KeyError: SAMBANOVA_API_KEY
KeyError: SAMBANOVA_API_KEY
Export the key before running:
export SAMBANOVA_API_KEY="your-key". Verify with echo $SAMBANOVA_API_KEY.Low or unexpected AnswerRelevancyMetric scores
Low or unexpected AnswerRelevancyMetric scores
Check
metric.reason — it’s generated by the judge model itself and explains exactly what it penalized, which is more useful than the score alone for figuring out whether the issue is your prompt, your test case, or the judge model’s interpretation.
