Commit Graph

28 Commits

Author SHA1 Message Date
Mark Pollack
67a8896422 Next development version 2024-11-20 18:03:30 -05:00
Mark Pollack
33c05c399c Release version 1.0.0-M4 2024-11-20 18:02:47 -05:00
Soby Chacko
66f58d2d70 Change default build setting to disable Checkstyle enforcement
- Disable project-wide Checkstyle checks to unblock development
- Add documentation for enabling Checkstyle locally
- Fix remaining checkstyle violations in current codebase

Fixes #1669
2024-11-05 10:43:38 -05:00
Christian Tzolov
fd8cac57bb Revert "Revert "Convert API records to POJOs and fix failing autconfig tests""
This reverts commit 3e9a3fd3b0.
2024-11-05 11:52:41 +01:00
Christian Tzolov
3e9a3fd3b0 Revert "Convert API records to POJOs and fix failing autconfig tests"
This reverts commit 4184af5341.
2024-11-05 10:00:57 +01:00
Soby Chacko
4184af5341 Convert API records to POJOs and fix failing autconfig tests
Following removal of Spring Boot's ConstructorBinding, convert record types
to regular POJOs to maintain JSON serialization. Update API classes:

- Convert FunctionTool and Function records to standard Java classes with
 getters/setters
- Update test assertions to use getter methods instead of record accessors
- Fix failing tests in MiniMax, OpenAi and ZhiPu API implementations

This keeps core API models independent of Spring Boot while ensuring proper
serialization through standard Java beans.

- MistralAIApi FunctionTool ConstructorBinding removal changes
2024-11-02 15:04:06 -04:00
Soby Chacko
cdc1cecb57 Enabling checkstyle on spring-ai-openai 2024-10-31 00:03:25 -04:00
Soby Chacko
94ddefc73f Remove Spring Boot dependencies from core modules
- Remove @NestedConfigurationProperty and @ConstructorBinding annotations from model options classes
- Remove spring-boot dependency from spring-ai-openai module
- Add exclusion for spring-boot-autoconfigure in spring-cloud-function-context dependency
- Move configuration metadata to spring-ai-spring-boot-autoconfigure module

This change decouples the core AI model implementations from Spring Boot,
making the core modules more lightweight and allowing them to be used in
non-Spring Boot applications. Configuration properties are now handled by
the spring-ai-spring-boot-autoconfigure module instead.

Fixes #1540
2024-10-30 11:58:18 -04:00
Soby Chacko
8e758dbd00 Introduce checkstyle plugin
- Based on https://github.com/spring-io/spring-javaformat
- In this iteration, checkstyles are only enabled for spring-ai-core
2024-10-24 16:43:59 -04:00
Christian Tzolov
2e0a51fac5 Streamline dependencies and improve API consistency
- Remove unnecessary spring-web dependencies
 - Update third-party library versions
 - Refactor API classes to use consistent header handling
 - Remove ApiUtils class and inline its functionality
 - Adjust RestClient and WebClient builder usage in autoconfiguration
 - Replace direct RestClient.Builder injections with ObjectProvider<RestClient.Builder>
   and WebClient.Builder injections with ObjectProvider<WebClient.Builder>
 - Update ChromaVectorStoreAutoConfiguration to use ObjectProvider
 - Rename MongoDbAtlasLocalContainerConnectionDetailsFactoryTest to IT
 - Switch spring-ai-chroma-store dependency from spring-web to spring-webflux
 - Simplify ChromaApi constructor by using method reference for default headers
 - Adjust import order

 Resolves #1066
 Resolves #524
2024-10-16 15:46:03 -04:00
Mark Pollack
4c83fe8302 Guard against NPE in ZhiPu embedding model
- Update retry test to pass - needs investigation
2024-10-08 23:37:00 +02:00
Mark Pollack
4a892b5269 Release version 1.0.0-M3 2024-10-08 23:18:50 +02:00
Mark Pollack
e1884d1d92 Next development version 2024-08-23 18:47:37 -04:00
Mark Pollack
43ad2bdb97 Release version 1.0.0-M2 2024-08-23 18:46:58 -04:00
Thomas Vitale
6bdb395686 Initial observability for Spring AI
* Observation APIs for chat, embedding and image models
* Conventions based on OpenTelemetry Semantic Conventions for GenAI
* Instrumentation for OpenAI chat, embedding, and image models
* Autoconfiguration for observability for OpenAI

Fixes gh-953

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-08-01 22:25:43 +02:00
Christian Tzolov
d53876a624 Add Ollama Function Call support
- extend the OllamaApi with Tool, ToolCalls and Function and add Tool Role.
- make OllamaChatModel extend the AbstractToolCallSupport.
- extend the OllamaChatModel to convert the Spring AI messages to OllamaApi messages, including Tools.
- OllamaOptions implements FunctionCallingOptions.
- add OllamaApiToolFunctionCallIT for testing function calling.
- patch the AbstractToolCallSupport#isToolCall to take set of stop resons.
- add FunctionCallbackInPromptIT and FunctionCallbackWrapperIT function calling auto-configuration tests.
- extend OllamAutoConfiguration to support function calling registration.
- add function call tests to OllamChatAutoConfigurationIT.
- add OllamaWithOpenAiChatModelIT to OpenAi that uses the OpenAI API to call Ollama.
- move buildToolCallConversation and handleToolCalls to parent AbstractToolCallSupport.
- update Docs. add Ollama function call docs.
- update Ollama diagrams.

Resolves #720
2024-07-24 16:28:06 -04: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
Christian Tzolov
c49a5c84ff Improve model's POM name consistency 2024-05-24 09:16:39 +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
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
Mark Pollack
4c617e16b4 Prepare next development iteration 2024-03-12 14:33:45 -04:00
Mark Pollack
490f3cd1cb Milestone Release 0.8.1 2024-03-12 14:28:28 -04:00
Christian Tzolov
1e3eaec7b9 Refactor and centralize Retry logic:
- Establish a new "spring-ai-retry" project, implementing a default HTTP error handler,
   RetryTemplate, and handling both Transient and Non-Transient Exceptions.
 - Streamline existing clients (e.g., OpenAI and MistralAI) to utilize "spring-ai-retry."
 - Integrate retry auto-configuration with customizable properties, extending it to OpenAI and MistralAI Auto-Configs.
 - Allow configuration of RetryTemplate and ResponseErrorHandler for various clients, including OpenAIChatClient,
   OpenAiEmbeddingClient, OpenAiAudioTranscriptionCline, OpenAiImageClient, MistralAiChatClient, and MistralAiEmbeddingClient.
 - Add tests for default RestTemplate and ResponseErrorHandler configurations in OpenAI and MistralAI.
 - Introduce new retry auto-config properties: "onClientErrors" and "onHttpCodes".
 - Implement tests for retry auto-config properties.
 - Generate missing license headers.
2024-03-07 11:27:01 -05:00
Mark Pollack
8532cb7bcc Bump to 0.8.1-SNAPSHOT 2024-02-23 11:11:14 -05: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
aebfd719a7 Remove the obsolate okhttp and the related interceptor
The OpenAiApi, returns the HTTP headers that can be intropsect for metadata
 with the help of OpenAiResponseHeaderExtractor.
 No need for http interception nor for joining by ID.
2023-12-22 08:49:20 +01:00
Mark Pollack
82fe510b39 Moved Maven modules from top level directory and embedding-clients subdirectory to all be under a single models directory.
Rename artifact ID of

* `transformers-embedding` to `spring-ai-transformers`
2023-12-19 12:22:02 -05:00