mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
feat(utils.py): support passing openai response headers to client, if enabled
Allows openai/openai-compatible provider response headers to be sent to client, if 'return_response_headers' is enabled
This commit is contained in:
parent
b137207ae6
commit
dcb974dd1e
3 changed files with 12 additions and 0 deletions
|
@ -5678,6 +5678,14 @@ def convert_to_model_response_object(
|
|||
_response_headers: Optional[dict] = None,
|
||||
):
|
||||
received_args = locals()
|
||||
if _response_headers is not None:
|
||||
if hidden_params is not None:
|
||||
hidden_params["additional_headers"] = {
|
||||
"{}-{}".format("llm_provider", k): v
|
||||
for k, v in _response_headers.items()
|
||||
}
|
||||
else:
|
||||
hidden_params = {"additional_headers": _response_headers}
|
||||
### CHECK IF ERROR IN RESPONSE ### - openrouter returns these in the dictionary
|
||||
if (
|
||||
response_object is not None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue