Commit Graph

2120 Commits

Author SHA1 Message Date
jonghoonpark
9ca3a7d15f Refactor OpenAiImageOptions and enhance test coverage
This commit makes several improvements to the OpenAiImageOptions class:

1. Remove all deprecated methods from OpenAiImageOptions.Builder:
   - Removed withN(), withModel(), withQuality(), withResponseFormat(),
     withWidth(), withHeight(), withStyle(), and withUser() methods
   - These were marked as @Deprecated(forRemoval = true, since = "1.0.0-M8")

2. Align OpenAiImageOptions structure with OpenAiChatOptions:
   - Added fromOptions() static method for creating copies
   - Added copy() instance method
   - Updated Builder class to match pattern in OpenAiChatOptions
   - Changed Builder field from private final to protected
   - Added Builder constructor that takes an existing options object

3. Enhance setSize() method to maintain consistency:
   - Updated setSize() to parse the size string and update width/height properties
   - Added proper error handling for invalid formats
   - Ensures consistent state between size, width, and height properties

4. Comprehensive test coverage improvements:
   - Added tests for builder pattern with all fields
   - Added tests for copy functionality
   - Added tests for all setter methods
   - Added tests for default values
   - Added tests for equals(), hashCode(), and toString() methods
   - Added specific tests for the updated setSize() behavior
   - Fixed test expectations to match actual implementation behavior

These changes improve code consistency, maintainability, and test coverage
while removing deprecated methods that were scheduled for removal.

Signed-off-by: jonghoonpark <dev@jonghoonpark.com>
2025-05-06 01:03:06 -04:00
Mark Pollack
a2975a6cec Switch to mcp sdk 0.10.0-SNAPSHOT
Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-06 06:54:59 +02:00
The-Gamer-01
f93e2ae89f feat: fix readme
Signed-off-by: The-Gamer-01 <843497509@qq.com>
2025-05-06 00:42:57 -04:00
Łukasz Jernaś
81485e1603 Fix: Remove nonexisting parameter from javadoc
Signed-off-by: Łukasz Jernaś <lukasz.jernas@allegro.com>
2025-05-06 00:42:21 -04:00
Jemin Huh
b91777d15d Fix incorrect ChatMemory initialization example in chat-memory.adoc
Signed-off-by: Jemin Huh <hjm1980@gmail.com>
2025-05-06 00:41:48 -04:00
Thomas Vitale
356a68f15e Remove deprecations in JdbcChatMemory
* Remove deprecated APIs for JdbcChatMemory.
* Improve documentation about chat memory vs. chat history.
* Fix mismatch between docs vs code for max messages in MessageWindowChatMemory.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-06 00:40:08 -04:00
ndoe
8acf4b99ff GH-2737 Returning logprobs in generation metadata when requested
Signed-off-by: ndoe <ndoe@interactions.com>
2025-05-05 23:34:00 -04:00
Mark Pollack
fef01edadf update .gitignore 2025-05-05 23:13:20 -04:00
ykoh42
0569df745e docs: fix azure-openai-chat gradle dependencies
Signed-off-by: ykoh42 <kohyounghwan@gmail.com>
2025-05-05 21:44:49 -04:00
Bart Veenstra
3a3439edc4 feat: enhance AzureOpenAiResponseFormat to support JSON schema and builder pattern
Signed-off-by: Bart Veenstra <bart.veenstra@gmail.com>
2025-05-05 21:37:35 -04:00
Mark Pollack
52675d854c remove left over TemplateRender interface after moving it 2025-05-05 21:24:00 -04:00
Mark Pollack
84ebaababf remove unused method 2025-05-05 21:08:41 -04:00
Mark Heckler
3dc86d33ce Added Entra ID identity management for Azure OpenAI, clean autoconfiguration, and updated docs to reflect changes.
Signed-off-by: Mark Heckler <mark.heckler@gmail.com>
2025-05-05 21:03:43 -04:00
Ilayaperumal Gopinathan
228ef10bfb Remove deprecated methods from Media
- Remove deprecated constructor method Media(MimeType mimeType, URL url) from Media
 - Remove deprecated builder method data(URL url) from Media builder
 - Update references to use the builder and the data(URI) methods

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-05 01:47:45 +01:00
Ilayaperumal Gopinathan
06edee4069 Remove deprecated UserMessage constructors
- Remove deprecated constructor methods
 - Replace them with the builder methods

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-05 01:06:21 +01:00
Ilayaperumal Gopinathan
722c77e812 Remove deprecated PromptTemplate constructors
- Remove the deprecated constructors from PromptTemplate and replace the references using the builder methods

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-05 00:57:39 +01:00
Ilayaperumal Gopinathan
46be8987d6 Remove deprecations from OllamApi and AnthropicApi
- Remove deprecated constructors from OllamaApi and AnthropicApi
 - Modify AnthropicApi's public constructor to be private so that only the builder method can use it to construct
 - Update OllamApiAutoConfiguration and AnthropicChatAutoconfiguration to use the builder methods to construct the respective
 Apis
 - Fix other constructor usages to builder methods

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-05 00:21:34 +01:00
Ilayaperumal Gopinathan
76bee8ceb2 Remove deprecations from 1.0.0-M8
Remove deprecated DocumentCompressor/Ranker/Selector

 - These are replaced by the org.springframework.ai.rag.postretrieval.document.DocumentPostProcessor

Remove deprecated Chatclient/DefaultChatClient methods

In ChatClient:
 - Remove defaultTools and tools as these are replaced by defaultToolCallbacks and defaultToolNames respectively.

In DefaultChatClient:
 - Remove tools method implementation
 - Remove unused DefaultCallPromptResponseSpec and DefaultStreamPromptResponseSpec

Remove deprecated addMessage from Prompt

Remove deprecated isInternalToolExecutionEnabled() from ToolCallingChatOptions

 - This is replaced by getInternalToolExecutionEnabled()

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-04 23:54:30 +01:00
Mark Pollack
9e71b163e3 Remove Waston text generation model 2025-05-03 18:36:02 -04:00
Mark Pollack
6ffbb3acc6 Add simple hello world test to reproduce issue #2957 with qwen/ollama 2025-05-03 18:22:05 -04:00
Mark Pollack
bfcaad7b54 Second pass to remove qianfan code 2025-05-03 17:15:18 -04:00
g00glen00b
d5423f26f1 added @JsonIgnore to ResponseFormat.schema to avoid exposing internal properties (#2969)
Signed-off-by: g00glen00b <4865705+g00glen00b@users.noreply.github.com>
2025-05-03 15:56:01 -04:00
Christian Tzolov
78d90cd134 feat(vertex-ai-gemini): enhance jsonToStruct to support JSON arrays
- Improve the jsonToStruct method in VertexAiGeminiChatModel to handle JSON arrays
  in addition to JSON objects. When a JSON array is detected, it's now properly
  converted to a Protobuf Struct with an items field containing the array elements.
- Added test

Resolves #2647 , #2849

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-03 15:32:35 -04:00
Mark Pollack
2cbfb22db6 Polish ChatClientAdvisorTests 2025-05-03 14:26:17 -04:00
Mark Pollack
846165d47f update to build against boot 3.4.5 2025-05-02 12:49:43 -04:00
Mark Pollack
b275102063 clarify no direct transtive dependnecy on spring boot 2025-05-02 12:39:56 -04:00
Andres da Silva Santos
7bb553ecce Add support for stream usage in Azure OpenAi
This PR introduces support for streamUsage in the AzureOpenAiChatOptions.

   - Set com.azure.ai.openai.models.ChatCompletionStreamOptions#includeUsage via AzureOpenAiChatOptions.

Additionally:

 - Updates the unit test AzureOpenAiChatOptionsTests to reflect the changes.
 - Updates the documentation in azure-openai-chat.adoc.

Signed-off-by: Andres da Silva Santos <40636137+andresssantos@users.noreply.github.com>
2025-05-02 10:32:15 +01:00
Mark Pollack
5b7849de08 Add breaking changes to 1.0 M8 upgrade notes regarding chatclient tool calling 2025-05-01 16:49:57 -04:00
Christian Tzolov
6c52c99291 feat: Improve validation in MethodToolCallbackProvider
This ensures that validation errors are caught early during object construction
rather than later when methods are called, providing better error feedback.

- Add validation for tool-annotated methods during construction
- Validate duplicate tool names in constructor instead of only at getToolCallbacks() time
- Add comprehensive test suite for MethodToolCallbackProvider

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-01 13:12:34 -04:00
Thomas Vitale
90cab219d2 Inner advisor should handle output format instructions
Output format instructions should not be included until the very last advisor runs, otherwise there's a risk of templating failure if more than one advisor tries to render the prompt template. This change guarantees the output format instructions are always included right before calling the chat model, without the risk of previous advisors interfering with it.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-01 13:00:53 -04:00
Hari Ohm Prasth Rajagopal
f4d4dddf9d Add tests for McpWebFluxServerAutoConfiguration
Add unit tests to verify that the WebFlux server transport is properly configured
with a custom ObjectMapper that ignores unknown properties. This ensures that the
MCP server can handle JSON payloads containing fields not defined in the model
classes, which is important for forward compatibility.

Signed-off-by: Hari Ohm Prasath <hariohmprasath@gmail.com>
Signed-off-by: Hari Ohm Prasth Rajagopal <harrajag@amazon.com>
2025-05-01 14:45:31 +03:00
Christian Tzolov
3ceeb27101 feat(docs): add SSE endpoint configuration property to MCP client docs
- Add new connections.[name].sse-endpoint property with default value /sse
- Update table format to include default values column
- Clarify that connections.[name].url is a base URL endpoint

Related to #2724

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-01 14:19:20 +03:00
YunKui Lu
c2843f1990 Fix: Prevent exceptions when disabling Mcp server
- Prevent projects depending on `mcp-server-webmvc` or `mcp-server-webflux` from exceptions when `spring.ai.mcp.server.enabled` is set to `false`.
- Add unit tests to verify.

Signed-off-by: YunKui Lu <luyunkui95@gmail.com>
2025-05-01 14:01:41 +03:00
Christian Tzolov
04249e8257 feat(mcp): Add configurable SSE endpoint support for MCP client transports
Enhance MCP client transports with configurable SSE endpoint support:

- Add sseEndpoint parameter to SseParameters record
- Update HttpClientSseClientTransport to use builder pattern with sseEndpoint support
- Update WebFluxSseClientTransport to use builder pattern with sseEndpoint support
- Set default SSE endpoint to /sse when not explicitly configured
- Add tests for MCP client properties
- Enhance MCP client transport tests and refactor config

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-01 13:34:55 +03:00
Ilayaperumal Gopinathan
781e85dc2d Configuration updates to Spring AI BOM
Add repository element to the distributionManagement for Spring AI BOM

Add sonatype profile to Spring AI BOM

Add developer info to Spring AI BOM

Remove javadoc skip at spring-ai-spring-boot-testcontainers POM

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-01 08:05:27 +01:00
Ilayaperumal Gopinathan
3acc206eb2 Next development version 2025-04-30 17:51:20 +01:00
Ilayaperumal Gopinathan
b657cf3bae Release version 1.0.0-M8 2025-04-30 17:51:07 +01:00
Sun Yuhan
788fc3afe5 Rename the option skipBuiltInFunctionsValidation of StTemplateRenderer to supportStFunctions.
- Add javadocs

Signed-off-by: Sun Yuhan <1085481446@qq.com>
2025-04-30 12:33:34 -04:00
Sun Yuhan
af29a795b0 Added a "skipBuiltInFunctionsValidation" option to StTemplateRenderer, which defaults to false. When enabled, it skips validation of built-in functions in the template, preventing these built-in functions from being validated as variables to be replaced.
Signed-off-by: Sun Yuhan <1085481446@qq.com>
2025-04-30 12:13:33 -04:00
Mark Pollack
b39805af30 clean up upgrade-notes.adoc 2025-04-30 12:09:15 -04:00
Mark Pollack
c347c6feaf Refactor: Move evaluation, converter, transformer, and util classes
- Move evaluation core classes (Request, Response, Evaluator) to spring-ai-commons.
- Move chat-specific evaluators (FactChecking, Relevancy) to spring-ai-client-chat#evaluation package.
- Move OutputConverter implementations and related classes to spring-ai-model#converter package.
- Move MetadataEnricher transformer classes to spring-ai-model#transformer package.
- Move PromptAssert utility to spring-ai-rag#util package.
- Update relevant pom.xml files and adjust imports in affected classes.
- Document class movements in upgrade-notes.adoc for M8 release.

This refactoring improves module organization and separation of concerns.

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-04-30 11:45:06 -04:00
Mark Pollack
aa24a56f9b Add deprecated tools(String...) method for backwards compat on ChatClient 2025-04-30 10:54:44 -04:00
Mark Pollack
e939295b03 Make DefaultToolCallingManager final 2025-04-30 10:46:45 -04:00
Mark Pollack
091fca2d16 refactor(client): rename overloaded tools methods in prompt builder
Renames the ambiguous overloaded `tools` methods in `ChatClient.PromptRequestSpec`
to `toolNames` and `toolCallbacks` respectively. This improves clarity
and prevents potential issues with method dispatching based on argument types.

Updates relevant code examples and adds documentation to upgrade notes.

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-04-30 10:42:46 -04:00
Ilayaperumal Gopinathan
ec95eeb250 Revert "Add default ChatOptions to Prompt"
This reverts commit 4eeeb83d3f.

Revert "Make ImageOptions non-null when constructing ImagePrompt"

This reverts commit 0c0787b849.

Need to review more the impact of making these options not null.

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-30 10:21:52 -04:00
Berjan Jonker
af0303f65a Make responseMessage in AzureOpenAiChatModel.buildGeneration null-safe
Signed-off-by: Berjan Jonker <berjanjonker@users.noreply.github.com>
2025-04-30 09:53:23 -04:00
Christian Tzolov
5634d892fa Add tests for McpToolUtils.getToolCallbacksFromSyncClients method
- Tests empty client list handling returns empty result
- Tests single client with multiple tools correctly generates tool callbacks with prefixed names
- Tests multiple clients properly combine their tool callbacks
- Tests duplicate tool names across clients throw appropriate exceptions

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-04-30 08:17:02 +03:00
Christian Tzolov
e05552f6eb refactor(mcp): disable completion features and downgrade MCP SDK to 0.9.0
- Comment out AsyncCompletionSpecification and SyncCompletionSpecification imports
- Comment out completion parameters and processing in both sync and async server creation methods
- Downgrade MCP SDK version from 0.10.0-SNAPSHOT to 0.9.0

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-04-30 03:10:56 +03:00
Kushagra Thapar
6c85aeabba Updated azure service dependencies to the latest versions
Signed-off-by: Kushagra Thapar <kuthapar@microsoft.com>
2025-04-29 16:49:48 -04:00
Mark Pollack
435cf13647 Update docs to mention NoOpTemplateRenderer 2025-04-29 16:35:09 -04:00