Commit Graph

69 Commits

Author SHA1 Message Date
Mark Pollack
596f2b06c0 Move native hints into individual modules
* Use aot.factories approach for registration
* Add tests
* final tweaks- Thanks Josh!
2024-02-20 14:23:40 -05:00
Mark Pollack
ea7dce3833 Refine Bedrock README. Fixes #180 2024-02-19 12:36:03 -05:00
Mark Pollack
a107e313fc Fixes #219 - Remove dependency cycles 2024-02-19 12:24:16 -05:00
Christian Tzolov
fdd3fbb2f9 Revert default OpenAI embedding to text-embedding-ada-002 as some vector stores have problems with 3-small 2024-02-16 11:19:34 +01:00
Christian Tzolov
697e945950 Fix EmbeddingIT after default openai embedding model switch 2024-02-16 10:40:13 +01:00
Christian Tzolov
7ef49b8cef Set the default OpenAI Embedding model to text-embedding-3-small
The text-embedding-3-small has the same dimensions as previous text-embedding-ada-002.
  The text-embedding-3-large has higher dimensionality not supported by some Vector Stores.
2024-02-16 10:27:13 +01:00
Christian Tzolov
bd479e1388 Address review comments 2024-02-15 22:38:50 +01:00
Christian Tzolov
d580fe2757 Simplify Function Calling API 2024-02-15 20:26:31 +01:00
Christian Tzolov
1fa2036120 Refactor the Function Calling Support
- Remove the SpringAiFunction annotation in favour of palin Functino Beans, @Description annotation and JacksonClassAnnotation.
 - Update the function calling documentation to reflect latest changes.
 - Add a new openai option (and related property): spring.ai.openai.chat.options.beanFunctions.<function-name>.<description>
   Map of bean names and their descriptions to register as function callbacks.
 - Refactor the OpenAiAutoConfiguration to resolve and register the beans in beanFunctions.
 - Add dependency on Spring Cloud Function to use the FunctionContextUtils and FunctionTypeUtils
   Those utilites help to resolve the function input type signature.
 - Add DefaultToolFunctionCallback class for manually wrapping Functions.
 - Update the ITs.
2024-02-15 12:39:35 +01:00
Mark Pollack
43dbaf4edd Add documentation for Image Generation
- Refine StabilityAI classes
- Add documentation
2024-02-14 17:18:04 -05:00
Christian Tzolov
22bd645d1e fix azure model README broken link 2024-02-14 06:55:42 +01:00
Christian Tzolov
9d41e4380a Make model READMEs ponint to their corresponding Antora documentations 2024-02-14 06:50:23 +01:00
Christian Tzolov
ffd8222c20 OpenAI ChatClient tools support
* Add function call OpenAiApi IT tests
* Add function call docs. Unit and IT func tests
* Add function call diagram
* Allow to opt-in/enable the fuctions to be used in request.
2024-02-11 23:34:04 -05:00
Christian Tzolov
21d7cdd5c0 Add VertexAi Embeddings Docs + clear READMEs 2024-02-11 18:32:55 +01:00
Christian Tzolov
7ea867d3cb Add VertexAi Chat Optios Support + Docs 2024-02-11 18:00:15 +01:00
Christian Tzolov
d38afc50a3 Document Bedrock Titan Embedding API and clients
- Remove outdated Bedrock README fiels and add references to the main docs.
2024-02-11 16:16:22 +01:00
Christian Tzolov
ed52a3e0a1 Add Bedrock Titan Chat Options + Docs 2024-02-11 15:32:33 +01:00
Christian Tzolov
35ce0d1a4b Add Bedrock Cohere Embedding Options support
- Realign the Embeddings API docs strcture
2024-02-11 12:25:26 +01:00
Christian Tzolov
056b95a00e Improve Chat Completon API documentation
- minor code style improvements.
2024-02-10 18:17:06 +01:00
Christian Tzolov
7fca784b05 Add Bedrock Anthropic Chat Options support
- Improve Anthropic tests
 - Add anthrpic docs
 - Restructure the docs for Azure OpenAI, OpenAI, Ollama, Bedrock Cohere and Bedrock Lllam2
2024-02-10 12:22:34 +01:00
Christian Tzolov
c5f80f4930 Minor documentation updates 2024-02-09 19:06:38 +01:00
Christian Tzolov
ced9e6a82d Fix and optimize azure openai chat/embedding clients
- Also restructore and clarify the chat/embedding docs.
2024-02-09 16:45:42 +01:00
Christian Tzolov
ca0f6d79e3 OpenAi Chat/Embedding options handling optimizations
- Also restructure and clean the openai chat/embedding docs.

Address review comments
2024-02-09 15:53:27 +01:00
Christian Tzolov
ed6a464ba8 Add options support to PostgresMlEmbeddingClient
- Add postgremaddmbedding adoc page.
- Auto-configuration:
  - add missing  boot-starter.
  - refactor autoconf class and properties to accomodate the PostgresMlEmbeddingOptions.
- PostgesMlEmbeddingClient
  - Add the (default) options field and remove old fields.
  - Implement default and request options merging.
  - Add tests for options and merging.
- Remove redundant code.
- Code style fixes.
2024-02-09 14:40:53 +01:00
Christian Tzolov
577a605cdc Add Bedrock Llama2 Options Support 2024-02-08 19:41:21 +01:00
Christian Tzolov
779b5a8d5e Bedrock Anthropic Options Support 2024-02-08 18:07:54 +01:00
Christian Tzolov
dfbea8cee1 Add Azure OpenAI Chat and Embedding Options
- Add AzureOpenAiChatOptions
   - Add default options field to AzureOpenAiChatClient.
   - Impl runtime (e.g. prompt) and default options on call.
   - Add options field to the AzureOpenAiChatProperties.
 - Add AzureOpenAiEmbeddingOptions
   - Add default options field to AzureOpenAiEmbeddingClient.
   - Impmlement runtime and default option merging on embedding request.
   - Add options field to AzureOpenAiEmbeddingProperties.
 - Add Unit and ITs.
 - Split the azure-openai.adoc into ./clients/azure-openai-chat.adoc and ./embeddings/azure-openai-embeddings.adoc.
   - Provide detailed explanation how to use the chat and embedding clients manually or via the auto-configuration.
   - Add protable ChatOptions support
2024-02-05 16:15:53 -05:00
Christian Tzolov
4c4e234279 Fix ollama embedding options merging bug 2024-02-03 15:34:41 +01:00
Christian Tzolov
0a930d2ab5 fix broken docs and compilation issues 2024-02-03 15:25:18 +01:00
Christian Tzolov
97537e0a10 Improve Ollama Options support
- Rename OllamaChatClient#withOptions(...) method to OllamaChatClient#withDefaultOptions(...)
 - Rename OllamaEmbeddingClient#withOptions(...) method to OllamaEmbeddingClient#withDefaultOptions(...)
 - Remove the  Chat/Embedding Client model field by defaultOptions.mode one.
 - Correct default and runtime OllamaOptions merging implemented.
 - Added support for portable ChatOptions.
 - OllamaOptions a synthetic field ‘model’ not supported by Ollama API but used by the OllamaChatClient
   and OllamaEbeddingClients. The model field is removed before calling the OllamaApi.
 - Update the IT ollama docker image to 0.1.23
 - Set Mistral as the default model.
 - Extend and improve the ITs
 - Add tests for testing the chat and embedding request creation and options merging logic.
 - Minor code-style improvements.
 - Split the ollama.adoc into embeddings/ollama-embeddings.addoc and clients/ollama-chat.adoc.
 - Improve the documentation to explain how to configure and use the Ollama Chat and Embedding clients manually or with the help of the auto-configuraitons.
 - Clarify the docs property sections.
2024-02-03 14:58:03 +01:00
Christian Tzolov
60a60b4610 Fix handling for openai chat portable options
- Now you can use an arbitrary ChatOption instance as Prompt options for the OpenAIChatClinet.
 - Add Unit tests for OpenAiApi and ModelOptionsUtils.
 - Document portable options support.
2024-02-02 15:34:56 +01:00
Christian Tzolov
d71f90fd56 add OpenAiApi tests 2024-02-01 19:13:57 +01:00
Christian Tzolov
b49458b3ee Improve OpenAiImage/Client implementation
- Impove the code style.
 - Merge the OpenAiImageOptions interface impl and builder into one class.
 - Improve the OpenAiImageClient call implementation.

 Resolves #274
2024-02-01 14:54:34 +01:00
Christian Tzolov
9b79359544 Add openai model retry error listener logging 2024-02-01 11:34:33 +01:00
Christian Tzolov
5b4784fc56 Add OpenAi Chat Options
Add OpenAiChatOptions

 - OpenAiChatOptions implements ChatOptions and exposes all OpenAi request options, except messages and stream.
 - Add OpenAiChatOptions field (as defaultOptions) to OpenAiChatClient. Implement star-up/runtime options merging on chat request creation
 - Add OpenAiChatOptions options field to OpenAiChatProperties. Later is set as OpenAiChatClient#defaultOptions. Use the spring.ai.openai.chat.options.* prefix to set the options.
 - Add tests for properties and options merging.
 - Move the OpenAiChatOptions.java out of the api package

Add OpenAiEmbeddingOptions

 - Add OpenAiEmbeddingOptions class implementing the EmbeddingOptions interface.
 - Add OpenAiEmbeddingClient#defaultOptions
 - Add request merging with default and propmt options.
 - Add OopenAiEmbeddingProperties#options field of type OpenAiEmbeddingOptions

Update OpenAI client docs

Part of the larger 'epic' issue #228
2024-01-29 13:48:12 -05:00
Christian Tzolov
7c7392e657 Change EmbeddingOptions from class into interface 2024-01-28 19:10:17 +01:00
Christian Tzolov
8f9a1475c1 Re-align the grpc dependecies and exclusions so that Milvus and Pinecone autoconfigurations ITs work 2024-01-26 18:32:55 +01:00
Christian Tzolov
08fea315a4 Update the production depedencies 2024-01-26 17:31:29 +01:00
Christian Tzolov
944c4ebbaa Fix Ollama client options NPE and lack for SYS message handling
- Fix the Ollama options merging to pervent NPE.
 - Fix the Ollama handling for SYS messages.
 - Fix the BeanOutputParser to support JSON Schema reponses.
 - All Ollama Parsers tests pass now.

 Resolves: #258 ,  #273
2024-01-26 15:29:09 +01:00
Christian Tzolov
eb42912efd Move OpenAiImageOptionsXXX classes outside the 'api' packages as those are client not api related 2024-01-26 10:48:36 +01:00
Christian Tzolov
5e38536b6c Rename streamingCall into stream 2024-01-25 16:36:29 -05:00
Christian Tzolov
4217a54c31 Make the StreamingChatClient a StreamingModelClient 2024-01-25 16:35:58 -05:00
Christian Tzolov
5d55b68380 Align the Embedding api with the new meta-model
- Craete new EmbeddingOptions -> ModelOptions, EmbeddigRequest -> ModelRequest, EmbeddingResponseMetadata -> ResponseMetadata and EmbeddignResultMetadata -> ResultMetadata.
 - Make the EmbeddigClient interface extend from ModelClient<EmbeddingRequest, EmbeddingResponse>, EmbeddingResponse implements ModelResponise and Embedding implements ModelResult.
 - Fix affected tests.
 - Steramline the EmbeddingClient interface with default method implementations based on call.
 - Merge EmbeddingUtil into AbstractEmbeddingClient
2024-01-25 16:33:37 -05:00
Toshiaki Maki
0cf0ed9e00 Use ObjectMapper with FAIL_ON_UNKNOWN_PROPERTIES false during error handling (#253) 2024-01-25 09:02:39 -05:00
Mark Pollack
593d7f23df Fix TextToImage integration tests
* Create StyleEnum for StabilityAI prompt options.
* Add copyright header and javadoc to StabilityAI classes
2024-01-24 15:55:46 -05:00
Christian Tzolov
c5bca45007 Fix failing IT test 2024-01-24 21:33:55 +01:00
Mark Pollack
243cef976c Abstract API for AI model clients
* An abstract API for AI model clients
 * Providing portable client request options while still allowing vendor specific options when required.  Implemented only for StabilityAI/OpenAI ImageClient
 * Support for text->image for openai and stabilityai.

  Partial fix for #27 :  Text To Image and Fixes #266 and Fixes #261
2024-01-24 19:53:33 +01:00
Christian Tzolov
08fa0e393c Prevent OpenAi retry on http client errors such as rate-limit or wrong authentication 2024-01-14 23:04:17 +01:00
Christian Tzolov
abbd911f69 fix test 2024-01-14 20:46:50 +01:00
Christian Tzolov
7262afb14d Capitalize the enumeration names
Resolves #208
2024-01-14 20:36:14 +01:00