- Extend the ChatClient with a new templateRenderer() method to pass a custom TemplateRenderer object used to render user and system templates.
- Evolve the QuestionAnswerAdvisor to accept a PromptTemplate for customising the RAG prompt and templating logic while maintaining backward compatibility.
- Introduce integration tests for the QuestionAnswerAdvisor.
- Document the TemplateRenderer API and how to use it to build PromptTemplate with custom templating logic.
- Document how to customise the templating logic used internally by the ChatClient via the TemplateRendererAPI.
Add validation tests and improve PromptTemplate resource handling
Enhance robustness and reliability of the PromptTemplate class with better
resource handling and comprehensive input validation:
- Add dedicated validation tests for builder methods with null/invalid inputs
- Improve renderResource method to gracefully handle edge cases:
- Null resources return empty string
- ByteArrayResource handling with proper charset (UTF-8)
- Empty resources check with proper existence test
- Better error handling with logging instead of exception propagation
- Add input validation assertions to all Builder methods
- Fix typo in deprecated annotation comment ("fahvor" → "favor")
Update documentation to clarify template rendering in different contexts:
- Add clear notes about TemplateRenderer usage in ChatClient vs Advisors
- Document how advisor template customization differs from ChatClient template rendering
- Add comprehensive API upgrade notes for template-related deprecations
- Include detailed migration examples for PromptTemplate and QuestionAnswerAdvisor
Fixes gh-355, gh-1687, gh-2448, gh-1849, gh-1428
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
- set timestamp manually to prevent saving equal timestamps while batch insert
- return DESC order into get query (in `JdbcChatMemory`)
- Update similar changes for JdbcChatMemoryRepository
This PR solves some problems with message ordering:
JdbcChatMemory fetches rows in DESC order, and MessageChatMemoryAdvisor get and add all messages in that order - from last to first. So messages list needs to be reversed.
After batch insert without specifying timestamp manually all rows have the same timestamp (because database sets current_timestamp by default). Sooo after fetching rows from database the message order is unpredictable - they have same timestamp.
Signed-off-by: Linar Abzaltdinov <abzaltdinov@gmail.com>
fix: correct name typo from 'AsynClients' to 'AsyncClients'
fix: correct name typo from 'Autoconfiguration' to 'AutoConfiguration', 'optoins' to 'options'
fix: correct name typo from 'Differnt' to 'Different'
fix: correct name typo from 'Compatability' to 'Compatibility'
fix: correct name typo from 'Evalutaor' to 'Evaluator'
fix: correct name typo from 'Empyt' to 'Empty'
fix: correct name typo from 'Chroma Vecor Store' to 'Chroma Vector Store'
fix: correct name typo from 'Specificaiton' to 'Specification'
fix: correct name typo from 'applicaiton' to 'application'
fix: correct name typo from 'apropriate' to 'appropriate'
fix: correct name typo from 'asigned' to 'assigned'
fix: correct name typo from 'capabilitity' to 'capability'
fix: correct name typo from 'configuraiton' to 'configuration'
fix: correct name typo from 'conntection' to 'connection'
fix: correct name typo from 'curent' to 'current'
fix: correct name typo from 'customised' to 'customized'
Signed-off-by: Changho Kim <dukso4885@gmail.com>
docs: add Maven mirror config note for Spring AI snapshots
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>
Add support for completion specifications in both sync and async MCP servers by:
- Adding parameters for SyncCompletionSpecification and AsyncCompletionSpecification
- Implementing registration of completion specifications in server builders
- Updating capabilities builders to include completions
- Upgrading MCP SDK version to 0.10.0-SNAPSHOT
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Add presence_penalty, frequency_penalty, and n parameters
Following Mistral AI API specifications as referenced in https://docs.mistral.ai/api/#tag/chat
Rename Builder method N() to n()
Signed-off-by: Seunghyeon Ji <3aroa2@gmail.com>
The DocumentPostProcessor API has been introduced to implement post-retrieval components in a Modular RAG architecture, superseding the DocumentCompressor, DocumentRanker, DocumentSelector APIs that are now deprecated.
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
Introduce defining Media objects from a URI, deprecating the previous URL support.
Fixes gh-1147
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
* The new spring.ai.model.* properties introduced in M7 were missing Spring Boot configuration metadata.
* Furthermore, the breaking change was not documented as the previous properties have been completely removed. Documentation has been added in the upgrade notes for this change.
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
* ChatClient observations now include the full prompt content instead of just the userText and systemText. Furthermore, they include consistent telemetry for the tools passed via the ChatClient and a first-class conversation ID when using memory advisors. Incomplete or unsafe attributes have been deprecated.
* Adopted the new robust Advisor APIs for BaseAdvisor and RetrievalAugmentationAdvisor.
* Improved the prompt augmentation facilities in ChatClientRequest and Prompt for performance and immutability.
* Fixed integration test racing condition.
* Updated the documentation for ChatClient and Observability accordingly.
* Documented changes in upgrade notes.
* Introduced `prompt.augmentUserMessage(String text)` to directly replace the user message content.
* Added `prompt.augmentUserMessage(Function<UserMessage, UserMessage> augmenter)` for more granular updates using the `userMessage.mutate()` pattern, allowing modification of text, media, and metadata.
Relates to gh-2655
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
- The commit removes deprecated methods and parameters, including
- requestOptions in image observation context and proxyToolCalls in Vertex AI
- Gemini options. Updates code to use ImagePrompt.getOptions() instead of
- the separate parameter for more consistent API design.
- Remove the deprecated FunctionCallback related classes, references
- Replace them with the corresponding ToolCallback usage
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
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>