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>
* 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>
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>
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>
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>
- 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>
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>
- 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>
* 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>
- 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>
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>
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>
Replaces redundant or conflicting stylePreset assignments with a single mergeOption call using runtime style and default stylePreset.
Signed-off-by: Jhzlo <kjh0010703@naver.com>
- 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>
- 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>
- 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>
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>
- 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>