Pre-Retrieval:
* Consolidated naming and documentation
Retrieval:
* Consolidated naming and documentation
* Introduced DocumentJoiner sub-module and CompositionDocumentJoiner operator
Post-Retrieval:
* Introduced main interfaces for sub-modules. Implementation waiting for missing features in Document APIs
Orchestration:
* Introduced QueryRouter sub-module and AllDocumentRetrieversQueryRouter operator
Generation:
* Consolidated naming and documentation
Advisor:
* Introduced BaseAdvisor to reduce boilerplate when implementing Advisors
* Extended RetrievalAugmentationAdvisor to include the new sub-modules
Relates to #gh-1603
This change enables more flexible integration between Spring AI and LLM function
calling capabilities while maintaining type safety and ease of use.
- Add new MethodFunctionCallback class to support method invocation via reflection
- Supports both static and non-static method calls
- Handles multiple parameter types including primitives, objects, collections
- Supports empty parameters and empty response
- Auto-generates JSON schema from method parameters
- Special handling for ToolContext parameters
- Builder pattern for easy configuration
- Add comprehensive unit tests for MethodFunctionCallback
- Add integration tests for MethodFunctionCallback with both Anthropic and OpenAI clients
- Add jackson-module-jsonSchema dependency
- Modify FunctionCallback to check for empty tool context
Testing coverage includes:
- Static method invocation scenarios
- Non-static method calls with various parameter types
- Void return type methods
- Complex parameter types (enums, records, lists)
- Tool context handling
- Error cases and validation
Add MethodFunctionCallback reference docs
- Add support for proper Kotlin functions handling by adapting
`kotlin.jvm.functions.Function1` to `java.util.function.Function` and
`kotlin.jvm.functions.Function2` to `java.util.function.BiFunction`.
- Removes the dependency on Spring Cloud Function and
`net.jodah:typetools` which are replaced by leveraging
Spring Framework `ResolvableType` capabilities.
- Add a Kotlin extension function for
`FunctionCallbackWrapper.Builder.withInputType` allowing to
specify `withInputType<T>()` instead of `withInputType(T::class.java)`.
- Add Kotlin documentation.
Add support for proper Kotlin functions handling
by adapting kotlin.jvm.functions.Function1 to
java.util.function.Function and kotlin.jvm.functions.Function2 to
java.util.function.BiFunction.
It also removes the dependency on Spring Cloud Function and
net.jodah:typetools which are replaced by leveraging
Spring Framework ResolvableType capabilities.
Added withInputType Kotlin extension
- Add a Kotlin extension function for
FunctionCallbackWrapper.Builder.withInputType allowing
to specify withInputType<T>() instead of
withInputType(T::class.java).
- Add Kotlin documentation
- Disable project-wide Checkstyle checks to unblock development
- Add documentation for enabling Checkstyle locally
- Fix remaining checkstyle violations in current codebase
Fixes#1669
- 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
This commit configures Maven to support compiling Kotlin
main and test classes, and adds a JacksonUtilsKotlinTests
class that ensures that serialization and deserialization
of Kotlin data classes works as expected.
The Maven configuration follows recommendations from
https://kotlinlang.org/docs/maven.html.
- 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#1066Resolves#524
* 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>
- Created low-leverl anthropic messages API for Claude 3.
Use the new message API.
- Add Chat Client with tests.
- Add bedrok anthropic 3 docs.
- Add multibudality support + tests.
- Add auto-configuraiton & tests.
- Rename Athropic to Athropic3 in class names to avoid confusion with previous Bedrock Anthropic 2 impl.
- Extends the reactor logic to to allow aggregation of the chunked tool-calls messages and
leverage the exsiting fnctoin calling infrastructure.
- Seamples experience for the streaming functionality.
- Add Message ID and FinishReason to the returned Generations properties.
- Extend the Spring AI Message with getMediaData() : List<MediaData>
MediaData is a pair of MimeType and data of type Object.
Message#getContent() return text only.
- VertexAI Gemini Support
- implement VertexAiGeiminChatClient for ChatClient and StreamingChat client and support for MediaData content.
add IT tests for Chat, Streaming and Multimodality
- add Auto-configuration + ITs
- add Gemini Spring Boot starter.
- add clients and boot starters to the Spring AI BOM.
- add Anotra documentation for the Gemini chat client.
- update gemini to latest 26.33.0 BOM.
- add vertex ai gemini dependencies to the BOM.
- add Vertex AI Gemini API Function Calling support
- add Gemini API Function Calling Streaming support
- add vertex ai gemini function calling documentation
- factor out the Function Calling functionality into common abstraction used by OpenAI, Azure and Gemini.
- group the VertexAI documentation under a common parent
- add PortableFunctionCallingOption that implements FunctionCallingOptions and ChatOptions and provide builder for it.
- remove some deprecated code.
- allow authorization with GoogleCredentials form json file.
- add AOT support for VertexAI Gemini.
- move legacy Vertex AI into VertexAI PaLM2.
- better handling for empty chat responses.
- update the Gemini version to latest 26.33.0. This required lifting the protobuf-java to 3.25.2 as well.
- fix a bug for handling System messages with Gemini.
- Implement Azure OpenAI Function Calling
Uses the same the common abstractions used by OpenAI and Gemini: FunctionCallingOptions and AbstractFunctionCallSupport
- 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.
- Add spring-ai-bedrock project with support for Cohere, Llama2, Ai21 Jurassic 2, Titan and Anthropic LLM models.
- Add native API clients for CohereChat CohereEmbedding , Llama2Chat, JurassicChat, TitanChat and TitanEmbedding models, supporting both single shot and streaming completions (for the models that allows it)
- Add ITs tests for the native API clients.
- Implement Chat (AiClient) and ChatStreaming (AiStreamingClient) and EmbeddingClients (according to the models’ support for those) for Cohere, Llama2, and Anthropica. Titan and Jurassic2 are WIP.
- Add ITs for the ChatClient, ChatStreamingClient and EmbeddingClient implementations.
- Add Spring Boot Auto-configurations with flexible properties for the Llama2, Anthropic and Cohere modes + ITs
- Add Spring Boot Starter configurations for all Bedrock models.
- Add README documentations for all models.
- Add BedrockAi APIs AOT hints
- Add Ai21Jurassic2ChatBedrockApi, TitanEmbeddingBedrockApi, TitanChatBedrockApi
- Add TitanChatBedrockApi
Resolves#66
- Introducing a new OpenAiApi native client for OpenAI API and get rid of the theokanning library.
Amongst others the OpenAiApi allows:
- easy base-url configuration (e.g. TAS-AI)
- Flux response for streaming OpenAI results.
- Exposes the http headers containing important metadata
- Pure Spring ecosystem, making it easier for Graal VM
- Define a new AiStreamClient interface returning Flux<AiResponse>
- Refactor OpenAiClient and to use the new OpenAiApi and implement the AiStreamClient.
- Use spring-retry to improve the OpenAI EmbeddingClient stability on 503 error.
- Remove the OpenAI http header interceptor as the OpenAiApi returns ResponseEntity<T> that provides direct access to the headers.
- Refactor the metadata headers and usage extraction.
- Remove redundant and obsolete classes.
- Fix dependency issue with Pinecone, netty-codec-http2 and Spring Boot 3.2
- Rename Generation#text to content and info to properties.
- Make Generation extend the AbstractMessage and default to ASSISTANT message type.
- Add vevertex-ai project with native api client for generation and embedding.
- Add unit and IT tests for the vertex-ai native client.
- Add AiClient and EmbeddingClient implementation for the the Vertex AI along with ITs.
- Collapses all VectorStore similiaritySearch methdos into one with SearchRequest builder.
- Fix all affected code and tests.
- Bump the project version to 0.7.1.
- Add tests
- Add autoconfigurations for milvus, pinecone and pgvecor stores.
- Improve and unify the VectorStore ITs.
- Make use of TrasformersEmbeddingClient for auto-configurations ITs.
- Extend the VectorStore with similaritySearch using metadata filters using internal DSL and external DSL using Antlr
- Metdata support for Pinecone, Milvus, and pgvector vector stores
- PGVectorStore uses explict ::jsonpath casting for the pgvector filter expression to avoid injections
- Add unit tests for the filter converters, parser and DSL.
- Add ITs for the 3 vector stores
Resolves: #75
- Add a set of PDF readers fro per-page (PagePdfDocumentReader) and per-paragraph (ParagraphPdfDocumentReader) readers.
- Use a PDFLayoutTextStripper fork and PDFLayoutTextStripperByArea extension to preserve the structure of the extracted document.
- PdfDocumentReaderConfig and PageExtractedTextFormatter in standalone classes.
- Craeate a new document-readers top level model and the pdf-reader under.
- Add ContentFormatter and DefaultContentFormatter that can filter the metadata
and format the Document metadata and text according to predefined templates.
- Add content formatter tests
- Allow the TextSplitter to copy the document content-formatter to the children.
When the splitter breaks the parent Document into multiple chunks (e.g.
into a list of children Documents) copy the source content formatter to
the chunks by default. Use the copyContentFormatter flag to enable/disable copping.
- Add TextSplitter IT tests
- Add MetadataExtractors as DocumentTransformers.
- Bump spring-ai project version to 0.7.0-SNAPSHOT
- Configurable metadata-mode for EmbeddingClients
- Make the metadata mode configurable for the EmbeddingClient implementations.
- Use the EMBED mode by default.
Resolves#44