Commit Graph

507 Commits

Author SHA1 Message Date
devholic22
9f56a91657 Fix OpenAiChatModel NPE
* Fix OpenAiChatModel NPE using getOrDefault
2024-06-28 11:54:31 +02:00
Thomas Vitale
3227311314 Introduce id and model in ChatResponseMetadata
* 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>
2024-06-24 14:10:19 +02:00
Mariusz Bernacki
20e4b5609a OpenAI: Add support for streamin token usage.
- OpenAiApi: add StreamingOptions class and ChatCompletionRequest#streamingOptions field.
 - add OpenAiChatOption#withStreamingUsage(boolean) to set/unset the StreamingOptions.
 - add a boolean (get/set)StreamUsage() to OpenAiChatOptions that internally set the SstreamOptions.
   Later allows the "spring.ai.openai.chat.options.stream-usage" property.
 - update the OpenAI property documentation.

Co-authored-by: Christian Tzolov <ctzolov@vmware.com>
2024-06-24 08:42:38 +02:00
Mariusz Bernacki
b822107586 Fix Anthropic token usage handling in streaming 2024-06-22 20:15:34 +02:00
GR
997e01ca6b Add support for QianFan AI models
- Add chat, embeddin and image models
- Tests
- Docs
2024-06-22 13:30:38 -04:00
Christian Tzolov
f9f6247f7e AWS/Bedrock housekeeping updates
- upadate bedrockruntime version to 2.26.7 and align it with aws sdk dependecy.
 - minor ITs configuration, consistency and statbility fixes
   Use the EnvironmentVariableCredentialsProvider instead of the Profile credential provider.
 - update the Bedrock getting started documentation.
 - update the Genemi Prerequisites docs.
2024-06-22 12:22:10 +02:00
Mark Pollack
84737ecc01 update some javadoc warnings 2024-06-21 16:29:15 -04:00
GR
f989dfe06e Update ZhiPuAi model support
- Added additional support for ZhiPuAi models including vision model GLM-4V
- Default model changed to GLM_4_Air and update documentation
- Added additional unit and integration tests
- Add documentation for vision model
2024-06-21 15:52:19 -04:00
GR
172c7f1a1a Add more models and tests for MiniMax AI Model 2024-06-21 15:30:57 -04:00
GR
d5b8123e60 Add support for Moonshot AI model
- Docs
- Tests
2024-06-21 15:23:54 -04:00
Christian Tzolov
ae76407f13 Add support for Anthropic Claude 3.5 Sonnet
- add support for the Anthropic API
 - add support for the Bedrok Anthropic API

 Related to #914
2024-06-21 19:14:19 +02:00
Christian Tzolov
dfa3ceb1ab GH-912: Add customizable logger advisor (#913)
* Add customizable logger advisor
* Address review comments
* Use the OutputCaptureExtension to verify the output text

 Resolves #912
2024-06-21 10:26:18 -04:00
Christian Tzolov
400d0d156c Add VertexAI Gemini system-instruction support
Resolves #906
2024-06-20 15:50:17 +02:00
luocq3
75d68662ae Change the Prompt's modelOptions() to return ChatOptions instead of ModelOptions. 2024-06-20 15:03:15 +02:00
Christian Tzolov
16c531c36c Azure ITs adjustment: prove streaming does chunks the response content 2024-06-18 18:39:57 +02:00
Christian Tzolov
b7475ed060 Update Weaviate docker version. remove import wildcard definitions 2024-06-18 09:33:30 +02:00
Piotr Olaszewski
06ff651734 Remove duplicated ApiUtils and polish javadocs 2024-06-17 15:39:32 +02:00
Benoit Moussaud
c9dd336ea3 Add multimodality support for Azure OpenAI API
- update Azure OpenAI documentation.
 - add ITs
2024-06-17 14:06:27 +02:00
Christian Tzolov
958549ecce Rename all Embedding Client doc and variables occurrences into Embedding Model 2024-06-16 21:24:03 +02:00
xsg22
369fbf8f8b Update documentation for OpenAiApi.ChatCompletionRequest's constructor 2024-06-15 18:09:19 +02:00
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