This change updates the type of portable chat options from Float to
Double. Affected options include:
- frequencyPenalty
- presencePenalty
- temperature
- topP
The motivation for this change is to simplify coding. In Java, Float
values require an "f" suffix (e.g., 0.5f), while Double values don't
need any suffix. This makes Double easier to type and reduces
potential errors from forgetting the "f" suffix.
APIs, tests, and documentation have been updated to reflect this
change.
Fixes gh-712
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
* Surface more configuration APIs to ChatOptions
* Use abstraction in Observations directly instead of dedicated implementation
* Simplify metadata config in observations for defined models
* Improve merging of runtime and default options in OpenAI
* Fix missing option in Mistral AI
Relates to gh-1148
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
The autoconfiguration adds the FunctionCallbacks directly to the model's ChatOptions,
which results in the FunctionCallback being included in the request each time it is called.
The modification registers the container's FunctionCallback directly to the model's functionCallbackRegister
using the parent AbstractToolCallSupport constsructor.
Replace the handleFunctionCallbackConfigurations by simplified runtimeFunctionCallbackConfigurations.
Co-authored-by Christian Tzolov <ctzolov@vmware.com>
- factor out the common funciton calling logic form AnthropicChatModel to the AbstractToolCallSupport.
- improve the AbstractToolCallSupport isToolCall to handle OpenAi and Anthropic.
- fix an issue with the function calling streaming aggreagation leading to lost usage statistics.
- small code improvements for OpenAiChatModel.
- introduce copy() method to the ChatOptions.
- make sure that the DefaultChatClientRequestSpec takes a copy of the input chat options to prevent multation.
- add a OpenAiChatClientMultipleFunctionCallsIT to reproduce the problem and verify the solution.
Resolves#1064
* Remove inheritance from HashMap
* No more subclasses per model provider
* Builder class for ChatResponse
* Fix the AbstractResponseMetadata#AI_METADATA_STRING parameter order
* ChatResponseMetadata ignore Null values.
- add new spring-ai-vertex-ai-embedding project.
- add VertexAiTextEmbeddingModel and VertexAiMultimodalEmbeddingMode with related options configuration classes.
- add ITs
- add auto-configuraiton and boot starters.
- register to BOM.
- add documentation.
- add multimodal embedding documentation
- extend the Embedding metdata so that it can keep references to the source document's data, Id, mediatype
Resolves#1013
Related to #1009
- add StreamEven API domain model for reliably parsing stream events.
- add StreamHelper#mergeToolUseEvents to aggregate partial tool use jsons into a list of ContentBlocks.
- add StreamHelper#eventToChatCompletionResponse to convert Flux<StreamEvents> into Flux<ChatCompletionResponse>.
- Rename MediaContent -> ContentBlock, RequestMessage -> AnthropicMessage, ChatCompletion -> ChatCompletionResponse.
- Improve tests and docs.
* Extend ChatResponseMetadata for Anthropic (blocking, streaming)
* Add ChatResponseMetadata for Mistral AI (blocking)
* Extend ChatResponseMetadata for OpenAI (blocking)
* Deprecate gpt-4-vision-preview and replace its usage in tests because OpenAI rejects the calls (see: https://platform.openai.com/docs/deprecations)
Fixes gh-936
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
* Move ChatClient and related classes into the chat.client package
* Move ChatModel and related class into the chat.model package
* Smaller refactorings to remove DSM cycles
* Update README.md
* Rename the ModelClient class hierarchy into Model:
- Rename ModelClient into Model. Update all code and doc references.
- Rename ChatClient to ChatModel. Update all ChatClient suffixes and chatClient fields and variables in code and doc.
- Rename EmbeddingClient into EmbeddingModel. Update the XxxEmbeddingClient class and variable suffixes and embeddingClient variables and fields in code and docs.
- Rename ImageClient into ImageModel.
- Rename SpeechClient into SpeechModel.
- Rename TranscriptionClient into TranscriptionModel.
- Update all javadocs and antora pages. Update the related diagrams.
* Create fluent API in ChatClient interface that now includes streaming support
* Add OpenAI FunctionCallbackWrapper2IT auto-config tests.
* Add ChatClientTest mockito testing.
* Add ChatModel#getDefaultOptions(), and remove @FunctionalInterface
* ChatModel enums extend the new ModelDescription interface.
* Implement fromOptions copy method in every ChatOptions implementation.
* Extend ChatClient to use the model default options if not provided explicitly.
* Update readme to provide guidance on how to adapt to breaking changes.
Co-authored-by: Christian Tzolov <ctzolov@vmware.com>
Co-authored-by: Mark Pollack <mpollack@vmware.com>
* Added more natural method names to DocumentReader, Transformer, Writer
* Changed Content getMedia to return Collection, deprecated use of List
* Change constructor for Media to accept URL and Resource, deprecate Object constructor
* Update ETL documentation and a few tests to avoid now deprecated APIs.
- Add Java reflection merge utilities that can access Azure private constructors and fields.
- Azure merging, creation of flux windows.
- Function call grouping for function processing.
- Do not perform greedy operation on Flux.
- Use "real" streaming on all client on function response.
- Gerimi: fix missing method impl.
- Mistral AI, OpenAI: fix missing stream flag in doCreateToolResponseRequest.
- Fix code formatting. No wildcard imports.
- Add Grogdunn to the javadoc authors.
- Anthropic 3 API does not support streaming funciton calling yet.
- Old OutputParser, BeanOutputParser, ListOutputParser and MapOutputParser classes are depredated
in favour of the new StructuredOutputConverter, BeanOutputConverter, ListOutputConverter and
MapOutputConverter implementations.
Later are drop-in replacements for the former ones, and provide the same functionality.
- Keep the existing parser package and classes for backward compatibility.
- Adjust the PromptTemplate for backward compatibility
- Update all existing tests to use the new Structured Output API.
- Improve the documentation for structured outputs.
- expanded the AnthropicApi to include Tool, facilitating request and response abstractions.
- extended AnthropicChatClient to inherit AbstractFunctionCallSupport, with
implementation of all necessary methods and function registration protocols.
- implemented FunctionCallingOptions interface in AnthropicChatOptions.
- added tools integration tests for AnthropoicApi and AnthropicChatClient.
- extended the auto-configuration with functional calling functionality.
- added ITs for tools auto-config.
- updated documentation on anthropic function calling and relevant pages for comprehensive coverage.
- Add a new autoconfig property spring.ai.retry.on-http-codes that list status codes (scuh as 429)
for which the retry should be attemptd.
- Updated the docs.
Resolves#433
- Implemented a MediaContent abstraction within the OpenAiApi to handle text and image inputs.
- Response message content remains a plain String, ensuring backward compatibility.
- Extended the OpenAiChatClient request creation process to seamlessly map Spring AI Messages with
Media content to the low-level OpenAiApi MediaContent types.
- Added integration tests for embedded and URL images, covering both synchronous and streaming calls.
- Updated the OpenAI class diagram to reflect the new media content types provided by the OpenAI API.
- Incorporated a chapter on multi-modality within the openai-chat.adoc documentation.
- Improve the openai multimoality doc
This commit introduces support for the Anthropic Claude3 Message API
(https://api.anthropic.com), enabling direct interaction with its services.
This is not a Bedrock Anthropic Claude3 implemenation.
Changes include:
- Implementation of a low-level client, AnthropicApi, to interact with
the message API endpoints specified in the Anthropic documentation
(https://docs.anthropic.com/claude/reference/messages_post), including support for streaming.
- Addition of AnthropicApi tests to ensure functionality and reliability.
- Support for multimodal requests within AnthropicApi.
- Adding the spring-ai-anthropic and boot starter into BOM and parent POM modules for streamlined usage.
- Add Anthropic Auto-configuration and Boot Starter for seamless integration into existing projects.
- Implementation of AnthropicChatClient with capabilities for synchronous and streaming communication,
including support for multimodal messages.
- Inclusion of both unit and integration tests to validate functionality across various scenarios.
- Add Antora documentation with comprehensive guidance on using AnthropicApi and AnthropicChatClient.
- Add of Ahead-of-Time (AOT) hints for AnthropicApi.
- update anthropic diagram