Fixes: #1753https://github.com/spring-projects/spring-ai/issues/1753
- Add character-based truncation (max 2048 chars) for Cohere embedding requests
- Support both START and END truncation strategies
- Add unit tests verifying truncation behavior for both strategies
Truncation is applied before sending requests to Bedrock API to avoid
ValidationException when text exceeds maximum length. The END strategy
(default) keeps the first 2048 characters while START keeps the last
2048 characters.
- Remove deprecated types,methods and references
- Remove usage of "Generation(String text)" and replace with
"Generation(AssistantMessage)"
- Remove MiniMaxApi,MootShotApi,OpenAiApi,ZhiPuAiApi
ChatCompletionFinishReason's FUNCTION_CALL
- Remove OllamaApi's deprecated types
- Remove deprecated constructors from PostgresMlEmbeddingModel
- Remove deprecated constructor from Media
- Remove tokenNames usage from antlr4 FiltersLexer and FiltersParser
- Remove deprecated methods from CassandraVectorStoreProperties
- Remove deprecated constructor and static config class from QdrantVectorStore
- Minor cleanups on removing deprecated models and versions
- Remove old name for mixtral models
Resolves#1599
The changes include:
- Refactor the emitting of next, error, and complete events in the Bedrock stream handling to use a default EmitFailureHandler that retries for 10 seconds before failing.
This helps improve the error resilience of the stream processing.
- Disable a couple of integration tests related to the COHERE_COMMAND_V14 model, as that model version is no longer supported.
- Adjust some configuration options in the Jurassic2 chat model integration test.
Also resolves#1679
- Disable project-wide Checkstyle checks to unblock development
- Add documentation for enabling Checkstyle locally
- Fix remaining checkstyle violations in current codebase
Fixes#1669
Introduces support for Amazon Bedrock Converse API through a new BedrockProxyChatModel
implementation. This enables integration with Bedrock's conversation models with features
including:
- Support for sync/async chat completions
- Stream response handling
- Tool/function calling capabilities
- System message support
- Image input support
- Observation and metrics integration
- Configurable model parameters and AWS credentials
Adds core support classes:
- BedrockUsage: Implements Usage interface for token tracking
- ConverseApiUtils: Utility class for handling Bedrock API responses including:
- Tool use event aggregation and processing
- Chat response transformation from stream outputs
- Model options conversion
- Support for metadata aggregation
- URLValidator: Utility for URL validation and normalization with support for:
- Basic and strict URL validation
- URL normalization
- Multimodal input handling
- Enhanced FunctionCallingOptionsBuilder with merge capabilities for both ChatOptions
and FunctionCallingOptions
- Added BEDROCK_CONVERSE to AiProvider enum for metrics tracking
- Extended AWS credentials support with session token capability
- Added configurable session token property to BedrockAwsConnectionProperties
Adds new auto-configuration support:
- BedrockConverseProxyChatAutoConfiguration for automatic setup of the Bedrock Converse chat model
- BedrockConverseProxyChatProperties for configuration including:
- Model selection (defaults to Claude 3 Sonnet)
- Timeout settings (defaults to 5 minutes)
- Temperature and token control
- Top-K and Top-P sampling parameters
- Integration with existing BedrockAwsConnectionConfiguration for AWS credentials
Updates to testing infrastructure:
- Adds comprehensive test suite for Bedrock Converse properties and auto-configuration
- Integration tests for chat completion and streaming scenarios
- Property validation tests for configuration options
- Temporarily disabled other Bedrock tests due to AWS quota limitations
- Added ObjectMapper configuration for proper JSON handling
Added new spring-ai-bedrock-converse-spring-boot-starter module
Updates module configuration in parent POM and BOM to include new bedrock-converse
modules and starters. Adds necessary auto-configuration imports for seamless integration
with Spring Boot applications.
Unrelated changes:
- Disabled several Bedrock model tests (Jurassic2, Llama, Titan) due to AWS quota limitations
- Disabled PaLM2 tests due to API decommissioning by Google
Resolves#809, #802
Add docs and fix configs
- Move timeout configuration from chat properties to connection properties
- Add comprehensive documentation for Bedrock Converse API usage and configuration
- Update tests to reflect configuration changes
Co-authored-by: maxjiang153 <maxjiang153@users.noreply.github.com>
Standardize AWS credential handling in integration tests
- Improve how we manage AWS credentials across our integration test
suite and ensures consistent test configuration. We're replacing individual
environment variable checks with @RequiresAwsCredentials
annotation and standardizing the use of BedrockTestUtils for context creation
in tests
We also align all AWS regions to US_EAST_1 for consistency and add missing
dependency versioning for Oracle Free.
These changes make our AWS tests more easier to maintain.
Key changes:
- Replace @EnabledIfEnvironmentVariable with @RequiresAwsCredentials
- Standardize context creation via BedrockTestUtils
- Set AWS region to US_EAST_1
- Add Oracle Free dependency version in pom.xml
All output parser functionality has already been migrated to the converter package
since milestone M1.
Changes:
- Replace all instances of 'parser' with 'converter' in variable names and test cases
- Delete (pre M1) deprecated parser package and all associated classes
- Remove Output Parsers section from README.md
- Update Javadoc comments to reference converters instead of parsers
- Remove unnecessary spring-web dependencies
- Update third-party library versions
- Refactor API classes to use consistent header handling
- Remove ApiUtils class and inline its functionality
- Adjust RestClient and WebClient builder usage in autoconfiguration
- Replace direct RestClient.Builder injections with ObjectProvider<RestClient.Builder>
and WebClient.Builder injections with ObjectProvider<WebClient.Builder>
- Update ChromaVectorStoreAutoConfiguration to use ObjectProvider
- Rename MongoDbAtlasLocalContainerConnectionDetailsFactoryTest to IT
- Switch spring-ai-chroma-store dependency from spring-web to spring-webflux
- Simplify ChromaApi constructor by using method reference for default headers
- Adjust import order
Resolves#1066Resolves#524
This commit enhances the Bedrock Anthropic model's output:
- Add response ID, model name, and usage data to ChatResponseMetadata
- Introduce DefaultUsage class for token usage information
- Update BedrockAnthropic3ChatModel to include new metadata
- Add Jackson annotations for serialization/deserialization
- Implement unit tests for DefaultUsage
These changes provide structured, serializable metadata in the
ChatResponse, improving the model's output with additional
information.
This commit adds support for new Meta Llama 3.1 and 3.2 instruct models
to the LlamaChatBedrockApi enum. It includes model IDs for:
Llama 3.1: 8B, 70B, 405B
Llama 3.2: 1B, 3B, 11B, 90B
These additions allow users to specify the latest Llama models when
using the Bedrock API. The commit also updates the class Javadoc with
a link to AWS documentation for model IDs and bumps the @since version
to 1.0.0.
This change updates the type of portable chat options from Float to
Double. Affected options include:
- frequencyPenalty
- presencePenalty
- temperature
- topP
The motivation for this change is to simplify coding. In Java, Float
values require an "f" suffix (e.g., 0.5f), while Double values don't
need any suffix. This makes Double easier to type and reduces
potential errors from forgetting the "f" suffix.
APIs, tests, and documentation have been updated to reflect this
change.
Fixes gh-712
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
Handle the case where AnthropicChatResponse content is empty to prevent
an out of bounds exception. This ensures that the model behaves correctly
even when no content is returned in the response.
* Surface more configuration APIs to ChatOptions
* Use abstraction in Observations directly instead of dedicated implementation
* Simplify metadata config in observations for defined models
* Improve merging of runtime and default options in OpenAI
* Fix missing option in Mistral AI
Relates to gh-1148
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
* Add model and dimensions to option abstraction
* Use abstraction in Observations directly instead of dedicated implementation
* Clean-up the merge of runtime and default embedding options in OpenAI
Relates to #gh-1148
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
- introduce copy() method to the ChatOptions.
- make sure that the DefaultChatClientRequestSpec takes a copy of the input chat options to prevent multation.
- add a OpenAiChatClientMultipleFunctionCallsIT to reproduce the problem and verify the solution.
Resolves#1064
- Add ToolCall to AssistantMessage.
- Rename FunctionMessage to ToolResponseMessage and add id and name fields.
- Refactor OpenAiChatModel's function calling handling.
- Prompt copy now copies the AssistantMessage and ToolResponseMessage contents.
Other ChatModel implementations to adopt these changes in subsequent commits
- add new spring-ai-vertex-ai-embedding project.
- add VertexAiTextEmbeddingModel and VertexAiMultimodalEmbeddingMode with related options configuration classes.
- add ITs
- add auto-configuraiton and boot starters.
- register to BOM.
- add documentation.
- add multimodal embedding documentation
- extend the Embedding metdata so that it can keep references to the source document's data, Id, mediatype
Resolves#1013
Related to #1009
- upadate bedrockruntime version to 2.26.7 and align it with aws sdk dependecy.
- minor ITs configuration, consistency and statbility fixes
Use the EnvironmentVariableCredentialsProvider instead of the Profile credential provider.
- update the Bedrock getting started documentation.
- update the Genemi Prerequisites docs.
* Move ChatClient and related classes into the chat.client package
* Move ChatModel and related class into the chat.model package
* Smaller refactorings to remove DSM cycles
* Update README.md
* Rename the ModelClient class hierarchy into Model:
- Rename ModelClient into Model. Update all code and doc references.
- Rename ChatClient to ChatModel. Update all ChatClient suffixes and chatClient fields and variables in code and doc.
- Rename EmbeddingClient into EmbeddingModel. Update the XxxEmbeddingClient class and variable suffixes and embeddingClient variables and fields in code and docs.
- Rename ImageClient into ImageModel.
- Rename SpeechClient into SpeechModel.
- Rename TranscriptionClient into TranscriptionModel.
- Update all javadocs and antora pages. Update the related diagrams.
* Create fluent API in ChatClient interface that now includes streaming support
* Add OpenAI FunctionCallbackWrapper2IT auto-config tests.
* Add ChatClientTest mockito testing.
* Add ChatModel#getDefaultOptions(), and remove @FunctionalInterface
* ChatModel enums extend the new ModelDescription interface.
* Implement fromOptions copy method in every ChatOptions implementation.
* Extend ChatClient to use the model default options if not provided explicitly.
* Update readme to provide guidance on how to adapt to breaking changes.
Co-authored-by: Christian Tzolov <ctzolov@vmware.com>
Co-authored-by: Mark Pollack <mpollack@vmware.com>
* Added more natural method names to DocumentReader, Transformer, Writer
* Changed Content getMedia to return Collection, deprecated use of List
* Change constructor for Media to accept URL and Resource, deprecate Object constructor
* Update ETL documentation and a few tests to avoid now deprecated APIs.
- Old OutputParser, BeanOutputParser, ListOutputParser and MapOutputParser classes are depredated
in favour of the new StructuredOutputConverter, BeanOutputConverter, ListOutputConverter and
MapOutputConverter implementations.
Later are drop-in replacements for the former ones, and provide the same functionality.
- Keep the existing parser package and classes for backward compatibility.
- Adjust the PromptTemplate for backward compatibility
- Update all existing tests to use the new Structured Output API.
- Improve the documentation for structured outputs.