Commit Graph

2287 Commits

Author SHA1 Message Date
Ilayaperumal Gopinathan
3de5c3fea9 Spring Boot 4.0 changes
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-28 21:17:33 +01:00
Andrea Vacondio
925f176e20 Update mistralai-embeddings.adoc (#3362)
Default value for the spring.ai.model.embedding should be "mistral" and not "true"

Signed-off-by: Andrea Vacondio <andrea.vacondio@gmail.com>
2025-05-28 19:25:12 +01:00
Ahmed Maruf
18ae16e6ac fix(json): prevent double-serialization of already valid JSON strings in JsonParser.toJson
If the input to JsonParser.toJson is a String that is already a valid JSON (e.g. a JSON array or object),
the method now returns the string as-is, instead of re-serializing it into a quoted string.

This avoids issues with deserialization errors, especially when tools expect structured types like List<T>.

test(json): add unit test to ensure toJson skips serialization of valid JSON strings

Signed-off-by: Ahmed Maruf <81756975+ohMaruf@users.noreply.github.com>
2025-05-28 12:30:37 +01:00
jonghoonpark
8283404278 fix typo in ToolCallback (#3352)
Signed-off-by: jonghoonpark <dev@jonghoonpark.com>
2025-05-27 18:46:14 +01:00
Christian Tzolov
7466cb9527 feat(chroma): improve handling and testing of complex metadata values
- Convert non-primitive metadata values to JSON strings in ChromaApi.AddEmbeddingsRequest for compatibility
- Add tests to verify metadata conversion and complex metadata handling in Chroma vector store integration
- Ensure OpenAiChatModel always returns annotations as a list of maps in metadata
- Add test dependency on spring-ai-advisors-vector-store for advisor-related tests
- Add json-unit-assertj for improved JSON assertions and validating JSON content in tests

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-27 13:26:00 +01:00
Henning Pöttker
277bbecfaa Fix links in documentation to Media.java (#3322)
Signed-off-by: Henning Pöttker <25299532+hpoettker@users.noreply.github.com>
2025-05-27 10:39:07 +01:00
Mingyuan Wu
f78b54939a Add metadata support for vector store types (#3325)
Signed-off-by: Mingyuan Wu <my.wu@outlook.com>
2025-05-27 08:11:59 +01:00
Jemin Huh
7b50bb56bc Fix awesome-spring-ai link to official repository (#3328)
Signed-off-by: Jemin Huh <hjm1980@gmail.com>
2025-05-27 07:46:54 +01:00
Cho-Hyun-Seung
14e55b2277 docs: update custom API key example using OpenAiChatModel.builder() (#3335)
Signed-off-by: Cho-Hyun-Seung <toki0327@naver.com>
2025-05-27 07:43:15 +01:00
Eddú Meléndez Gonzales
39192049ff Fix tools docs (#3292)
Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com>
2025-05-22 16:36:49 +01:00
Eddú Meléndez
4cac3ff8ed Add IT for Chat Memory with Sql Server
Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com>
2025-05-22 12:16:13 +01:00
Yang Buyi
fa0396fd07 Update mcp-server-boot-starter-docs.adoc (#3279)
Older STDIO transports can't be pulled, this should be a milestone version and should use `spring-ai-starter-mcp-server`.

Signed-off-by: Yang Buyi <52228969+yangbuyiya@users.noreply.github.com>
2025-05-22 11:07:58 +01:00
Jemin Huh
deb30c4e2d Fix incorrect external link formatting in effective-agents.adoc (#3275)
Signed-off-by: Jemin Huh <hjm1980@gmail.com>
2025-05-22 08:01:30 +01:00
Hyunsik Aeom
09dd973150 fix: Add document's title
https://docs.spring.io/spring-ai/reference/api/effective-agents.html
2025-05-22 07:46:36 +01:00
Tran Ngoc Nhan
0880d17182 Fix typos (#3263)
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-05-22 07:41:08 +01:00
Soby Chacko
b6f29a493f Checkstyle fixes
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-22 07:29:56 +01:00
Soby Chacko
029e8a10af test: fix useAutoConfiguredJdbcChatMemoryRepository test after connection leak fix
Add schema initialization property after commit 560540f properly closed connections

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-21 19:34:19 -04:00
Christian Tzolov
6f61fee774 feat(tools): Add configurable exception handling for tool execution
Adds a new configuration property `spring.ai.tools.throw-exception-on-error` that controls how tool execution errors are handled:
- When false (default): errors are converted to messages and sent back to the AI model
- When true: errors are thrown as exceptions for the caller to handle

The implementation:
- Adds the property to ToolCallingProperties
- Updates ToolCallingAutoConfiguration to use the property
- Improves error handling in MCP tool callbacks to use ToolExecutionException
- Adds tests to verify both behaviors
- Updates documentation with the new property

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-21 22:11:15 +01:00
Dan Sarlo
560540f259 Fix datasource connection leak when using the JdbcChatMemoryRepository
Signed-off-by: Dan Sarlo <81384153+dsarlo-viso@users.noreply.github.com>
2025-05-21 15:48:01 -04:00
Ilayaperumal Gopinathan
d93ab77d70 Next development version 2025-05-19 10:42:06 +01:00
Ilayaperumal Gopinathan
fcd2803f36 Release version 1.0.0 2025-05-19 10:40:35 +01:00
Mark Pollack
a5fdfdbfe9 add effective agents section (#3247) 2025-05-19 10:24:49 +01:00
Ilayaperumal Gopinathan
b68fa9d790 Add spring-ai-starter-vector-store-couchbase to Spring AI BOM
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-19 10:20:21 +01:00
shusheng007
f5243b8fe2 Update openai-embeddings.adoc
change incorrect configuration: `spring.ai.openai.chat.embeddings-path` to the correct: `spring.ai.openai.embedding.embeddings-path`

Signed-off-by: shusheng007 <wangben850113@163.com>
2025-05-19 05:20:12 -04:00
Ilayaperumal Gopinathan
d601af76b5 Add spring ai starter for model chat memory to BOM
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-19 10:11:13 +01:00
Thomas Vitale
144ae1ec92 Support custom template in RelevancyEvaluator
The RelevancyEvaluator is key for validating RAG flows. This pull request improves it by making the PromptTemplate configurable, improving the format of the default one, introducing a Builder, and extending the documentation with more details on how to use it.

I added some unit tests. The RelevancyEvaluator is used in lots of integration tests in the project to test the QuestionAnswerAdvisor and RetrievalAugmentationAdvisor, that also help assessing the evaluator itself.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-18 18:20:24 -04:00
Thomas Vitale
66d155c153 fix: QueryTransformers must accept input ChatOptions
Fixes gh-3175

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-18 18:18:07 -04:00
Mark Pollack
d436ee85c4 docs: Improve ChatClient implementation notes
* Add context about reactive/imperative applications
* Fix typos and improve formatting
* Highlight Spring Boot 3.4 bug as IMPORTANT note
* Clarify tool calling impact on Micrometer observations
2025-05-18 18:16:26 -04:00
Thomas Vitale
f9f71a805d RAG - Document joiner should sort by score
The current implementation of ConcatenationDocumentJoiner should sort the final document list by score in descending order, so to keep the most relevant documents at the front of the list. This PR fixes that.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-18 18:01:49 -04:00
Thomas Vitale
46491c0426 Relaxed toolCallArguments validation
There seems to be some models not handling correctly the non-nullability of toolCallArguments when defining a tool call. For example, the Ollama implementation is always null-safe (if no tool argument, then '{}' is used). Other implementations might produce a null value.

This PR relaxes the toolCallArguments validation to support null toolCallArguments within ToolCallingObservationContext.

Fixes gh-3234

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-18 18:00:04 -04:00
Thomas Vitale
81137cae54 MCP ToolCallbackProvider autoconfig should use concrete class
Currently, the MCP Tool autoconfiguration defines the SyncMcpToolCallbackProvider and AsyncMcpToolCallbackProvider beans returning the ToolCallbackProvider interface. That generates autowiring warnings in IDEs when trying to inject the specific class.

The Spring Boot project recommends being specific. 'When declaring a @Bean method, provide as much type information as possible in the method’s return type. For example, if your bean’s concrete class implements an interface the bean method’s return type should be the concrete class and not the interface. Providing as much type information as possible in @Bean methods is particularly important when using bean conditions as their evaluation can only rely upon to type information that is available in the method signature.'

See https://docs.spring.io/spring-boot/reference/features/developing-auto-configuration.html#features.developing-auto-configuration.condition-annotations.bean-conditions

This PR ensures concrete classes are used.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-18 21:26:37 +02:00
Christian Tzolov
14972f981f docs: minor adivsor docs update
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-18 19:10:32 +02:00
Christian Tzolov
36c597798d docs: reorganize tool calling documentation and add observability details
- Update Observability section with details about tool calling observability support
- Move "Migrating to ToolCallback API" guide from Tool Calling section to Upgrade Notes
- Update Observability section with details about tool calling observability support

Related to #3230

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-18 08:37:57 -04:00
Yanming Zhou
769cf10326 JdbcChatMemoryRepository should use the provided JdbcTemplate
Before this commit, the underlying `JdbcTemplate` is created like `new JdbcTemplate(providedJdbcTemplate.getDataSource())`, it means that settings on provided `JdbcTemplate` will lose.

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-05-17 11:51:55 -04:00
Yanming Zhou
b83a162506 JdbcChatMemoryRepository should use the provided JdbcTemplate
Before this commit, the underlying `JdbcTemplate` is created like `new JdbcTemplate(providedJdbcTemplate.getDataSource())`, it means that settings on provided `JdbcTemplate` will lose.

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-05-17 11:50:39 -04:00
Yanming Zhou
bbc2bbf661 Improve JdbcChatMemoryRepository to simplify findConversationIds()
Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-05-17 11:11:13 -04:00
Mark Pollack
4ae26547db Remove file not intended to be in repo 2025-05-17 10:53:19 -04:00
Soby Chacko
b2d5ff0693 GH-3187: Replace Spring environment variables with custom alternatives
Fixes: #3187

This commit addresses the issue with Spring environment variables that directly
mirror Spring AI application properties, which can confuse users into thinking
they should always set environment variables that match Spring property names.

Instead, we've replaced all instances of SPRING_* prefixed environment variables
in the documentation with custom-named alternatives that are referenced using
Spring Expression Language (SpEL) or retrieved programmatically.

Each documentation section now shows multiple configuration approaches:

- Direct property setting in application.properties/yml
- Using custom environment variables with SpEL
- Accessing environment variables programmatically

This gives users more flexibility while making it clear that using SPRING_*
prefixed environment variables is not required or recommended.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-17 12:56:02 +01:00
Christian Tzolov
c2a694900c docs: Document the MCP ToolContext support
Resolves #3209

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-17 13:53:24 +02:00
Christian Tzolov
9ed7535ba0 feat(mcp): Add request timeout configuration for MCP server
Add support for configuring request timeout in MCP server with a default of 20 seconds.
This timeout applies to all requests made through the client, including tool calls,
resource access, and prompt operations.

- Add requestTimeout property to McpServerProperties with default of 20s
- Configure server builder with the timeout value
- Add tests for default and custom timeout configurations
- Update documentation with the new property

Resolves #3205

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-17 12:41:48 +02:00
Soby Chacko
8b8fb4f02d GH-886: feat(opensearch): Add path prefix configuration support
Fixes: #886

Add ability to configure path prefix for OpenSearch API endpoints via properties.
This allows connecting to OpenSearch instances running behind a reverse proxy
with a non-root path, similar to Spring Elasticsearch's path-prefix property.

- Add pathPrefix property to OpenSearchVectorStoreProperties
- Apply pathPrefix to OpenSearchClient when configured
- Add documentation and unit tests

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-17 09:59:49 +01:00
Andrei Shakirin
0bbccf8ca0 fix: #2146 getting default AWS region using DefaultAwsRegionProviderChain
Signed-off-by: Andrei Shakirin <andrei.shakirin@gmail.com>
2025-05-17 09:11:36 +02:00
Jonatan Ivanov
cd3fc2f816 Change log level from DEBUG to INFO for ObservationHandlers
The features are disabled by default and users need to explicitly
enable them. Probably it makes more sense to log on INFO level so that
users don't need to change the log level if they use the default
behavior of Spring Boot.

See gh-3003
See gh-3127
2025-05-17 08:02:45 +02:00
Christian Tzolov
5d6bbd9368 refactor: update dependencies to use spring-ai-model and spring-ai-commons
Replace spring-ai-client-chat dependency with spring-ai-model in model implementations
and memory repositories, and with spring-ai-commons in document readers. This change
improves the dependency structure by having components depend on the appropriate
abstraction level.

Additional changes:
- Add slf4j-api dependency to pdf-reader and spring-ai-retry
- Move spring-ai-client-chat to test scope in spring-ai-ollama
- Fix XML formatting in some pom.xml files

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-16 19:58:11 +02:00
Jhzlo
8a5f68d655 refactor: remove redundant samples() method
samples() duplicates N(), both setting the same field.
Keeping only N() simplifies the builder API and aligns with ImageOptions.

Signed-off-by: Jhzlo <kjh0010703@naver.com>
2025-05-16 12:57:47 -04:00
Jhzlo
2721c9e676 refactor: simplify stylePreset merge logic in StabilityAiImageOptions builder
Replaces redundant or conflicting stylePreset assignments with a single mergeOption call using runtime style and default stylePreset.

Signed-off-by: Jhzlo <kjh0010703@naver.com>
2025-05-16 12:50:20 -04:00
Mark Pollack
0147d3bd55 Fix typos
Signed-off-by: Ji To Kim <jitokim@users.noreply.github.com>
Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-16 12:45:08 -04:00
Yanming Zhou
bb3556e8d1 Fix that spring.ai.mcp.server.base-url is ignored
Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-05-16 17:30:32 +02:00
Christian Tzolov
d1ead23aa0 minor test name spelling fix
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-16 16:55:15 +02:00
Christian Tzolov
4bde57790d fix checkstyle
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-16 10:08:23 -04:00