|
| 1 | +# Amazon Nova |
1 | 2 |
|
2 | | -<auto-redirect /> |
| 3 | +[Amazon Nova](https://nova.amazon.com/) is a new generation of foundation models with frontier intelligence and industry leading price performance. Generate text, code, and images with natural language prompts. The [`strands-amazon-nova`](https://pypi.org/project/strands-amazon-nova/) package ([GitHub](https://github.com/amazon-nova-api/strands-nova)) provides an integration for the Strands Agents SDK, enabling seamless use of Amazon Nova models. |
3 | 4 |
|
4 | | -This guide has moved to [community/model-providers/amazon-nova](../../../community/model-providers/amazon-nova.md). |
| 5 | +## Installation |
| 6 | + |
| 7 | +Amazon Nova integration is available as a separate package: |
| 8 | + |
| 9 | +```bash |
| 10 | +pip install strands-agents strands-amazon-nova |
| 11 | +``` |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +After installing `strands-amazon-nova`, you can import and initialize the Amazon Nova API provider: |
| 16 | + |
| 17 | +```python |
| 18 | +from strands import Agent |
| 19 | +from amazon_nova import NovaAPIModel |
| 20 | + |
| 21 | +model = NovaAPIModel( |
| 22 | + api_key=os.env(NOVA_API_KEY"), # or set NOVA_API_KEY env var |
| 23 | + model_id="nova-2-lite-v1", |
| 24 | + params={ |
| 25 | + "max_tokens": 1000, |
| 26 | + "temperature": 0.7, |
| 27 | + } |
| 28 | +) |
| 29 | + |
| 30 | +agent = Agent(model=model) |
| 31 | +response = await agent.invoke_async("Can you write a short story?") |
| 32 | +print(response.message) |
| 33 | +``` |
| 34 | + |
| 35 | +## Configuration |
| 36 | + |
| 37 | +### Environment Variables |
| 38 | + |
| 39 | +```bash |
| 40 | +export NOVA_API_KEY="your-api-key" |
| 41 | +``` |
| 42 | + |
| 43 | +### Model Configuration |
| 44 | + |
| 45 | +```python |
| 46 | +from amazon_nova import NovaAPIModel |
| 47 | + |
| 48 | +model = NovaAPIModel( |
| 49 | + api_key=os.env(NOVA_API_KEY"), # Required: Nova API key |
| 50 | + model_id="nova-2-lite-v1", # Required: Model ID |
| 51 | + base_url="https://api.nova.amazon.com/v1", # Optional, default shown |
| 52 | + timeout=300.0, # Optional, request timeout in seconds |
| 53 | + params={ # Optional: Model parameters |
| 54 | + "max_tokens": 4096, # Maximum tokens to generate |
| 55 | + "max_completion_tokens": 4096, # Alternative to max_tokens |
| 56 | + "temperature": 0.7, # Sampling temperature (0.0-1.0) |
| 57 | + "top_p": 0.9, # Nucleus sampling (0.0-1.0) |
| 58 | + "reasoning_effort": "medium", # For reasoning models: "low", "medium", "high" |
| 59 | + "system_tools": ["nova_grounding", "nova_code_interpreter"] # Available system tools from Nova API |
| 60 | + "metadata": {}, # Additional metadata |
| 61 | + } |
| 62 | +) |
| 63 | +``` |
| 64 | + |
| 65 | +**Supported Parameters in `params`:** |
| 66 | +- `max_tokens` (int): Maximum tokens to generate (deprecated, use max_completion_tokens) |
| 67 | +- `max_completion_tokens` (int): Maximum tokens to generate |
| 68 | +- `temperature` (float): Controls randomness (0.0 = deterministic, 1.0 = maximum randomness) |
| 69 | +- `top_p` (float): Nucleus sampling threshold |
| 70 | +- `reasoning_effort` (str): For reasoning models - "low", "medium", or "high" |
| 71 | +- `system_tools` (list): Available system tools from the Nova API - currently `nova_grounding` and `nova_code_interpreter` |
| 72 | +- `metadata` (dict): Additional request metadata |
| 73 | + |
| 74 | +## References |
| 75 | + |
| 76 | +- [strands-amazon-nova GitHub Repository](https://github.com/amazon-nova-api/strands-nova) |
| 77 | +- [Amazon Nova](https://nova.amazon.com/) |
| 78 | +- **Issues**: Report bugs and feature requests in the [strands-amazon-nova repository](https://github.com/amazon-nova-api/strands-nova/issues/new/choose) |
0 commit comments