Skip to content

Commit

Permalink
Add support for response_format and seed
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrl committed Mar 26, 2024
1 parent f389dcf commit 05ad935
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions haystack/nodes/prompt/invocation_layer/open_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def __init__(
"stream",
"stream_handler",
"moderate_content",
"seed",
"response_format",
]
if key in kwargs
}
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 05ad935

Please sign in to comment.