Refactors the test codebase to use tools instead of functions.
- Rename FunctionCallback to FunctionToolCallback
- Rename FunctionCallingOptions to ToolCallingChatOptions
- Update API methods from functions() to tools()
- Deprecate function-related methods in favor of tool alternatives
- Refactor MethodToolCallback implementation with improved builder pattern
- Update all tests to use new tool-based APIs
- Add funcs to tools migration guide
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Remove model specific Usage implementations
- Add `Object getNativeUsage()` to Usage interface
- This will allow the model specific Usage data to be returned
- At the client side, client needs to cast the return type of `getNativeUsage` into the corresponding Usage returned by the model API
- Rename `generationTokens` to `completionTokens`
- Since `completion` token name is more common among the models, renaming generation tokens into completion tokens
- Maintain JSON deserialization compatibility for legacy `generationTokens` field
- Remove deprecated Long-based constructors to avoid API ambiguity
- Change the prompt, completion and total token return types from Long to Integer
- This is a breaking change that requires updating all constructor calls
- Integer is sufficient for token counts and aligns better with most model APIs
- Use DefaultUsage for most of the model specific usage handling
- When initializing set the native usage to the model specific usage type
- Ensure immutability by making all fields final and removing setters
- Add comprehensive test coverage for all functionality including edge cases
Resolves#1407
- Refactor the builder methods to remove `with` as the prefix.
- Introduce new methods with updated naming conventions.
- Deprecate the existing `with*` methods to maintain backward compatibility.
Signed-off-by: Alexandros Pappas <alexandros.pappas@yiluhub.com>
- Accumulate the token usage when toolcalling is invoked
- Fix both call() and stream() methods
- Add `usage` field to the Chat completion choice as the usage is returned via Choice
- Add Mootshot chatmodel ITs for functioncalling tests
Move the tests into MoonshotChatModelFunctionCallingIT
This commit adds support for the MiniMax-Text-01 model,
which is recommended for general scenarios due to its
longer context window.
The new model is added to the ChatModel enum as MiniMax_Text_01.
Signed-off-by: Alexandros Pappas <alexandros.pappas@yiluhub.com>
* Remove use of Document.getContext method from spring-ai-core, use getText
* Remove deprecated ChatOptionsBuilder class
* Remove deprecated FunctionCallingOptionsBuilder class
- Modify the streaming vs call usage assertion to match the close to 25% value
- This change is done because the OpenAI chat response for call and stream invocation results in slight change in usage.
The Document class requires exactly one of text or media to be specified.
Updated textImageAndVideoEmbedding test to create separate Document
instances for text, image, and video content instead of combining them
in a single document.
The Document class requires exactly one of text or media to be specified.
Updated textImageAndVideoEmbedding test to create separate Document
instances for text, image, and video content instead of combining them
in a single document.
Add backwards compatibility methods to the Builder class in OllamaOptions
to maintain compatibility with code using the old withX style methods.
Each deprecated method delegates to its new counterpart and includes
proper Javadoc directing users to the new method name.
All deprecated methods are marked for removal in 1.0.0-M5, giving users
time to migrate to the new style while maintaining functionality.
This change streamlines the builder implementation by removing generics
that was complicating the implementation and providing hard to
debug checkstyle warnings.
It adopts a simpler, more direct builder pattern. Key changes:
- Remove generic type parameters from builder interfaces
- Switch to concrete builder implementations with direct field access
- Make all collection getters return unmodifiable views
- Ensure proper copy semantics in builders and options
- Add comprehensive test coverage for builder behavior
Following Amazon Bedrock's recommendations, deprecate individual model chat implementations (Anthropic, Cohere, Llama, Titan, etc.)
in favor of the unified BedrockProxyChatModel. This change promotes the use of Bedrock's Converse API which offers
benefits like model flexibility, extended functionality, and native tool support.
The Converse API does not support embedding operations, so these will remain in the current API and the embedding
model functionality in the existing InvokeModel API will be maintained
Introduce multimodality support for Mistral AI, which currently supports text and vision modalities.
Added integration tests and documentation for the new capability.
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
- VectorStore implementations may still be returning the embedding values and mapping onto
Document.class with Jackson
This change ignores that field, but vector store implementations should change to not return
the embedding data that is no longer stored in Document
The OpenAiImageOptions class previously had inconsistent behavior when
setting width and height properties. This change ensures that the size
property is only computed when both dimensions are available, preventing
invalid states in the API requests.
Key changes:
- Update setWidth/setHeight to only set size when both are non-null
- Add test cases to verify null size when dimensions are incomplete
- Improve code organization with proper import conventions
This change aligns with OpenAI's API requirements for image generation
where both dimensions must be specified for valid requests.
The Ollama options builder API has been refactored to follow standard Java
builder pattern conventions. This change deprecates all builder methods
prefixed with 'with' in favor of more concise method names, improving API
consistency and usability.
The deprecated methods are marked for removal in version 1.0.0-M5, giving
users time to migrate to the new builder pattern. This change aligns with
our goal of providing a more intuitive and maintainable API surface.
Breaking Changes:
* builder() method now returns Builder instead of OllamaOptions
* Clients using the old fluent API will need to migrate to the new builder pattern
Refactor Ollama options builder methods
Ollama has recently introduced native support for JSON structured output, as described in https://ollama.com/blog/structured-outputs.
This PR introduces support for it, both for directly passing a JSON schema and when using the Spring AI output conversion APIs.
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
- Refactor the builder methods to remove `with` as the prefix.
- Introduce new methods with updated naming conventions.
- Deprecate the existing `with*` methods to maintain backward compatibility.
- Update WatsonxAi documentation
- Refactor the builder methods to remove `with` as the prefix.
- Introduce new methods with updated naming conventions.
- Deprecate the existing `with*` methods to maintain backward compatibility.
- Update AnthropicChatOptions builder documentation
- Refactor the builder methods to remove `with` as the prefix.
- Introduce new methods with updated naming conventions.
- Deprecate the existing `with*` methods to maintain backward compatibility.
- Update MistralAiChatOptions builder documentation