Commit Graph

806 Commits

Author SHA1 Message Date
Ilayaperumal Gopinathan
d8c728e574 Remove explicit test dependency version for jackson-dataformat-xml
- Use the dependency from Spring Boot BOM

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-06-12 19:53:17 +01:00
Ilayaperumal Gopinathan
3bce15a349 Revert "Fix OpenAiChatClientMethodInvokingFunctionCallbackIT"
This reverts commit 95b3df7a2b.
2025-06-12 17:46:49 +01:00
Alexandros Pappas
d9e3037984 feat: equals, hashCode, deep copy, and tests to MiniMaxChatOptions
This commit enhances MiniMaxChatOptions by:
- Updating `equals` and `hashCode` methods for proper object comparison.
- Updating `copy()` method, creating new instances of mutable collections (List, Set, Map, Metadata) to prevent shared state.
- Adding `MiniMaxChatOptionsTests` to verify `copy()`, builders, setters, and default values.
- Add more tests for objects not equal, defensive unmodifiable getters etc.

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-06-12 12:33:25 -04:00
Alexandros Pappas
cfbefee6a2 feat(ollama): add retry template integration to OllamaChatModel
* Update tests that are supposed to fail to not use retry
* Upgrade ot use Ollama 0.6.7

Signed-off-by: Alexandros Pappas <alexandros.pappas@yiluhub.com>
2025-06-12 11:06:53 -04:00
Alexandros Pappas
6ef15bdd74 feat: Add new Mistral AI chat models (#3523)
Adds MAGISTRAL_MEDIUM, MISTRAL_MEDIUM, MAGISTRAL_SMALL, and DEVSTRAL_SMALL to the available chat models.

Fixes: #3523

Auto-cherry-pick to 1.0.x

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-06-12 10:57:57 -04:00
Alexandros Pappas
9398850c2b feat: Add ElevenLabs Text-to-Speech support
This commit introduces a new `spring-ai-elevenlabs` module to integrate ElevenLabs' TTS service into Spring AI.

Key Features:
- **New Module:** `spring-ai-elevenlabs` with a Spring Boot starter for auto-configuration.
- **Core Classes:**
  - `ElevenLabsTextToSpeechModel`: Implements `TextToSpeechModel` and `StreamingTextToSpeechModel`.
  - `ElevenLabsTextToSpeechOptions`: Configurable TTS options (voice, format, speed, etc.).
  - `ElevenLabsApi` and `ElevenLabsVoicesApi`: Low-level REST clients for ElevenLabs APIs.
  - DTOs: `Speech`, `TextToSpeechMessage`, `TextToSpeechPrompt`, `TextToSpeechResponse`.
- **Auto-configuration:**
  - `ElevenLabsAutoConfiguration`, `ElevenLabsConnectionProperties`, and `ElevenLabsSpeechProperties`.
- **Functionality:**
  - Text-to-speech conversion with ElevenLabs voices.
  - Real-time streaming playback support.
  - Flexible runtime configuration via properties and model options.
- **Documentation:** Updated Spring AI reference guide with usage examples.
- **Tests:** Includes unit and integration tests for both success and failure scenarios.

Note:
- Some `tts` package classes will be relocated to the `core` module to support shared TTS abstractions, including upcoming OpenAI Speech API support.

- Added metadata support to `TextToSpeechResponse`.
- Added tests and updated documentation.

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-06-11 15:26:15 -04:00
Alexandros Pappas
12f19dbfe0 feat(anthropic): Add support for streaming thinking events
Add necessary types and update stream processing to handle Anthropic's 'thinking' content blocks and deltas in streaming responses. This resolves an issue where an IllegalArgumentException was thrown for unhandled thinking event types.
format

Added docs

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-06-11 13:17:53 -04:00
Gareth Evans
c4e434a5e5 fix: bedrock titan embeddings should return usage
Auto-cherry-pick to 1.0.x

Signed-off-by: Gareth Evans <gareth@bryncynfelin.co.uk>
2025-06-11 11:54:54 +01:00
Ilayaperumal Gopinathan
95b3df7a2b Fix OpenAiChatClientMethodInvokingFunctionCallbackIT
- Update test to check if the exception is thrown when using the method without toolcontext as method argument but with explicit toolcontext values

 - Add test to verify that exception is not thrown when toolcontext is not set even with the callback method with the toolcontext argument

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-06-11 11:04:53 +01:00
jasonparallel
c89d4820dd correct @formatter:onn to @formatter:on (#3477)
Signed-off-by: Jason Smith <jasonparallel@gmail.com>
2025-06-10 17:34:47 -04:00
Piotr Kubowicz
cecc046c26 build: Use spring-web instead of spring-webflux in spring-ai-retry
The dependency on spring-webflux was unnecessary, there was no code
inside spring-ai-retry that made use of it.

Also remove 'optional' from slf4j-api dependency (it's not optional,
if you don't have it on classpath, RetryUtils will fail to load).

Add explicit dependency on spring-webflux for modules that directly
import WebClient.

Auto-cherry-pick to 1.0.x

Fixes #3307

Signed-off-by: Piotr Kubowicz <piotr.kubowicz@gmail.com>
2025-06-06 10:59:24 +01:00
pavan kumar punna
eb69a60df1 feat(openai): for tts and chat completions update supported voices enums (#3411)
* feat(openai): for tts and chat completions update supported voices enums

Fixes: #3411

Auto-cherry-pick to 1.0.x

Signed-off-by: punnapavankumar9 <punnapavankumar9@gmail.com>
2025-06-04 22:02:11 -04:00
lambochen
4621c812cc fix: OpenAiChatOptions support transfer webSearchOptions
Unit test to veriy OpenAiChatOptions.fromOptions.webSearchOptions

Fixes: 3377

Auto-cherry-pick to 1.0.x

Signed-off-by: lambochen <lambochen@yeah.net>
2025-06-04 13:07:56 -04:00
Jan-Eric Harnack
ab88fea83e chore: move speech1.mp3 to src/test/resources
Fixes: 3433

Auto-cherry-pick to 1.0.x

Signed-off-by: Jan-Eric Harnack <janericharnack@googlemail.com>
2025-06-03 17:21:45 -04:00
Filip Hrisafov
0a1cf81cfc Add support for ApiKey for Anthropic and use it dynamically for every request
Fixes #3365

 - Set ApiKey as late as possible

Auto-cherry-pick to 1.0.x

Signed-off-by: Filip Hrisafov <filip.hrisafov@gmail.com>
2025-06-03 10:55:55 +01:00
YunKui Lu
ea995dfa51 docs:Revise the documents of deepseek and minimax-chat (#3408)
Fixes: #3408

Auto-cherry-pick to 1.0.x

Signed-off-by: YunKui Lu <luyunkui95@gmail.com>
2025-06-02 19:37:12 -04:00
Filip Hrisafov
64ea88ac93 Resolve OpenAI ApiKey for every request
- Set ApiKey as late as possible

Signed-off-by: Filip Hrisafov <filip.hrisafov@gmail.com>
2025-06-02 12:26:12 +01:00
Emmanuel Essien-nta
a58cfd96f8 Add unit tests for OpenAiStreamFunctionCallingHelper (#3312)
* Add unit tests for OpenAiStreamFunctionCallingHelper

Fixes: #3312

Auto-cherry-pick to 1.0.x

Signed-off-by: Emmanuel Essien-nta <colourfulemmanuel@gmail.com>
Signed-off-by: Soby Chacko <chackos@vmware.com>
Co-authored-by: Soby Chacko <chackos@vmware.com>
2025-05-30 13:37:54 -04:00
Ilayaperumal Gopinathan
313aae0e89 Revert "Resolve OpenAI ApiKey for every request"
This reverts commit 3a527eeb98.
2025-05-30 12:54:05 +01:00
Sun Yuhan
72fe3bfd5e fix(ollama): null check on chat model response' duration metadata
- Fixed an issue where the `from` method of `org.springframework.ai.ollama.OllamaChatModel` could not work correctly when a tool call occurred while using Ollama.

Signed-off-by: Sun Yuhan <1085481446@qq.com>
2025-05-30 12:00:22 +01:00
Alexandros Pappas
71e56fbed0 feat(anthropic): add support for claude-opus-4 and claude-sonnet-4 (#3351)
* feat(anthropic): add support for claude-opus-4-0 and claude-sonnet-4-0 models

- Introduce `CLAUDE_OPUS_4` and `CLAUDE_SONNET_4` to `ChatModel` enum
- Update documentation to include new model options

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>

* add model aliases url to anthropic documentation

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>

---------

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-05-30 11:32:26 +01:00
Filip Hrisafov
3a527eeb98 Resolve OpenAI ApiKey for every request
Signed-off-by: Filip Hrisafov <filip.hrisafov@gmail.com>
2025-05-30 09:59:29 +01:00
Jan-Eric Harnack
1f2bd0878a feat(openai): add support for pdf files as media
Signed-off-by: Jan-Eric Harnack <janericharnack@googlemail.com>
2025-05-29 13:56:10 +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
Soby Chacko
b6f29a493f Checkstyle fixes
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-22 07:29:56 +01: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
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
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
2f5d53fde0 Fix VectorStoreChatMemoryAdvisor streaming bug
- Override adviseStream method in VectorStoreChatMemoryAdvisor to properly handle streaming responses
- Add tests to verify the fix works with both normal and problematic streaming scenarios

Fixes #3152

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-16 14:08:20 +01:00
Soby Chacko
368be3a04f Fixing miscellaneous checkstyle errors
Enabling checkstyle by default in the project build

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-16 11:08:33 +01:00
Jhzlo
e14e788a47 fix: add @JsonProperty for response_format
Ensures the response_format field is correctly serialized for Stability AI API.

Signed-off-by: Jhzlo <kjh0010703@naver.com>
2025-05-14 12:31:23 -04:00
LingXiao Qi
55ac78046d fix: OpenAiApi comment (#3165)
Signed-off-by: lingxiao <lotus0721@outlook.com>
2025-05-14 14:21:16 +01:00
Ilayaperumal Gopinathan
f2940cffce Next development version 2025-05-13 19:06:16 +01:00
Ilayaperumal Gopinathan
30a9638de8 Release version 1.0.0-RC1 2025-05-13 19:05:52 +01:00
Mark Pollack
f5f02129b5 Fix MessageChatMemoryAdvisor in streaming case.
- The fix overrides the adviseStream method to use ChatClientMessageAggregator to properly aggregate streaming chunks before storing them in memory, similar to how PromptChatMemoryAdvisor handles streaming responses
- Added test

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-13 11:31:34 -04:00
Ilayaperumal Gopinathan
c646dfe9a8 Fix BedrockTitanEmbeddingModelIT
- Create ObservationRegistry bean for the tests

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-13 07:33:59 +01:00
Mark Pollack
59b36d14da Remove deepseek options form openaiapi
- These options are exclusive to deepseek and can be added to the deepseek model
2025-05-12 23:22:12 -04:00
Mark Pollack
848a3fd31f refactor: Simplify chat memory advisor hierarchy and remove deprecated API
- Remove deprecated ChatMemory.get(String conversationId, int lastN) method

- Replace AbstractChatMemoryAdvisor with BaseChatMemoryAdvisor interface in api package
- Make constructors private in all memory advisor implementations to enforce builder usage
- Rename CHAT_MEMORY_CONVERSATION_ID_KEY to CONVERSATION_ID and move to ChatMemory interface
- In VectorStoreChatMemoryAdvisor:
  - Rename DEFAULT_CHAT_MEMORY_RESPONSE_SIZE (100) to DEFAULT_TOP_K (20)
  - Rename builder method chatMemoryRetrieveSize() to topK()
  - Remove systemTextAdvise() builder method
- In PromptChatMemoryAdvisor:
  - Remove systemTextAdvise() builder method
  - Fix bug where only the last user message was stored from prompts with multiple messages
- Enhance logging in memory advisors to aid in debugging
- Add comprehensive tests for all advisor implementations:
  - Unit tests for builder behavior
  - Integration tests for the various chat memory advisors

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-12 19:41:18 -04:00
jonghoon park
0c95cc396f GH-3118: Fix NPE in OpenAIChatModel compatible streaming api with vertex ai gemini
Fixes: #3118

Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-05-12 19:20:09 -04:00
Tran Ngoc Nhan
7aa440e6bc Fix typos
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-05-12 13:31:40 +01:00
lambochen
7739e1e54c OpenAiImageModel support configure imagesPath
Signed-off-by: lambochen <lambochen@yeah.net>
2025-05-12 17:31:49 +08:00
Soby Chacko
15eb24cd91 GH-2168: Fix task type property name in Vertex AI embedding requests
Fixes: #2168

- Change property name from 'taskType' to 'task_type' in VertexAiEmbeddingUtils to match Google API expectations
- Add integration tests to verify task type behavior matches Google SDK
- Add missing auto truncate option copying in VertexAiTextEmbeddingOptions

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-10 16:21:09 -04:00
ddobrin
72a2862bce Fixes #3083 Update Google dependencies and model versions
Signed-off-by: ddobrin <ddobrin@google.com>
2025-05-10 16:43:00 +01:00
PSriVarshan
a36c70976c Add observability to Bedrock Titan Embedding model
Signed-off-by: PSriVarshan <psvvarshan@gmail.com>
2025-05-10 16:38:37 +01:00
Christian Tzolov
ad783d9867 Additional tests for the #1878
Add additional integration tests to ensure that the #1878 issue is resolved

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-10 16:51:40 +02:00
Christian Tzolov
5f6c618f76 feat: Add support for generic argument types in tool callbacks
- Enhance MethodToolCallback to properly handle generic types by using parameterized types
- Add unit tests for generic type handling (List, Map<String,Integer>, nested generics)
- Add integration tests for both Anthropic and OpenAI clients to verify tool calls with generic argument types

Resolves #2462

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-10 09:13:22 -04:00
Barsha Ghosh
9de13d1b2f GH-2342: Remove unused json-path dependency in spring-ai-openai
Signed-off-by: Barsha Ghosh <barshaghosh.721@gmail.com>

Use the proper StringUtils in OpenAiAudioSpeechModel

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-09 20:19:10 -04:00