mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-11-30 00:46:10 +00:00
fix: forcing response format to be JSON valid (#7692)
* forcing response format to be JSON valid * adding release notes * cleaning up * Update haystack/components/evaluators/llm_evaluator.py Co-authored-by: Madeesh Kannan <shadeMe@users.noreply.github.com> --------- Co-authored-by: Madeesh Kannan <shadeMe@users.noreply.github.com>
This commit is contained in:
parent
a2be90b95a
commit
75cf35c743
@ -87,7 +87,9 @@ class LLMEvaluator:
|
||||
self.api_key = api_key
|
||||
|
||||
if api == "openai":
|
||||
self.generator = OpenAIGenerator(api_key=api_key)
|
||||
self.generator = OpenAIGenerator(
|
||||
api_key=api_key, generation_kwargs={"response_format": {"type": "json_object"}}
|
||||
)
|
||||
else:
|
||||
raise ValueError(f"Unsupported API: {api}")
|
||||
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
enhancements:
|
||||
- |
|
||||
Enforce JSON mode on OpenAI LLM-based evaluators so that the they always return valid JSON output.
|
||||
This is to ensure that the output is always in a consistent format, regardless of the input.
|
||||
Loading…
x
Reference in New Issue
Block a user