Commit Graph

217 Commits

Author SHA1 Message Date
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
Josh Long
04d854cc49 make project names consistent 2024-05-17 15:31:58 +02:00
Christian Tzolov
654e22be9d Add TypeReference StructuredOutputConverter
A ParameterizedTypeReference alternative of BeanOutputConverter that can cover list of beans as well.
  Based on suggestion: https://twitter.com/kisco_/status/1788862522998546440
2024-05-17 15:28:20 +02:00
Christian Tzolov
7887159e68 Improve Gemini antora documentation and fix broken links 2024-05-17 06:43:47 +02:00
Christian Tzolov
1b1daa7ee7 Add GEMINI_PRO_1_5_PRO and GEMINI_PRO_1_5_FLASH and update geminie maven BOM to 26.39.0
Also fix few Ollama docs and  code formatting issue.
2024-05-16 15:36:14 +02:00
Mark Pollack
549c480489 Refactoring
* Put creation of EvaluationRequest in ChatServiceResponse
* Add string constructor to QuestionContextAugmentor
* change vectorStore accept() usage to write()
2024-05-16 14:01:51 +02:00
Mark Pollack
fd9c98661d API refactoring
* Added more natural method names to DocumentReader, Transformer, Writer
* Changed Content getMedia to return Collection, deprecated use of List
* Change constructor for Media to accept URL and Resource, deprecate Object constructor
* Update ETL documentation and a few tests to avoid now deprecated APIs.
2024-05-16 12:53:13 +02:00
Mark Pollack
867154c082 Changed ChatBot to ChatService with other related name changes
* PromptContext -> ChatServiceContext
* Added PromptChange to ChatServiceContext to capture PromptTransformer changes
* DefaultChatBot -> PromptTransformingChatService
* DefaultStreamingChatBot -> StreamingPromptTransformingChatService
* package name changes, chatbot->service and history->memory
* Added fluent builders to a few PromptTransformer implementations
* Add license headers
2024-05-15 14:01:48 +02:00
Mark Pollack
368f7bdfba Remove filter on external knowledge.
* Update question so that evaulator passes

fix formatting
2024-05-15 10:13:02 +02:00
Lorenzo Caenazzo
a7eb28ac17 Add real Function Calling Streaming support
- Add Java reflection merge utilities that can access  Azure private constructors and fields.
 - Azure merging, creation of flux windows.
 - Function call grouping for function processing.
 - Do not perform greedy operation on Flux.
 - Use "real" streaming on all client on function response.
 - Gerimi: fix missing method impl.
 - Mistral AI, OpenAI: fix missing stream flag in doCreateToolResponseRequest.
 - Fix code formatting. No wildcard imports.
 - Add Grogdunn to the javadoc authors.
 - Anthropic 3 API does not support streaming funciton calling yet.
2024-05-15 09:43:36 +02:00
Christian Tzolov
b0799babf4 Update Qdrant client version from 1.7.1 to 1.9.1
- Also update the qdrant/qdrant docker image version from v1.7.4 to v1.9.2
2024-05-15 06:19:46 +02:00
Christian Tzolov
db4f0b0aaf Add GPT-4o ITs and documentation updates 2024-05-14 21:12:39 +02:00
Thomas Vitale
b3cfa2b900 OpenAI: Add gpt-4o to chat model enum
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-05-14 20:50:56 +02:00
Christian Tzolov
93bd5021a1 Improve Azure OpenAI options merging logic 2024-05-11 13:22:35 +03:00
wmz7year
220ec7f631 AWS Bedrock Titan embedding model add amazon.titan-embed-text-v2:0 support. 2024-05-10 14:26:25 +02:00
wmz7year
25f91c3297 Add AWS Bedrock Amazon Titan Text Premier model support 2024-05-10 10:54:10 +02:00
wmz7year
3497a1ec7b Fix Bedrock Cohere embedding truncate type types
- fix compilation errors and javadoc
2024-05-10 11:49:20 +03:00
Mark Pollack
ad527303ed Rename Agent classes to use ChatBot 2024-05-08 15:43:00 -04:00
Mark Pollack
dfb8bf6a44 Add a new abstraction to simplify implementation of common ChatBot use cases
* Add ChatBot and basic DefaultChatBot
* Add streaming ChatBot support.
* Add Evaluator interface and RelevancyEvaluator implementation
* Add Content data type abstraction for Document and Message
* Renaming and package refactoring
* update .gitignore to allow node package name
* Add List<Media> to node and move ai.transformer package to ai.prompt.transformer
* Add Short/Long term memory support.
* Add mixing transformers support

Docs TBD
2024-05-08 15:14:50 -04:00
Christian Tzolov
a49a2d213f Replace the OutputParser by a StructuredOutputConverter API
- Old OutputParser, BeanOutputParser, ListOutputParser and MapOutputParser classes are depredated
   in favour of the new StructuredOutputConverter, BeanOutputConverter, ListOutputConverter and
   MapOutputConverter implementations.
   Later are drop-in replacements for the former ones, and provide the same functionality.
 - Keep the existing parser package and classes for backward compatibility.
 - Adjust the PromptTemplate for backward compatibility
 - Update all existing tests to use the new Structured Output API.
 - Improve the documentation for structured outputs.
2024-05-08 12:02:24 -04:00
Thomas Vitale
1c93ae50a8 OpenAI: Fix model property being overwritten by default value
Fixes gh-671

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-05-05 17:22:07 +02:00