Commit Graph

237 Commits

Author SHA1 Message Date
Fu Cheng
52be1bcb4c Fix potential NPE using nullSafeList 2024-06-15 18:02:47 +02:00
Thomas Vitale
1eb61efc50 [Mistral] Update models
* Align model naming with Mistral AI documentation
* Add missing model for mixtral 22B
* Deprecate mistral-medium-latest because Mistral will remove it soon

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-06-15 17:48:14 +02:00
Christian Tzolov
51b1d719d5 Add additional tests for PR #863 2024-06-15 14:25:09 +02:00
Mariusz Bernacki
a6bed95358 Add support for partially compliant OpenAI APIs
Some LLM providers, such as Groq and OpenRouter, are marketed as OpenAI API compatible.
 However, they often lack full support for the API specification.

 This PR allows to use the simpler message format if no media artifacts are assigned.
2024-06-15 14:08:01 +02:00
Christian Tzolov
be9e4a828a Improve Hugging Face ITs 2024-06-13 22:13:40 +02:00
Thomas Vitale
2a592d4e84 Introduce Hugging Face Starter
* Added Spring Boot Starter for Spring AI Hugging Face
* Updated documentation with instructions using the starter dependency
* Fixed naming inconsistencies in the docs for Hugging Face

Fixes gh-838

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-06-13 22:07:58 +02:00
Amine Kadi
44154c5c93 Minor javadoc improvements 2024-06-13 16:15:18 +02:00
Christian Tzolov
85d2fa525e Fix the Gemini parallel function calling behaviour.
Enable handling multiple function calls at once.
  Change the Gemini model names from preview to gemini-1.5-pro-001 and gemini-1.5-flash-001.
  Simplify the Gemini function calling ITs. drop the multi-turn instructions.
2024-06-13 15:37:53 +02:00
Christian Tzolov
dbccfda7c5 Update Google VertexAI Gemini to 26.41.0
- update the Gemini function calling ITs to include a system message with dedicated calling instructions.
 - fix a type with few Gemini ChatModel enum names.
 - re-enable all Gemini ITs.
2024-06-13 12:43:23 +02:00
Christian Tzolov
a4412b5d3a Various fixes and stability improvements
- Fix a bug in Azure streaming response. Ensure that the merge functionality resolves the right
   object constructors
 - drop the @ConditionalOnMissingBean for the ChatClientAutoConfiguration#chatClientBuilder .
   If multiple chat model starters are added to the POM this will fail as the ChatClient.Builder
    auto-config can handle only one chat model. Then the spring.ai.chat.client.enabled=false must be set.
 - Add missing AutoConfiguration imports for SpringAiRetryAutoConfiguration.class, RestClientAutoConfiguration.class,
   and WebClientAutoConfiguration.class to the AnthropicAutoConfiguration, MistralAiAutoConfiguration,
   OllamaAutoConfiguration,VertexAiPalm2AutoConfiguration.
 - change the OpenAi and Azure OpenAi default chat models to  gpt-4o
 - clean and improve the stability of various ITs
2024-06-07 14:26:17 +02:00
Christian Tzolov
64378dfcdd Fix the ChatClient call().content() output 2024-06-05 15:25:41 +02:00
Christian Tzolov
7cf3525f1a Few doc aligments with the new ChatClient API 2024-06-04 06:28:56 +02:00
Mark Pollack
ac91302eed Next development version 2024-05-28 13:53:04 -04:00
Mark Pollack
0670575f3e Release version 1.0.0-M1 2024-05-28 13:49:11 -04:00
Benoit Moussaud
a30cc9d84d Add the support of Azure OpenAI image generation
* Add docs
2024-05-27 16:26:24 -04:00
Mark Pollack
574138a26a Remove chat.service package and related classes
* This functionality is now provided using the advisors feature in ChatClient
2024-05-27 15:36:30 -04:00
Christian Tzolov
a64dd06c48 Add payment transaction status Function Calling ITs - OpenAI and Vertex AI Gemeini 2024-05-27 18:11:44 +02:00
Christian Tzolov
5226d0b9b3 Enable ZhiPu AI ITs only on ZHIPU_AI_API_KEY env present 2024-05-27 08:40:45 +02:00
Christian Tzolov
42095f011a Remove dots from the prompt template placeholder names
The ST library doesn't permit dots in the placeholder names.
2024-05-27 07:44:56 +02:00
GR
23e448cf2a fix: ZhiPu embedding client individual calls to embed document collection
fixes #771
2024-05-26 23:24:36 -04:00
Christian Tzolov
178a607cf6 Fix an issue related to the Azure OpenAI streamig response
This issue in the Flux streaming logic was causing chunks
  to be aggreagated in a single response.

  Re-enable the AzureOpenAiAutoConfigurationIT
2024-05-27 01:02:35 +02:00
Mark Pollack
dc656ce3bc Update available OpenAI GPT 4 family of models in enum
* Use GPT 4 Turbo in OpenAiPromptTransformingChatServiceIT
* Accept multiple bike names as acceptable answers in assertion
* Update docs
2024-05-26 18:31:39 -04:00
Mark Pollack
a60035eeb6 Update to Spring Boot 3.3
* Tests have been updated to use the "gpt-4-turbo" model instead of the "gpt-4-turbo-preview".
* String comparisons of temperature have been adjusted to match the format changes from model reponses
2024-05-26 16:24:57 -04:00
Christian Tzolov
a49974d90f Various, minor Amazon Bedrock ITs improvements 2024-05-26 19:40:00 +02:00
Christian Tzolov
a4e3a7b8de Streamline the OllamaEmbeddingModelIT 2024-05-26 18:32:25 +02:00
Christian Tzolov
79e2dab29a Disable ITs related to the ChatService's ChatMemory implementations
Disable ITs due to deprecation of all ChatService PromptTransformer ChatMemory implementations.
2024-05-26 17:27:59 +02:00
Josh Long
2d43e40024 Add property to initialize schema for vector stores
* Default is fale
* Update docs
2024-05-26 00:31:19 -04:00
JoeHitHard
dea7ab67c3 #690 choices can be null look at OpenAiApi.java:606
Signed-off-by: JoeHitHard <josephmeghanath@gmail.com>
2024-05-24 11:51:18 -04:00
devholic22
0e0d453e2b Add javadoc and clean up method names in OpenAiImageModel
* remove getDefaultOptions method as it is not used.
2024-05-24 11:27:46 -04:00
devholic22
df12e17385 Modify RetryTemplate access level in OpenAiChatModel
* Modify RetryTemplate access level (public - private) in OpenAiChatModel
2024-05-24 11:27:09 -04:00
devholic22
d6c1b033ad Add comments in OpenAiImageModel
* Add comments in OpenAiImageModel like OpenAiChatModel
2024-05-24 11:27:09 -04:00
Alexander Hewer
c26d5f624c Added support for response format in chat options for Azure OpenAI
- Added new enum class AzureOpenAiResponseFormat
- Modified merge methods in AzureOpenAiChatModel to use new parameter
- Modfied AzureOpenAiChatOptions to include the responseFormat parameter
- Modified Azure ChatCompletionsOptionsTests to verify that new parameter is working as expected
- Added docs
2024-05-24 11:20:40 -04:00
Mark Pollack
ac518df4db Rename method 'created' to 'getCreated' in OpenAiImageResponseMetadata
In the ImageResponseMetadata interfaces and its implementations, the method 'created' has been renamed to 'getCreated' to support JSON ser/deser

Fixes #625
2024-05-24 10:50:14 -04:00
deepak
377b5ffa61 Use WebClient.Builder and RestClient.Builder as ctor args in OpenAiAutoConfiguration
Fixes #609
2024-05-24 10:23:55 -04:00
Christian Tzolov
8257c0dc43 Improve ChatClient impl. parameter cohesion 2024-05-24 15:00:03 +02:00
Christian Tzolov
cd3b374dab Extend ChatClient API
- add support for custom StructuredOutputConverters usng entity(outputConverterInstance)
  - add mutate() method that returns ChatClient.Builder to create a new ChatClient whose
    settings are replicated from the ChatClient's default settings.
  - add prompt().mutate() method that returns ChatClient.Builder to create a new ChatClient
    whose settings are replicated from the current default and prompt settings.
2024-05-24 14:33:26 +02:00
Christian Tzolov
c49a5c84ff Improve model's POM name consistency 2024-05-24 09:16:39 +02:00
Christian Tzolov
d6f4b71e1f Improve ChatClient API docs 2024-05-24 07:29:42 +02:00
Mark Pollack
4a2ad60059 Package refactoring
* 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
2024-05-23 17:52:27 -04:00
Josh Long
fbfc87e814 Refactoring of ChatClient to add fluent API and introduce Model as dependent object
* 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>
2024-05-22 16:07:12 -04:00
GR
8389913999 Implemented the doChatCompletionStream in ZhiPuAiChatClient 2024-05-21 17:11:35 -04:00
Christian Tzolov
ef5a3fa9fa MiniMax model improvements
* Fix javadoc issue. Remove wildcard imports
* In MiniMaxChatClient, remove unused method, unused fromMedia method, dedicated exception and rename inappropriate method.
2024-05-21 09:06:31 -04:00
Christian Tzolov
2abf10dbf9 Fix javadoc issue. Remove wildcard imports 2024-05-21 09:49:57 +02:00
Craig Walls
83c997d18e Add spring-ai-retry dependency to Ollama model pom.xml 2024-05-21 09:05:27 +02:00
GR
99c3857788 Add Support for ZhiPu AI model
* See https://www.zhipuai.cn/
2024-05-20 20:20:29 -04:00
GR
6b674014ed Add support for the MiniMax Model
* See https://minimaxi.com/
2024-05-20 15:08:20 -04:00
Pablo Sanchidrian
e8f663d0c8 Fix: watsonx.ai | refresh token issue and implement retry mechanism (#735)
* fix: refresh token only when needed and apply retry policy

* fix: remove unused import
2024-05-19 11:48:09 +02:00
Christian Tzolov
09e122de5e Add Mistral AI tool_call_id to ChatCompletionMessage.
The tool call ID that this message is responding to, applicable for the TOOL role.
2024-05-18 06:07:12 +02:00
Christian Tzolov
517df45cd8 Merge ParametrizedTypeReferenceBeanOutputConverter into BeanOutputConverter
Add ParametrizedTypeReference constructoers along the Clas<T> such.
  Convert the Class into ParametrizedTypeReference internally.
  Update tests and docs.
2024-05-18 04:50:20 +02:00
Christian Tzolov
3475f17e98 Unify the vector store module and pom names
spring-ai-qdrant -> spring-ai-qdrant-store
 spring-ai-cassandra -> spring-ai-cassandra-store
 spring-ai-pinecone -> spring-ai-pinecone-store
 spring-ai-redis -> spring-ai-redis-store
 spring-ai-qdrant -> spring-ai-qdrant-store
 spring-ai-gemfire -> spring-ai-gemfire-store
 spring-ai-azure-vector-store-spring-boot-starter -> spring-ai-azure-store-spring-boot-starter
 spring-ai-redis-spring-boot-starter -> spring-ai-redis-store-spring-boot-starter
2024-05-17 17:05:09 +02:00