Commit Graph

2034 Commits

Author SHA1 Message Date
Jackie Gleason
e5faad5ea4 Docs don't show these as bullets because they are in a note block. Looking at the other code it should be like this. (#1810) 2025-04-28 17:00:55 +01:00
Soby Chacko
f18aac07b7 GH-2518: Remove requestOptions from observation context objects
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>
2025-04-28 16:44:13 +01:00
Ilayaperumal Gopinathan
4eeeb83d3f Add default ChatOptions to Prompt
- Remove @Nullable on ChatOptions
 - By default, pass the default ChatOptions from the DefaultChatOptionsBuilder

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-28 11:41:31 -04:00
Ilayaperumal Gopinathan
363ebf8de6 Fix Spring AI BOM flatten maven plugin configuration
- Make sure to keep the dependencyManagement entries

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-28 16:06:18 +01:00
Ilayaperumal Gopinathan
8deb23afe1 Removing deprecated constructors and methods
- VectorStoreChatMemoryAdvisor constructors
- "withX" methods in AnthropicApi
- Deprecated function methods in VertexAiGeminiChatOptions
- Deprecated test methods
- Removed deprecation from Document.getContentFormatter
- Removed withEmbedding method in SimpleVectorStoreContent")

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-28 10:28:22 -04:00
Ilayaperumal Gopinathan
35ed49bf24 Update EvaluationResponse
- Remove deprecation from EvaluationResponse's constructor as it is still being used

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-28 14:20:24 +01:00
Łukasz Jernaś
c726005a5b Add autoconfiguration processor for autoconfigure modules
Signed-off-by: Łukasz Jernaś <lukasz.jernas@allegro.com>
2025-04-28 12:49:53 +01:00
qwp_p
9489ace425 Update mongodb.adoc (#2809)
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>
2025-04-28 12:37:26 +01:00
shishuiwuhen2009
ffd8f1fa6f Update getting-started.adoc (#2880)
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>
2025-04-28 11:07:44 +01:00
David Frizelle
c95d5c05ba Bump org.apache.tika to 3.1.0 (#2900)
Signed-off-by: David Frizelle <david.frizelle@gmail.com>
2025-04-28 11:00:29 +01:00
He-Pin(kerr)
283a41fd13 chore: Fix typo in toolContext. (#2854)
Signed-off-by: 虎鸣 <hepin.p@alibaba-inc.com>
2025-04-28 10:51:12 +01:00
Ilayaperumal Gopinathan
7f0a97d4a7 Remove FunctionCallbackResolver from chat model autoconfigurations
- FunctionCallbackResolver is deprecated and replaced by ToolCallingManager's ToolCallbackResolver

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-28 08:01:59 +01:00
Ilayaperumal Gopinathan
acd986e59c Add maven plugins to Spring AI BOM
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-28 07:53:40 +01:00
LiujunjieALiling
4e313a9dc6 feat(mcp): Add SSE endpoint parameter to WebFlux and WebMvc transport providers
Add serverProperties.getSseEndpoint() parameter to both WebFluxSseServerTransportProvider
and WebMvcSseServerTransportProvider constructors.

Signed-off-by: liujunjie <smartliujunjie@gmail.com>
2025-04-28 07:50:40 +03:00
Thomas Vitale
25e52b8c94 Fix mutable observation context
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>
2025-04-26 22:29:21 -04:00
Ilayaperumal Gopinathan
867bc2e028 Add additional metadata to Spring AI BOM
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-25 23:32:42 +01:00
Ilayaperumal Gopinathan
8c718ca8a7 Spring AI BOM updates
- 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>
2025-04-25 22:55:25 +01:00
Thomas Vitale
0024e4dd49 Chat Memory Enhancements
* 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>
2025-04-25 15:53:20 -04:00
Ilayaperumal Gopinathan
9692ebd7b4 Refactor toolcalling support for ZhipuAI
- 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>
2025-04-25 19:47:34 +01:00
Ilayaperumal Gopinathan
49e1dd10a9 Refactor toolcalling support for Minimax
- 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>
2025-04-25 19:47:34 +01:00
Mark Pollack
98052624b1 Remove Qianfan and Moonshot model modules
Drop support for the Qianfan and Moonshot models by removing their modules from the build.

These integrations are now maintained in the community repositories:
https://github.com/spring-ai-community/qianfan
https://github.com/spring-ai-community/moonshot
2025-04-25 14:02:23 -04:00
Mark Pollack
ff52859b2d migrate remaining moonshot modules to community repo 2025-04-25 13:05:11 -04:00
Thomas Vitale
2bc29dab32 Introduce TemplateRenderer for prompt templating
- 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>
2025-04-24 17:17:40 -04:00
Mark Pollack
f561b63493 Fix stdio typos in variable names 2025-04-24 17:06:09 -04:00
Wenhao Ma
a351042ca4 fix: fix stdio typos in variable names
Signed-off-by: Wenhao Ma <296232679@qq.com>
2025-04-24 17:03:58 -04:00
Soby Chacko
687dea52e0 Update Bedrock runtime from 2.29.29 to 2.31.26
- Update bedrockruntime.version to 2.31.26 in root pom.xml
- Standardize AWS SDK dependencies in bedrock-converse module to use
  bedrockruntime.version property instead of awssdk.version
- Affected dependencies: bedrockruntime, sts, netty-nio-client

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-04-23 12:36:28 -04:00
Soby Chacko
81b715b3d2 Update dependencies and cleanup misc version management
- Extract common dependency versions to properties in root pom
  - Added jsoup.version property
  - Added mockk-jvm.version property
  - Added neo4j-cypher-dsl-bom.version property
- Update dependency versions:
  - djl from 0.30.0 to 0.32.0
  - oci-sdk from 3.51.0 to 3.63.1
  - azure-identity from 1.14.0 to 1.15.4
- Remove hardcoded versions for consistency
- Minor polishing

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-04-22 19:10:36 -04:00
Soby Chacko
05529b6bf5 Update dependencies for vector stores
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>
2025-04-22 17:36:18 -04:00
Theo van Kraay
e723371723 cosmos db entra id support and fixes
add doc changes

Signed-off-by: Theo van Kraay <theo.van@microsoft.com>
2025-04-21 14:20:34 -04:00
Ilayaperumal Gopinathan
c0bc6231a5 Remove FunctionCallback deprecations
- Remove the super type FunctionCallingOptions from ToolCallingChatOptions

        - Move toolContext builder methods into ToolCallingChatOptions

    - Remove Model chat options' function specific usages

        - Replace them with tooling:

              FunctionCallback -> ToolCallback
              functions -> toolNames
        - Remove proxyToolCalls use

        - Remove deprecated methods

     - Update ChatClient methods

        - Replace FunctionCallback -> ToolCallback

        - Remove deprecated methods

     - Update DefaultChatClient

        - functionNames -> toolNames
        - functionCallbacks -> toolCallbacks

     - Update AdviseRequest

        - functionNames -> toolNames
        - functionCallbacks -> toolCallbacks
        - Remove FunctionCallingOptions and replace it with ToolCallingOptions

      - Remove FunctionCallingHelper

      - Update DefaultToolCallingChatOptions, ToolCallbackResolvers, ToolCallbackProvider to use Tool calling types

     - Update documentation

     - Remove VertexAiGeminiChatModelFunctionCallingIT and adjust MistralAiApiToolFunctionCallIT

Resolves #2528
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-18 10:55:55 +02:00
Soby Chacko
3756e16526 Upgrade azure-open-ai-client to 1.0.0-beta.16
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>
2025-04-17 17:07:11 -04:00
ddobrin
6e0c09838f Fixes #2185 - googleSearchRetrieval(true) causes INVALID_ARGUMENT error with Gemini 2.0 (use google_search instead) 2025-04-17 14:22:30 -04:00
ddobrin
53359fd9e6 Fixes #2185 - googleSearchRetrieval(true) causes INVALID_ARGUMENT error with Gemini 2.0 (use google_search instead) 2025-04-17 14:22:30 -04:00
James Ward
3ae67e78ab feat(mcp): Add instructions support to MCP server
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>
2025-04-17 14:13:54 +02:00
Ricken Bazolo
07a2643c06 Fix mistral moderation auto config
- Move Mistral Moderation model into separate autoconfiguration
 - Add/update MistralModelConfigurationTests

Signed-off-by: Ricken Bazolo <ricken.bazolo@gmail.com>
2025-04-17 12:36:29 +01:00
Thomas Vitale
1f59ccadad Make ChatClient and Advisor APIs more robust - Part 1
- 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>
2025-04-17 13:31:26 +02:00
Alexandros Pappas
593083980b Docs: Update OpenAI chat model definitions
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>
2025-04-17 11:22:16 +01:00
Soby Chacko
ea3fd92280 Add compatibility for MongoConnectionDetails.getSslBundle method
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>
2025-04-16 18:33:15 -04:00
Ilayaperumal Gopinathan
15a5069850 Remove use of deprecated isInternalToolExecutionEnabled in ToolCallingChatOptions
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-16 12:21:13 +01:00
Soby Chacko
53a7af500b Addressing the remaining checkstyle failures
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-04-15 11:04:03 +01:00
可能
aaf1589669 Update tools.adoc , change colon to semicolon (#2741)
Signed-off-by: 可能 <contact@revengemission.com>
2025-04-15 10:28:13 +01:00
Ilayaperumal Gopinathan
76a1dbe747 Fix ToolCallingChatOptions isInternalToolExecutionEnabled
- 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>
2025-04-15 10:14:57 +02:00
Tran Ngoc Nhan
257c91ccf2 Fix typo (#2719)
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-04-14 16:35:06 +01:00
Gareth Evans
91937d0dce fix: predicate should be wired in even if toolCallingManager is not null
Signed-off-by: Gareth Evans <gareth@bryncynfelin.co.uk>
2025-04-14 12:05:18 +02:00
Christian Tzolov
def15f9295 (docs) minor PE patterns copyedit changes
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-04-14 11:46:45 +02:00
Christian Tzolov
d32e773c50 (docs) Add Prompt Egineering Patterns section
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-04-14 10:42:44 +01:00
Soby Chacko
d9e7ace996 Miscellaneous checkstyle fixes
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-04-14 09:48:03 +01:00
Eddú Meléndez
318bdfc7c1 Add missing chat memory entries to BOM
Also, create new memory chat starters for cassandra and neo4j.

Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com>
2025-04-13 00:37:56 -05:00
Soby Chacko
58642552b9 Checkstyle fixes in spring-ai-commons
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-04-11 13:50:47 -04:00
Christian Tzolov
2dad4822cf refactor(docs): improve Berock embedding and RAG documentation
- 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>
2025-04-11 10:28:44 +02:00