Fixes: #2518
Issue: https://github.com/spring-projects/spring-ai/issues/2518
This commit removes the deprecated requestOptions field from ChatModelObservationContext
and EmbeddingModelObservationContext classes. Instead of passing options separately,
the code now retrieves them directly from the request objects (prompt.getOptions() or
embeddingRequest.getOptions()).
Key changes:
- Removed requestOptions parameter from observation context builders
- Updated all model implementations to stop passing options separately
- Fixed EmbeddingRequest handling in several model implementations
- Added buildEmbeddingRequest method in models to properly merge options
This change simplifies the API and removes duplication, as options are already
available in the request objects themselves.
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
- Remove @Nullable on ChatOptions
- By default, pass the default ChatOptions from the DefaultChatOptionsBuilder
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
- Remove deprecation from EvaluationResponse's constructor as it is still being used
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
The vector-index-name in the MongoDB configuration options should be wrong, but it's okay when I'm trying index-name (no warning)
Signed-off-by: qwp_p <70431503+RobinElysia@users.noreply.github.com>
Add documentation about Maven mirror configuration when using Spring AI
snapshots, including examples of correct mirrorOf settings to allow
access to Spring repositories.
Signed-off-by: shishuiwuhen2009 <90782280+shishuiwuhen2009@users.noreply.github.com>
- FunctionCallbackResolver is deprecated and replaced by ToolCallingManager's ToolCallbackResolver
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
Add serverProperties.getSseEndpoint() parameter to both WebFluxSseServerTransportProvider
and WebMvcSseServerTransportProvider constructors.
Signed-off-by: liujunjie <smartliujunjie@gmail.com>
The DefaultChatClientObservationConvention is now not removing entries from the observation context, resulting in advisor context entries being removed in the ChatClientRequest.
Fixes gh-2876
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
- Remove spring-ai-parent POM as its parent
- This change is done to make Spring AI dependencies independent of Spring Boot
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
* ChatMemory will become a generic interface to implement different memory management strategies. It’s been moved from the “”spring-ai-client-chat” package to “spring-ai-model” package while retaining the same package, so it’s transparent to users.
* A MessageWindowChatMemory has been introduced to provide support for a chat memory that keeps at most N messages in the memory.
* A ChatMemoryRepository interface has been introduced to support different storage strategies for the chat memory. It’s meant to be used as part of a ChatMemory implementation. This is different than before, where the storage-specific implementation was directly tied to the ChatMemory. This design is familiar to Spring users since it’s used already in the ecosystem. The goal was to use a programming model similar to Spring Session and Spring Data.
* The JdbcChatMemory has been supersed by JdbcChatMemoryRepository.
* A ChatMemory bean is auto-configured for you whenever using one of the Spring AI Model starters. By default, it uses the MessageWindowChatMemory implementation and stores the conversation history in memory. If a different repository is already configured (e.g., Cassandra, JDBC, or Neo4j), Spring AI will use that instead.
* First-class documentation has been introduced to describe the ChatMemory API and related features.
* All the changes introduced in this PR are backward-compatible.
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
- Update ZhipuAI Chat Model to use ToolCalling Manager and ToolExecutionEligibilityPredicate
- Update ZhipuAI ChatOptions to implement ToolCallingChatOptions
- Update Autoconfiguration for ZhipuAI model to use ToolCallingAutoconfiguration
- Update tests
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
- Update Minimax Chat Model to use ToolCalling Manager and ToolExecutionEligibilityPredicate
- Update Minimax ChatOptions to implement ToolCallingChatOptions
- Update Autoconfiguration for MinimaxChat model to use ToolCallingAutoconfiguration
- Update tests
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
- Introduce new TemplateRenderer API providing the logic for rendering an input template.
- Update the PromptTemplate API to accept a TemplateRenderer object at construction time.
- Move ST logic to StTemplateRenderer implementation, used by default in PromptTemplate. Additionally, make start and end delimiter character configurable.
Relates to gh-2655
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
Update multiple dependency versions including:
- Milvus from 2.5.4 to 2.5.7
- Azure Search from 11.6.1 to 11.7.6
- Weaviate client from 5.0.1 to 5.2.0
- Typesense from 0.5.0 to 1.3.0 (with matching code update)
- OpenSearch client from 2.10.1 to 2.23.0
- MariaDB from 3.5.1 to 3.5.3
- Couchbase from 3.7.8 to 3.8.0
- Neo4j Cypher DSL from 2024.0.2 to 2024.5.1
- Jedis from 5.1.0 to 5.2.0
Updates TypesenseVectorStore to use IndexAction enum instead of string literal.
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
Adjust MergeUtils to accommodate API changes:
- Update ChatCompletions constructor parameter list to remove the usage argument
- Move usage assignment to post-construction via reflection
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
Add the ability to configure instructions for MCP servers that provide
guidance to clients on how to interact with the server.
- New instructions property in McpServerProperties
- Passing instructions to the server builder in McpServerAutoConfiguration
- Updated tests to verify instructions configuration works correctly
Signed-off-by: James Ward <james@jamesward.com>
- Move Mistral Moderation model into separate autoconfiguration
- Add/update MistralModelConfigurationTests
Signed-off-by: Ricken Bazolo <ricken.bazolo@gmail.com>
- Introduce “ChatClientRequest” and “ChatClientResponse” for propagating requests/responses in a ChatClient advisor chain.
- Structure a Prompt at the beginning of the chain, to ensure a consistent view across execution chain and observations. Any template is rendered at the beginning so that every advisor doesn’t have to do it again.
- Improve observations to include the complete view of the prompt messages, instead of only considering userText and systemText.
- Remove legacy “around” advisor type concept.
- Keep backward compatibility for AdvisedRequest, AdvisedResponse, and legacy Advisor APIs.
Relates to gh-2655
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
Sync the ChatModel enum with the latest OpenAI documentation:
- Reorganize models into categories.
- Add new models (o4-mini, o3, o1-pro, gpt-4.1 series, realtime previews).
- Update descriptions, context windows, max tokens, and knowledge cutoffs.
- Add links to official model documentation.
- Remove deprecated/preview models.
Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
Add reflective check for the getSslBundle method in MongoConnectionDetails interface
to ensure compatibility between Spring Boot 3.4.x and 3.5.x. The method exists in
Spring Boot 3.5 but not in 3.4, and our code needs to work with both versions.
The implementation uses ReflectionUtils to check for the method's existence at runtime
and invokes it only when available (Spring Boot 3.5+), falling back to returning
null when using Spring Boot 3.4.
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
- The ModelOptionsUtils merges the ToolCallingChatOptions with the provider chat options
- The underlying beanwrapper implementation expects the boolean option to have the getter method starting with "get" instad of "is" which makes the current `isInternalToolExecutionEnabled` not used by the merge operation at all. To fix this, rename the `isInternalToolExecutionEnabled` method to `getInternalToolExecutionEnabled` and deprecate the existing `isInternalToolExecutionEnabled` method.
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
- Replace model-specific enabled properties with unified spring.ai.model.embedding property
- Update documentation for Bedrock Cohere and Titan embedding models
- Add missing dependency information for RAG advisors in documentation
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>