Commit Graph

119 Commits

Author SHA1 Message Date
Christian Tzolov
ce2bb131e5 Implement Anthropic Claude3 Message API client support (direct)
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
2024-03-19 00:36:29 -04:00
Eddú Meléndez
8503078088 Add ServiceConnection support for
* ChromaDBContainer
 * MilvusContainer
 * QdrantContainer
 * RedisStackContainer
 * WeaviateContainer
 * OllamaContainer

Add docs
2024-03-18 23:29:55 -04:00
Eddú Meléndez
64308c4230 Cleanup imports 2024-03-18 15:04:54 +01:00
GuangxiaoLong
ea79a4fbba Update OpenAiStreamFunctionCallingHelper.java
preventing the occurrence of null pointers.
2024-03-18 14:32:07 +01:00
ahmed
c036931065 Implemented Bedrock Jurassic 2 ChatClient
- Implemented Bedrock Jurassic ChatClient
 - added documentation reference
 - implement auto-configuration and boot starter

 - Disable the BedrockAi21Jurassic2ChatClientIT.emojiPenaltyWhenTrueByDefaultApplyPenaltyTest() test
   as it  fails when run in combination with the other tests.
2024-03-16 14:03:18 +01:00
Christian Tzolov
9c19dc1665 Improve Antora documentation layout
- tename /api/clients/ into /api/chat
  - move the the image from /api/clients to /api
  - fix the layout inside the chat and embeddings docs. Moving the runtime options and sample controllers at top level.
  - adjust all affected links.
2024-03-16 11:26:19 +01:00
mackey0225
152420fcc4 Fix Typos and Grammatical Errors
* Fix Typo: Duplicate 'for' in documentation text
* Fix Typo: Duplicate 'to' in documentation text
* Fix broken links in documentation
* Correct grammar by deleting unnecessary 'an' in documentation
* Fix typo: Change 'tunning' to 'tuning' in documentation
* Fix typo: Change 'an' to 'can' in documentation
* Fix typo: Change 'generats' to 'generates' in documentation
* Fix grammatical error: Change 'a AI' to 'an AI' in documentation
* Fix grammatical error: Change 'a AI' to 'an AI' in code
* Fix Typo: Duplicate 'for' in code
2024-03-15 12:23:06 +01:00
pradipkhomane
be7e291860 Fixed typo in Bedrock Titan chat option exception 2024-03-15 12:05:18 +01:00
Mark Pollack
9e98962aba Add additional ctor for OpenAiEmbeddingClient 2024-03-14 15:56:45 -04:00
Mark Pollack
4c617e16b4 Prepare next development iteration 2024-03-12 14:33:45 -04:00
Mark Pollack
490f3cd1cb Milestone Release 0.8.1 2024-03-12 14:28:28 -04:00
Mark Pollack
4fd15b11c5 Add documentation for OpenAI Transcription
Fixes #401
2024-03-12 12:23:25 -04:00
Mark Pollack
ed5eef4b0b fix failing test due to property name change of model->deployment-name in azure 2024-03-12 10:45:14 -04:00
Mark Pollack
1e98f82e03 Change Azure embedding and chat options 'model' property to 'deployment-name'
* Azure uses 'deployment-name' when provisioning models and is what needs to
  be passed in to the client, not the model name.
  This is a difference with the OpenAI API that doesn't have a deployment-name
  This change aligns the terminology used with Azure so that there is
  less confusion when setting configuration property values

Fixes #10
2024-03-12 10:26:32 -04:00
Christian Tzolov
4209d5a65d Make consistent sync/stream AssistantMessage properties for OpenAI and Mistral AI 2024-03-12 11:34:56 +01:00
Mark Pollack
7f1570d722 Update javadoc for message package and docs for Gemini Multimodal support 2024-03-11 19:14:53 -04:00
Christian Tzolov
0fdc6aa844 Add streaming Function Calling support of OpenAI and Mistral AI
- Extends the  reactor logic to to allow aggregation of the chunked tool-calls messages and
  leverage the exsiting fnctoin calling infrastructure.
  - Seamples experience for the streaming functionality.
  - Add Message ID and  FinishReason to the returned Generations properties.
2024-03-10 21:01:59 +01:00
Christian Tzolov
7f60e03054 Fix Bedrock Anthropic line separator handling on Windows
Resolves an issue where Bedrock Anthropic failed to handle line separators properly on Windows.

  Resolves #404
2024-03-08 18:25:02 +01:00
Christian Tzolov
fef730301c Replace %n by System.lineSeparator() 2024-03-08 15:15:01 +01:00
Christian Tzolov
ba940395b6 Use platform independent line separators 2024-03-08 09:43:15 +01:00
Christian Tzolov
1d6d11c99b Resolve OpenAiApi initialization bug 2024-03-07 19:42:16 +01:00
Christian Tzolov
1e3eaec7b9 Refactor and centralize Retry logic:
- Establish a new "spring-ai-retry" project, implementing a default HTTP error handler,
   RetryTemplate, and handling both Transient and Non-Transient Exceptions.
 - Streamline existing clients (e.g., OpenAI and MistralAI) to utilize "spring-ai-retry."
 - Integrate retry auto-configuration with customizable properties, extending it to OpenAI and MistralAI Auto-Configs.
 - Allow configuration of RetryTemplate and ResponseErrorHandler for various clients, including OpenAIChatClient,
   OpenAiEmbeddingClient, OpenAiAudioTranscriptionCline, OpenAiImageClient, MistralAiChatClient, and MistralAiEmbeddingClient.
 - Add tests for default RestTemplate and ResponseErrorHandler configurations in OpenAI and MistralAI.
 - Introduce new retry auto-config properties: "onClientErrors" and "onHttpCodes".
 - Implement tests for retry auto-config properties.
 - Generate missing license headers.
2024-03-07 11:27:01 -05:00
sblashuk
8ed2af4115 Add Ollama enum with supported models and their ids
- Add missing license header
2024-03-07 15:04:29 +01:00
Mark Pollack
bcb559a82c add license header plugin and update all java files 2024-03-06 17:39:37 -05:00
Jiafu Tang
f6c57f6f60 rename directory spring-ai-stabilityai to stability-ai 2024-03-06 17:21:36 -05:00
youngpar
3938cc83ad Remove setters from options interface
* Add test code
2024-03-06 17:18:14 -05:00
youngpar
7396597678 Update to add latest gpt-3.5 turbo model number 2024-03-06 15:48:20 -05:00
Christian Tzolov
8ae506f3fb Improve the OpenAi Audio code structure
- Move the OpenAiAudioTranscriptionClient and OpenAiAudioTranscriptionOptions under the org.springframework.ai.openai package.
 - Rename the AudioTranscriptionRequest into AudioTranscriptionPrompt.
 - Minor imports cleaning.
2024-03-06 12:08:31 +01:00
Michael Lavelle
7d04167833 Adding support for OpenAI Audio transcriptions
- Make it use the new OpenAiAudioApi.
 - Remove trascription code from spring-ai-core. Too early to generalize.
   Move all related code under the spring-ai-openai project.
 - Fix missing licenses and javadocs.
 - Add 'Audio' prefix for Transcription classes and packages.
 - Add missing auto-configuraiotn and tests.
2024-03-05 13:29:26 +01:00
Christian Tzolov
54930af220 Make the OpenAiAudioApi return ResponseEntity<value> 2024-03-03 10:49:09 +01:00
Christian Tzolov
5e6815863c Make BedrockCohereEmbeddingOptions implement EmbeddingOptions
Resolves #389
2024-03-03 09:14:08 +01:00
Christian Tzolov
6122b2a379 Fix OpenAiAudioApi javadoc 2024-03-03 00:09:17 +01:00
Christian Tzolov
ccd5767ead Stabilize OpenAiAudioApi test fixtures 2024-03-02 23:33:38 +01:00
Christian Tzolov
8703582160 Fix broken tests after updateding the models from DALL-E-2 to DALL-E-3 2024-03-02 22:17:36 +01:00
Christian Tzolov
e819b7c313 Add missing AOT hits for OpenAiAudioApi and OpenAiImageApi 2024-03-02 22:01:08 +01:00
Christian Tzolov
a48518636b Add low-level OpenAI Audio Api Client
- Add OpenAiAudioApi that impelemnts the Speech, Transcription and Translation endpoint.
 - Add ITs
2024-03-02 21:58:02 +01:00
Christian Tzolov
b58ef6d5a3 OpenAI api improvements
- Factor out OpenAiApiClientErrorException and OpenAiApiException out of
  OpenAiApi into standalone common package.
- Move the HTTP error handling and header setup into a shared ApiUtils.
- Add ChatModel and EmbeddingModel enums to OpenAiApi.
- Add ImageModel enum ot OpenAiImageClient.
2024-03-01 22:17:07 +01:00
Christian Tzolov
50547188f7 Rename legacy Vertex AI into Vertx AI PaLM2 classes 2024-03-01 14:51:02 +01:00
Ricken Bazolo
31d6194d9d Add mistralai support documentations
Also
 - fix a MistralAiApi (and OpenAiApi) issue just introduced by Mistral API
 - change the auto-config properties prefix from spring.ai.mistral.* to spring.ai.mistralai.*
 - minor doc references updates.
2024-03-01 11:28:45 +01:00
Christian Tzolov
076726c1ca Add Mistral AI Function Calling support
- Make MistralAiChatClient extend the AbstractFunctionCallSupport and implement the necessary abstract classes.
 - Extend the MistralAiApi to include the latest (undocumented) changes providing function calling support as well.
   The Mistral AI is almost identical to the OpenAI API except it doesn't support parallel function colling (e.g. missing tool_call_id).
 - Add MistralAiApi function calling tests (implement the Mistral tutorial).
 - Extend the misral chat options to include the new API features and function call abstractions.
 - Extend Mistral's chat auto-configration to accomodate the function callback support.
 - Add ITs for testing function calling.
 - Remove redundant code from MistralAiApi and OpenAiApi.
 - Simplify and improve the HTTP error handling in OpenAiApi, ImageAiApi and MistralAiApi.
2024-03-01 09:53:01 +01:00
Christian Tzolov
5552a118aa Fix a bug in MistralAiApi HTTP error message handling 2024-02-29 12:35:03 +01:00
Christian Tzolov
41a256cb60 Simplify the doc catalog. Add 0.8.1 update notes 2024-02-28 21:41:34 +01:00
Christian Tzolov
c001650551 Minor code improvements 2024-02-28 16:30:39 +01:00
Christian Tzolov
65d42c9d4f Add full support or Vertex AI Gemini and Azure OpenAI function calling
- Extend the Spring AI Message with getMediaData() : List<MediaData>
   MediaData is a pair of MimeType and data of type Object.
   Message#getContent() return text only.

 - VertexAI Gemini Support
   - implement VertexAiGeiminChatClient for ChatClient and StreamingChat client and support for MediaData content.
     add IT tests for Chat, Streaming and Multimodality
   - add Auto-configuration + ITs
   - add Gemini Spring Boot starter.
   - add clients and boot starters to the Spring AI BOM.
   - add Anotra documentation for the Gemini chat client.
   - update gemini to latest 26.33.0 BOM.
   - add vertex ai gemini dependencies to the BOM.
   - add Vertex AI Gemini API Function Calling support
   - add Gemini API Function Calling Streaming support
   - add vertex ai gemini function calling documentation
   - factor out the Function Calling functionality into common abstraction used by OpenAI, Azure and Gemini.
   - group the VertexAI documentation under a common parent
   - add PortableFunctionCallingOption that implements FunctionCallingOptions and ChatOptions and provide builder for it.
   - remove some deprecated code.
   - allow authorization with GoogleCredentials form json file.
   - add AOT support for VertexAI Gemini.
   - move legacy Vertex AI into VertexAI PaLM2.
   - better handling for empty chat responses.
   - update the Gemini version to latest 26.33.0. This required lifting the protobuf-java to 3.25.2 as well.
   - fix a bug for handling System messages with Gemini.

- Implement Azure OpenAI Function Calling
  Uses the same the common abstractions used by OpenAI and Gemini: FunctionCallingOptions and AbstractFunctionCallSupport
2024-02-28 15:41:37 +01:00
Christian Tzolov
35808498f9 Mistral AI: test package restructuring. Fix failing tests. Add AOT tests 2024-02-28 15:13:45 +01:00
Christian Tzolov
a81a99ff9d Mistral AI improvements
- add AOT support.
 - move the org.springframework.ai.mistral package into org.springframework.ai.mistralai.
2024-02-28 14:46:13 +01:00
ricken07
30c3530561 Add integration for Mistral AI Chat and Embedding models
- Implement MistrealAiApi as a REST client for the Mistral REST API.
 - Add MistralAiChatClient implementing ChatClient and StreamingChatClient.
   Add MistralAiChatOptions implementing ChatOptions.
 - Add MistralAiEmbeddingClient impelementing EmbeddingClient.
   Add MistralAiEmbeddingOptions implementing EmbeddingOptions.
 - Add Unit and IT tests for api and clients.
 - Add mistral  auto-configuration and boot strarter
 - update auto-config property for Mistral AI embedding client
 - update auto-config property for Mistral AI embedding client

 Additional, review changes:
 - Add missing license headers.
 - Fix the intialization of defaul options.
 - Code re-formatting to improve the readabitliy.
 - Many improvements
 - Add missing sine annotations
 - Remove stream field from MistralAiChatOptions. This handled internally.
 - Add MistralAiApi ChatModel and EmbeddingModel enums.
 - Add MistralChatClientIT for testeing chat, stream , parsers...
 - Add MistralAiApiIT tests
 - Refactor and streamline the MistralAiAutoConfiguration.
 - Add MistralAiAutoConfigurationIT
2024-02-28 13:29:35 +01:00
Christian Tzolov
21fc676fba Improve SpringAI models AOT support
- Fix various issues for bedrok/llama2/titan/choere,palm2,openai,azure-openai and vertex
 - Addd demo tests: https://github.com/tzolov/spring-ai-aot-tests
 - Fix broken Ollama AOT configuration
 - Code style & doc improvements for onnx transformer client

 Part of #360
2024-02-26 21:50:04 +01:00
Mark Pollack
8532cb7bcc Bump to 0.8.1-SNAPSHOT 2024-02-23 11:11:14 -05:00
Christian Tzolov
272ed099ed Fix Azure option merging bug 2024-02-22 18:33:21 +01:00