Commit Graph

457 Commits

Author SHA1 Message Date
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
Christian Tzolov
78f73d17be Exclude .antlr and aot.factories from license headers check 2024-03-07 15:42:00 +01: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
Mark Pollack
7cc2eabb90 Change flatten pom config
* root project pom now sets <dependencyManagement>remove</dependencyManagement>
* spring-ai-bom pom flatten plugin added with <dependencyManagement>keep</dependencyManagement>
2024-03-06 10:22:37 -05:00
Christian Tzolov
c0c9dd249b Upgrade Azure OpenAI from 1.0.0-beta.6 to 1.0.0-beta.7 2024-03-06 12:55:51 +01: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
Mark Pollack
db383f8c41 Update README.md 2024-03-04 16:39:25 -05:00
Christian Tzolov
8701cccfab Improve VertexAiGeminiAutoConfiguration to allow function calling portability
VertexAiGeminiAutoConfiguration creates its own FunctionCallbackContext
  instance with schema type set to SchemaType.OPEN_API_SCHEMA.
  This ensures that one other (non OPEN_API_SCHEMA) FucntionCallbackContext
  Bean overrds it.
2024-03-04 13:58:55 +01:00
Jiafu Tang
3a59587357 fix openapi-chat description in upgrade-notes 2024-03-03 11:47:32 +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
cbb59ce616 Improve readability of the PgVector Store code
Related to #461
2024-03-03 08:54:21 +01:00
Christian Tzolov
811d048965 Clarify the PGVector store documenatation 2024-03-03 01:40:54 +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
5b96965200 Update mistralai-chat.adoc
Mistral-ai: fix chat doc broken links
2024-03-02 11:53:38 +01:00
Ricken Bazolo
5206b85f13 update mistralai-chat doc 2024-03-02 11:36:40 +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
Christian Tzolov
aa55a96c95 Docs: add Mistral AI Function Calling doc 2024-03-01 12:34:06 +01:00
Anush008
0995515f2f Minor code and doc adjustments
- chore: renamed test file
 - fix: BOOL_VALUE ObjectFactory
2024-03-01 11:49:01 +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
a8110bb3da Qdrant improvements
- Update docs
 - Allow colleciton auto-creation if missing
 - Add cloud IT : QdrantVectorStoreCloudAutoConfigurationIT
 - Add auto-configuration properties tests: PgVectorStorePropertiesTests
2024-02-29 09:27:19 +01:00
Christian Tzolov
41a256cb60 Simplify the doc catalog. Add 0.8.1 update notes 2024-02-28 21:41:34 +01:00
Anush008
ea0b439dac Implement Qdrant vector store
- Implement QdrantVectorStore.
   Uses a custom parser for converting Spring AI metadata(Map<String, Object>) to Qdrant GRPC payload.
 - Implement Qdrant Expression Filter support.
   Uses a custom parser for converting Spring AI filters to Qdrant-compatible GRPC filters.
 - Add ITs using testcontainers.
 - Add antora docs adrant.adoc.
 - Add Qdrant vector store auto-configuraton and boot starter.

Additional (review) change:

 - Fix poms parent to 0.8.1-SNAPSHOT.
 - Rename ObjectFactory into QdrantObjectFactor.
 - Rename ValueFactory into QdrantValueFactory.
 - Move the org.springframework.ai.vectorstore package into org.springframework.ai.vectorstore.qdrant.
 - Add missing Autoconfigure definition.
 - Add missing license and JavaDocs.
 - Minor code style improvmentes.
 - Move the qdrant version to the main pom
 - Add QdrantVectorStoreAutoConfigurationIT
 - Remove guava dependency
 - Improve gdrant.adoc conent and structure.
 - Remove the grpc-protobuf dependency

Resolves #331
2024-02-28 19:31:54 +01:00
Christian Tzolov
e1462b86e3 Fix Vertex AI PaLM2 Boot Starter name typo
Rename spring-ai-vertex-ai-plam2-spring-boot-starter into spring-ai-vertex-ai-palm2-spring-boot-starter
2024-02-28 18:05:32 +01:00
Christian Tzolov
d8c69e8efc Fix open-ai auto-conf bug 2024-02-28 16:53:32 +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
Christian Tzolov
65c7ee62fa Add Mistral AI Boot Starter to BOM 2024-02-28 14:16:23 +01:00
Christian Tzolov
16090a9604 Fix error in MistralAiPropertiesTests 2024-02-28 13:51: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
0d0b858d60 Temp disable Ollama ITs 2024-02-27 23:32:05 +01:00
Christian Tzolov
3eb24f6088 Update continuous-integration.yml
Try to fix the GH action hashFiles expression
2024-02-27 23:08:00 +01:00
Christian Tzolov
270f01608e Update continuous-integration.yml
Update ScribeMD/docker-cache to @0.3.7
2024-02-27 22:33:53 +01:00
Eddú Meléndez
246ba173fe Enable Ollama integration test
Currently, test is disable because in every run the image should
be downloaded and then pull the model. Now, taking advantage of
Testcontainers and a GHA, a new image is created on-the-fly with
the model in it and then cached, so, next executions will reuse the
cached image instead.

Fixes #121
2024-02-27 20:57:43 +01:00
Eddú Meléndez
6de57d5f37 Use Testcontainers Vector Database modules
- Update testcontainers version to 1.19.6
 - Use ChromaDBContainer
 - Use MilvusContainer
 - Use WeaviateContainer
 - Fix format
2024-02-27 17:30:43 +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