mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
amazon nova api fix
This commit is contained in:
parent
8af1be31eb
commit
b4970f6033
10 changed files with 27 additions and 24 deletions
|
|
@ -6,7 +6,7 @@ import TabItem from '@theme/TabItem';
|
|||
| Property | Details |
|
||||
|-------|-------|
|
||||
| Description | Amazon Nova is a family of foundation models built by Amazon that deliver frontier intelligence and industry-leading price performance. |
|
||||
| Provider Route on LiteLLM | `amazon-nova/` |
|
||||
| Provider Route on LiteLLM | `amazon_nova/` |
|
||||
| Provider Doc | [Amazon Nova ↗](https://docs.aws.amazon.com/nova/latest/userguide/what-is-nova.html) |
|
||||
| Supported OpenAI Endpoints | `/chat/completions`, `v1/responses` |
|
||||
| Other Supported Endpoints | `v1/messages`, `/generateContent` |
|
||||
|
|
@ -32,7 +32,7 @@ from litellm import completion
|
|||
os.environ["AMAZON_NOVA_API_KEY"] = "your-api-key"
|
||||
|
||||
response = completion(
|
||||
model="amazon-nova/nova-micro-v1",
|
||||
model="amazon_nova/nova-micro-v1",
|
||||
messages=[
|
||||
{"role": "system", "content": "You are a helpful assistant"},
|
||||
{"role": "user", "content": "Hello, how are you?"}
|
||||
|
|
@ -51,7 +51,7 @@ print(response)
|
|||
model_list:
|
||||
- model_name: amazon-nova-micro
|
||||
litellm_params:
|
||||
model: amazon-nova/nova-micro-v1
|
||||
model: amazon_nova/nova-micro-v1
|
||||
api_key: os.environ/AMAZON_NOVA_API_KEY
|
||||
```
|
||||
### 2. Start the proxy
|
||||
|
|
@ -82,7 +82,7 @@ curl --location 'http://0.0.0.0:4000/chat/completions' \
|
|||
|
||||
| Model Name | Usage | Context Window |
|
||||
|------------|-------|----------------|
|
||||
| Nova Micro | `completion(model="amazon-nova/nova-micro-v1", messages=messages)` | 128K tokens |
|
||||
| Nova Micro | `completion(model="amazon_nova/nova-micro-v1", messages=messages)` | 128K tokens |
|
||||
| Nova Lite | `completion(model="amazon-nova/nova-lite-v1", messages=messages)` | 300K tokens |
|
||||
| Nova Pro | `completion(model="amazon-nova/nova-pro-v1", messages=messages)` | 300K tokens |
|
||||
| Nova Premier | `completion(model="amazon-nova/nova-premier-v1", messages=messages)` | 1M tokens |
|
||||
|
|
@ -99,7 +99,7 @@ from litellm import completion
|
|||
os.environ["AMAZON_NOVA_API_KEY"] = "your-api-key"
|
||||
|
||||
response = completion(
|
||||
model="amazon-nova/nova-micro-v1",
|
||||
model="amazon_nova/nova-micro-v1",
|
||||
messages=[
|
||||
{"role": "system", "content": "You are a helpful assistant"},
|
||||
{"role": "user", "content": "Tell me about machine learning"}
|
||||
|
|
@ -164,7 +164,7 @@ tools = [
|
|||
]
|
||||
|
||||
response = completion(
|
||||
model="amazon-nova/nova-micro-v1",
|
||||
model="amazon_nova/nova-micro-v1",
|
||||
messages=[
|
||||
{"role": "user", "content": "What's the weather like in San Francisco?"}
|
||||
],
|
||||
|
|
@ -246,7 +246,7 @@ print(response)
|
|||
model_list:
|
||||
- model_name: amazon-nova-pro
|
||||
litellm_params:
|
||||
model: amazon-nova/nova-pro-v1
|
||||
model: amazon_nova/nova-pro-v1
|
||||
temperature: 0.8
|
||||
max_tokens: 500
|
||||
top_p: 0.9
|
||||
|
|
|
|||
|
|
@ -816,7 +816,7 @@ def add_known_models():
|
|||
lemonade_models.add(key)
|
||||
elif value.get("litellm_provider") == "docker_model_runner":
|
||||
docker_model_runner_models.add(key)
|
||||
elif value.get("litellm_provider") == "amazon-nova":
|
||||
elif value.get("litellm_provider") == "amazon_nova":
|
||||
amazon_nova_models.add(key)
|
||||
|
||||
|
||||
|
|
@ -1019,7 +1019,7 @@ models_by_provider: dict = {
|
|||
"ovhcloud": ovhcloud_models | ovhcloud_embedding_models,
|
||||
"lemonade": lemonade_models,
|
||||
"clarifai": clarifai_models,
|
||||
"amazon-nova": amazon_nova_models,
|
||||
"amazon_nova": amazon_nova_models,
|
||||
}
|
||||
|
||||
# mapping for those models which have larger equivalents
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ LITELLM_CHAT_PROVIDERS = [
|
|||
"ovhcloud",
|
||||
"lemonade",
|
||||
"docker_model_runner",
|
||||
"amazon-nova",
|
||||
"amazon_nova",
|
||||
]
|
||||
|
||||
LITELLM_EMBEDDING_PROVIDERS_SUPPORTING_INPUT_ARRAY_OF_TOKENS = [
|
||||
|
|
|
|||
|
|
@ -404,8 +404,8 @@ def get_llm_provider( # noqa: PLR0915
|
|||
custom_llm_provider = "lemonade"
|
||||
elif model.startswith("clarifai/"):
|
||||
custom_llm_provider = "clarifai"
|
||||
elif model.startswith("amazon-nova"):
|
||||
custom_llm_provider = "amazon-nova"
|
||||
elif model.startswith("amazon_nova"):
|
||||
custom_llm_provider = "amazon_nova"
|
||||
if not custom_llm_provider:
|
||||
if litellm.suppress_debug_info is False:
|
||||
print() # noqa
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class AmazonNovaChatConfig(OpenAILikeChatConfig):
|
|||
|
||||
@property
|
||||
def custom_llm_provider(self) -> Optional[str]:
|
||||
return "amazon-nova"
|
||||
return "amazon_nova"
|
||||
|
||||
@classmethod
|
||||
def get_config(cls):
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ def cost_per_token(model: str, usage: "Usage") -> Tuple[float, float]:
|
|||
Follows the same logic as Anthropic's cost per token calculation.
|
||||
"""
|
||||
return generic_cost_per_token(
|
||||
model=model, usage=usage, custom_llm_provider="amazon-nova"
|
||||
model=model, usage=usage, custom_llm_provider="amazon_nova"
|
||||
)
|
||||
|
|
@ -52,10 +52,13 @@ from pydantic import BaseModel
|
|||
from typing_extensions import overload
|
||||
|
||||
import litellm
|
||||
|
||||
# client must be imported from litellm as it's a decorator used at function definition time
|
||||
from litellm import client
|
||||
|
||||
# Other utils are imported directly to avoid circular imports
|
||||
from litellm.utils import exception_type, get_litellm_params, get_optional_params
|
||||
|
||||
# Logging is imported lazily when needed to avoid loading litellm_logging at import time
|
||||
if TYPE_CHECKING:
|
||||
from litellm.litellm_core_utils.litellm_logging import Logging
|
||||
|
|
@ -2662,7 +2665,7 @@ def completion( # type: ignore # noqa: PLR0915
|
|||
)
|
||||
|
||||
response = model_response
|
||||
elif custom_llm_provider == "amazon-nova":
|
||||
elif custom_llm_provider == "amazon_nova":
|
||||
api_key = (
|
||||
api_key
|
||||
or litellm.amazon_nova_api_key
|
||||
|
|
|
|||
|
|
@ -16957,7 +16957,7 @@
|
|||
},
|
||||
"amazon-nova/nova-micro-v1": {
|
||||
"input_cost_per_token": 3.5e-08,
|
||||
"litellm_provider": "amazon-nova",
|
||||
"litellm_provider": "amazon_nova",
|
||||
"max_input_tokens": 128000,
|
||||
"max_output_tokens": 10000,
|
||||
"max_tokens": 10000,
|
||||
|
|
@ -16969,7 +16969,7 @@
|
|||
},
|
||||
"amazon-nova/nova-lite-v1": {
|
||||
"input_cost_per_token": 6e-08,
|
||||
"litellm_provider": "amazon-nova",
|
||||
"litellm_provider": "amazon_nova",
|
||||
"max_input_tokens": 300000,
|
||||
"max_output_tokens": 10000,
|
||||
"max_tokens": 10000,
|
||||
|
|
@ -16983,7 +16983,7 @@
|
|||
},
|
||||
"amazon-nova/nova-premier-v1": {
|
||||
"input_cost_per_token": 2.5e-06,
|
||||
"litellm_provider": "amazon-nova",
|
||||
"litellm_provider": "amazon_nova",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 10000,
|
||||
"max_tokens": 10000,
|
||||
|
|
@ -16997,7 +16997,7 @@
|
|||
},
|
||||
"amazon-nova/nova-pro-v1": {
|
||||
"input_cost_per_token": 8e-07,
|
||||
"litellm_provider": "amazon-nova",
|
||||
"litellm_provider": "amazon_nova",
|
||||
"max_input_tokens": 300000,
|
||||
"max_output_tokens": 10000,
|
||||
"max_tokens": 10000,
|
||||
|
|
|
|||
|
|
@ -3002,7 +3002,7 @@ class LlmProviders(str, Enum):
|
|||
WANDB = "wandb"
|
||||
OVHCLOUD = "ovhcloud"
|
||||
LEMONADE = "lemonade"
|
||||
AMAZON_NOVA = "amazon-nova"
|
||||
AMAZON_NOVA = "amazon_nova"
|
||||
A2A_AGENT = "a2a_agent"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16957,7 +16957,7 @@
|
|||
},
|
||||
"amazon-nova/nova-micro-v1": {
|
||||
"input_cost_per_token": 3.5e-08,
|
||||
"litellm_provider": "amazon-nova",
|
||||
"litellm_provider": "amazon_nova",
|
||||
"max_input_tokens": 128000,
|
||||
"max_output_tokens": 10000,
|
||||
"max_tokens": 10000,
|
||||
|
|
@ -16969,7 +16969,7 @@
|
|||
},
|
||||
"amazon-nova/nova-lite-v1": {
|
||||
"input_cost_per_token": 6e-08,
|
||||
"litellm_provider": "amazon-nova",
|
||||
"litellm_provider": "amazon_nova",
|
||||
"max_input_tokens": 300000,
|
||||
"max_output_tokens": 10000,
|
||||
"max_tokens": 10000,
|
||||
|
|
@ -16983,7 +16983,7 @@
|
|||
},
|
||||
"amazon-nova/nova-premier-v1": {
|
||||
"input_cost_per_token": 2.5e-06,
|
||||
"litellm_provider": "amazon-nova",
|
||||
"litellm_provider": "amazon_nova",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 10000,
|
||||
"max_tokens": 10000,
|
||||
|
|
@ -16997,7 +16997,7 @@
|
|||
},
|
||||
"amazon-nova/nova-pro-v1": {
|
||||
"input_cost_per_token": 8e-07,
|
||||
"litellm_provider": "amazon-nova",
|
||||
"litellm_provider": "amazon_nova",
|
||||
"max_input_tokens": 300000,
|
||||
"max_output_tokens": 10000,
|
||||
"max_tokens": 10000,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue