Commit Graph

283 Commits

Author SHA1 Message Date
Christian Tzolov
edf943ec97 Adjust tests 2024-07-18 19:39:43 +02:00
Christian Tzolov
018bb2c600 Ensure that ChatClient copies the input chatoptions
- introduce copy() method to the ChatOptions.
 - make sure that the DefaultChatClientRequestSpec takes a copy of the input chat options to prevent multation.
 - add a OpenAiChatClientMultipleFunctionCallsIT to reproduce the problem and verify the solution.

 Resolves #1064
2024-07-18 18:56:28 +02:00
Christian Tzolov
588082285a OpenAI ChatModel: handle null finish reasons responses 2024-07-18 15:04:21 +02:00
Thomas Vitale
40d8671f3e Improve new function calling strategy
- Streamline the Generation constructors

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-07-18 14:18:45 +02:00
Mark Pollack
97f443d615 Update to ResponseMetadata design
* Remove inheritance from HashMap
* No more subclasses per model provider
* Builder class for ChatResponse
* Fix the AbstractResponseMetadata#AI_METADATA_STRING parameter order
* ChatResponseMetadata ignore Null values.
2024-07-18 12:48:28 +02:00
Sinsy
c9a3e66f90 fix: test name error (#1035)
* fix: test name error

* fix: test name error
2024-07-17 11:07:30 +02:00
Christian Tzolov
feb036d2f6 Add high-level function calling support for Azure OpenAI
- follow the timostark advise to replace skip(1) by filter empty choices

 Resolves #613, #1042
2024-07-16 22:22:24 +02:00
Christian Tzolov
697a04b6d0 Moonshot: No Function Calling support verificaiton
Update the docs and tests to verify that currently Moonshot ChatModel does not
 support Function Calling.

 Related to #1058
2024-07-16 17:55:28 +02:00
Christian Tzolov
18cdeee092 Add high-level function calling support for Mistral AI 2024-07-16 16:18:16 +02:00
Johnny Lim
7c26c7bcdf Polish 2024-07-16 10:05:28 +02:00
Christian Tzolov
87dc3be739 Extend the CreateGeminiRequestTests for tool config tests 2024-07-16 10:00:01 +02:00
Chris Turchin
f07e3911dc Fix system messages handling issue
- re-assign the model on withSystemInstruction return.
 - deprecate the gemini-pro-vision model and replace the default model to gemin-pro-1.5
 - update docs.
 - improve system message handling implementation.

 Resolves #1030

Co-authored-by: Christian Tzolov <ctzolov@vmware.com>
2024-07-15 19:26:12 +02:00
Christian Tzolov
ee19ee1db9 Add high-level function calling support for Anthropic
- simplify and unify the AbstractToolCallSupport::executeFuncitons. Fix filed typos
 - remove old classes
2024-07-15 13:57:38 +02:00
Christian Tzolov
086117effa High-level API function calling support for VertexAI Gemini
- Refactor VertexAiChatModel's function calling handling to use Spring AI abstractions.
2024-07-15 12:24:42 +02:00
Thomas Vitale
fac38c5db8 Update tests for EmbeddingResponseMetadata (#1039)
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-07-12 12:02:14 -04:00
Thomas Vitale
e601f14364 Add model name and token usage to EmbeddingResponseMetadata
- Moves these from free-text key/value pairs to interface
- Enables programmatic use for evaluation and observability

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-07-12 11:18:49 -04:00
Christian Tzolov
41eab270cb Refactor High-level API function calling support
- Add ToolCall to AssistantMessage.
 - Rename FunctionMessage to ToolResponseMessage and add id and name fields.
 - Refactor OpenAiChatModel's function calling handling.
 - Prompt copy now copies the AssistantMessage and ToolResponseMessage contents.

Other ChatModel implementations to adopt these changes in subsequent commits
2024-07-12 00:02:05 -04:00
吴博
28c0d24807 Updates to ZhiPuAi model
* Adjust chat api request options and add unit test

Fix options of zhipu ai chat model
2024-07-10 15:53:40 -04:00
Christian Tzolov
c70c20b79d Add VertexAI Embedding Model support
- add new spring-ai-vertex-ai-embedding project.
 - add VertexAiTextEmbeddingModel and VertexAiMultimodalEmbeddingMode with related options configuration classes.
 - add ITs
 - add auto-configuraiton and boot starters.
 - register to BOM.
 - add documentation.
 - add multimodal embedding documentation
 - extend the Embedding metdata so that it can keep references to the source document's data, Id, mediatype

 Resolves #1013
 Related to #1009
2024-07-10 15:36:13 -04:00
Christian Tzolov
61a56db98b Update Azure OpenAI to 1.0.0-beta.10 2024-07-09 13:08:42 +02:00
Christian Tzolov
dd22342c0c Improve ONNX Tansformer Embedding Model
- Fix model output name handling.
 - Improve documentation.
2024-07-09 11:21:53 +02:00
Christian Tzolov
f61ccdd09d Add Groq inference support via OpenAI client
- add dedicated groq chat page in the documentation.
   Explain how to re-configure the OpenAI client for accessing the Groq chat completion endpoint.
 - Doc: order the Chat and Embedding items in alphabetical order
 - Add Groq ITs.

 Resolves #996
2024-07-05 16:42:46 -04:00
Christian Tzolov
f171b0fa5e Handle OpenAiChatModel NPE for partially compatible OpneAI API such as the NVIDIA API 2024-07-03 16:14:42 +02:00
Christian Tzolov
d8be884cb1 Improve Anthropic Claude streaming handling
- add StreamEven API domain model for reliably parsing stream events.
 - add StreamHelper#mergeToolUseEvents to aggregate partial tool use jsons into a list of ContentBlocks.
 - add StreamHelper#eventToChatCompletionResponse to convert Flux<StreamEvents> into Flux<ChatCompletionResponse>.
 - Rename MediaContent -> ContentBlock, RequestMessage -> AnthropicMessage, ChatCompletion -> ChatCompletionResponse.
 - Improve tests and docs.
2024-07-02 23:36:25 +02:00
devholic22
3411e3e74d Add comments in OpenAiAudioSpeechModel
* Add comments in OpenAiAudioSpeechModel like OpenAiChatModel

* Remove duplicated word in OpenAiAudioSpeechOptions AudioResponseFormat comment
2024-07-02 11:43:52 -04:00
Mariusz Bernacki
f5b72242c0 Add Anthropic Claude streaming Function Calling support
Resolves #930
2024-07-02 10:28:31 +02:00
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