Overview
Integration details
| Class | Package | Serializable | JS/TS Support | Downloads | Latest Version | |
|---|---|---|---|---|---|---|
ChatAmazonNova | langchain-amazon-nova | ❌ | beta | ❌ |
Model features
| Tool calling | Structured output | JSON mode | Image input | Audio input | Video input | Token-level streaming | Native async | Token usage | Logprobs |
|---|---|---|---|---|---|---|---|---|---|
| ✅ | ❌ | ❌ | Model-dependent | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ |
Setup
To access Amazon Nova models, you’ll need to obtain API credentials and install thelangchain-amazon-nova integration package.
Installation
Credentials
Set your Nova API credentials as environment variables:Instantiation
Now we can instantiate our model object and generate chat completions:For a complete list of supported parameters and their descriptions, see the Amazon Nova documentation.
Invocation
Content blocks
Amazon Nova messages can contain either a single string or a list of content blocks. You can access standardized content blocks using thecontent_blocks property:
content_blocks will render the content in a standard format that is consistent across other model providers. Read more about content blocks.
Streaming
Amazon Nova supports token-level streaming for real-time response generation:Async streaming
For async applications, useastream:
Tool calling
Amazon Nova supports tool calling (function calling) on compatible models. You can check if a model supports tool calling using LangChain model profiles.For details on Nova’s tool calling implementation and available parameters, see the tool calling documentation.
Basic tool usage
Bind tools to the model using Pydantic models or LangChain@tool:
tool_calls attribute:
Using LangChain tools
You can also use standard LangChain tools:Strict tool binding
By default,BaseChatModel.bind_tools validates that the model supports tool calling. To disable this validation:
System tools
Amazon Nova provides built-in system tools that can be enabled by passing them to the model initialization. See the Amazon Nova documentation for available system tools and their capabilities.System toolsSystem tools like
nova_grounding and nova_code_interpreter provide built-in capabilities. For details on available system tools and their usage, see the Amazon Nova documentation.Model Profile
Amazon Nova provides different models with varying capabilities. It includes support for LangChain model profiles.Model capabilities vary by modelSome Amazon Nova models support vision inputs while others do not. Always check model capabilities before using multimodal features.For a complete list of available models and their capabilities, see the Amazon Nova documentation.
Async operations
For production applications requiring high throughput, use native async operations:Chaining
Amazon Nova models work seamlessly with LangChain’s LCEL (LangChain Expression Language) for building chains:Error handling
The model includes built-in retry logic with configurable parameters:with_retry method:
Troubleshooting
Connection issues
If you encounter connection errors, verify your environment variables are set correctly:Compression errors
The
ChatAmazonNova client automatically disables compression to avoid potential decompression issues.Tool calling validation errors
If you receive a validation error when binding tools, ensure the model supports tool calling.API reference
For detailed documentation of allChatAmazonNova features and configurations, head to the ChatAmazonNova API reference.
For Amazon Nova-specific features, model details, and API specifications, see the Amazon Nova documentation.