Commit Graph

507 Commits

Author SHA1 Message Date
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
Mark Pollack
596f2b06c0 Move native hints into individual modules
* Use aot.factories approach for registration
* Add tests
* final tweaks- Thanks Josh!
2024-02-20 14:23:40 -05:00
Mark Pollack
ea7dce3833 Refine Bedrock README. Fixes #180 2024-02-19 12:36:03 -05:00
Mark Pollack
a107e313fc Fixes #219 - Remove dependency cycles 2024-02-19 12:24:16 -05:00
Christian Tzolov
fdd3fbb2f9 Revert default OpenAI embedding to text-embedding-ada-002 as some vector stores have problems with 3-small 2024-02-16 11:19:34 +01:00
Christian Tzolov
697e945950 Fix EmbeddingIT after default openai embedding model switch 2024-02-16 10:40:13 +01:00
Christian Tzolov
7ef49b8cef Set the default OpenAI Embedding model to text-embedding-3-small
The text-embedding-3-small has the same dimensions as previous text-embedding-ada-002.
  The text-embedding-3-large has higher dimensionality not supported by some Vector Stores.
2024-02-16 10:27:13 +01:00
Christian Tzolov
bd479e1388 Address review comments 2024-02-15 22:38:50 +01:00
Christian Tzolov
d580fe2757 Simplify Function Calling API 2024-02-15 20:26:31 +01:00
Christian Tzolov
1fa2036120 Refactor the Function Calling Support
- Remove the SpringAiFunction annotation in favour of palin Functino Beans, @Description annotation and JacksonClassAnnotation.
 - Update the function calling documentation to reflect latest changes.
 - Add a new openai option (and related property): spring.ai.openai.chat.options.beanFunctions.<function-name>.<description>
   Map of bean names and their descriptions to register as function callbacks.
 - Refactor the OpenAiAutoConfiguration to resolve and register the beans in beanFunctions.
 - Add dependency on Spring Cloud Function to use the FunctionContextUtils and FunctionTypeUtils
   Those utilites help to resolve the function input type signature.
 - Add DefaultToolFunctionCallback class for manually wrapping Functions.
 - Update the ITs.
2024-02-15 12:39:35 +01:00
Mark Pollack
43dbaf4edd Add documentation for Image Generation
- Refine StabilityAI classes
- Add documentation
2024-02-14 17:18:04 -05:00
Christian Tzolov
22bd645d1e fix azure model README broken link 2024-02-14 06:55:42 +01:00
Christian Tzolov
9d41e4380a Make model READMEs ponint to their corresponding Antora documentations 2024-02-14 06:50:23 +01:00