From 05ad935049dd1ef811f57c080f58b7e6e53e4e1f Mon Sep 17 00:00:00 2001 From: Sebastian Husch Lee Date: Tue, 26 Mar 2024 08:27:54 +0100 Subject: [PATCH] Add support for response_format and seed --- haystack/nodes/prompt/invocation_layer/open_ai.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/haystack/nodes/prompt/invocation_layer/open_ai.py b/haystack/nodes/prompt/invocation_layer/open_ai.py index 0e26d709f8..56583b8803 100644 --- a/haystack/nodes/prompt/invocation_layer/open_ai.py +++ b/haystack/nodes/prompt/invocation_layer/open_ai.py @@ -95,6 +95,8 @@ def __init__( "stream", "stream_handler", "moderate_content", + "seed", + "response_format", ] if key in kwargs } @@ -150,6 +152,10 @@ def _prepare_invoke(self, *args, **kwargs): "frequency_penalty": kwargs_with_defaults.get("frequency_penalty", 0), "logit_bias": kwargs_with_defaults.get("logit_bias", {}), } + if kwargs_with_defaults.get("response_format", None): + base_payload["response_format"] = kwargs_with_defaults.get("response_format") + if kwargs_with_defaults.get("seed", None): + base_payload["seed"] = kwargs_with_defaults.get("seed") return (prompt, base_payload, kwargs_with_defaults, stream, moderation)