mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
(Feat) - Allow calling Nova models on /bedrock/invoke/
(#8397)
* add nova to BEDROCK_INVOKE_PROVIDERS_LITERAL * BedrockInvokeNovaRequest * nova + invoke config * add AmazonInvokeNovaConfig * AmazonInvokeNovaConfig * run transform_request for invoke/nova models * AmazonInvokeNovaConfig * rename invoke tests * fix linting error * TestBedrockInvokeNovaJson * TestBedrockInvokeNovaJson * add converse_chunk_parser * test_nova_invoke_remove_empty_system_messages * test_nova_invoke_streaming_chunk_parsing
This commit is contained in:
parent
fc01b304a1
commit
0d9e641034
7 changed files with 276 additions and 31 deletions
|
@ -1342,7 +1342,7 @@ class AWSEventStreamDecoder:
|
|||
text = chunk_data.get("completions")[0].get("data").get("text") # type: ignore
|
||||
is_finished = True
|
||||
finish_reason = "stop"
|
||||
######## converse bedrock.anthropic mappings ###############
|
||||
######## /bedrock/converse mappings ###############
|
||||
elif (
|
||||
"contentBlockIndex" in chunk_data
|
||||
or "stopReason" in chunk_data
|
||||
|
@ -1350,6 +1350,11 @@ class AWSEventStreamDecoder:
|
|||
or "trace" in chunk_data
|
||||
):
|
||||
return self.converse_chunk_parser(chunk_data=chunk_data)
|
||||
######### /bedrock/invoke nova mappings ###############
|
||||
elif "contentBlockDelta" in chunk_data:
|
||||
# when using /bedrock/invoke/nova, the chunk_data is nested under "contentBlockDelta"
|
||||
_chunk_data = chunk_data.get("contentBlockDelta", None)
|
||||
return self.converse_chunk_parser(chunk_data=_chunk_data)
|
||||
######## bedrock.mistral mappings ###############
|
||||
elif "outputs" in chunk_data:
|
||||
if (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue