Commit Graph

535 Commits

Author SHA1 Message Date
Ilayaperumal Gopinathan
b4e0a4598e Update documentation for Milvus vector store
- Add custom field name properties
2024-11-13 12:04:34 +00:00
Christian Tzolov
5f6b892eda Add function calling support to invoke methods with dynamic arguments and return values
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
2024-11-10 22:58:40 -05:00
Christian Tzolov
c24ef4e79a docs: enhance Bedrock Converse API documentation
- Add migration note recommending transition from InvokeModel to Converse API
- Update model configuration to remove default model ID
- Add AWS session token configuration for temporary credentials
- Improve documentation links and descriptions
2024-11-10 15:42:03 +01:00
Sébastien Deleuze
c3c95a82c1 Add Kotlin support and 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`.
- 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.
2024-11-08 18:32:47 +01:00
Soby Chacko
79266be970 GH-1335: Add JSON schema property order support
Fixes: #1335

https://github.com/spring-projects/spring-ai/issues/1335

Add support for maintaining JSON property order in generated schemas using
@JsonPropertyOrder. Users can now control the order of properties in their
JSON schemas by annotating their classes/records with @JsonPropertyOrder.

- Add JacksonOption.RESPECT_JSONPROPERTY_ORDER to BeanOutputConverter
- Add test to verify schema property ordering
- Update documentation with property ordering example
2024-11-08 13:41:48 +00:00
Anders Swanson
fb65ed01bd Add OCI GenAI Cohere Chat integration
Adds Oracle Cloud Infrastructure (OCI) Generative AI's Cohere chat model support
to expand Spring AI's cloud provider capabilities. This allows developers to use
OCI's managed Cohere models through both dedicated and on-demand serving modes.

The integration provides auto-configuration for simple setup while allowing full
customization of model parameters through OCICohereChatOptions. Teams can now
use OCI's Cohere models alongside other providers in Spring AI applications.

This change complements the existing OCI embedding support, offering a complete
set of GenAI capabilities for Oracle Cloud users.

Signed-off-by: Anders Swanson <anders.swanson@oracle.com>
2024-11-06 17:43:48 -05:00
1993heqiang
4ad76506bf Fix etl-pipeline.adoc and prompt.adoc issues. 2024-11-06 13:03:39 -05:00
Mark Pollack
f111aaea04 Revert "Add support for Kotlin functions"
This reverts commit 9cf66333b5.
2024-11-06 12:58:52 -05:00
John Blum
c93c6fd5b9 Fix grammar and minor typos in documentation as well as Javadoc.
Closes #1652
2024-11-06 07:16:43 +00:00
Sébastien Deleuze
9cf66333b5 Add support for Kotlin functions
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
2024-11-05 17:26:04 -05:00
Nikolai Kulagin
d1b8fa30f9 Fix JsonReader example 2024-11-05 07:36:17 +00:00
CodingLuizy
d3afa63b38 Update pinecone.adoc
remove duplicate table row
2024-11-05 07:16:56 +00:00
Ilayaperumal Gopinathan
d44a6aff7c GH-924 Remove PaLM API support
https://github.com/spring-projects/spring-ai/pull/1664

  - As a follow up to decommission the PaLM API, the PaLM API support is removed.
  - Remove the model and vector store classes
  - Remove the documentation entries
  - Reference: https://ai.google.dev/palm_docs/deprecation

Resolves #924
2024-11-04 15:22:50 -05:00
Ilayaperumal Gopinathan
cdb590338c Fix supported vector store list
- Add Azure Cosmos DB and GemFire
2024-11-04 13:02:39 +00:00
Jemin Huh
37598b198d Fix Vector Database providers list
Signed-off-by: Jemin Huh <hjm1980@gmail.com>
2024-11-04 13:01:00 +00:00
Christian Tzolov
0d2d4b7385 Add Bedrock Converse API chat model support
Introduces support for Amazon Bedrock Converse API through a new BedrockProxyChatModel
implementation. This enables integration with Bedrock's conversation models with features
including:
- Support for sync/async chat completions
- Stream response handling
- Tool/function calling capabilities
- System message support
- Image input support
- Observation and metrics integration
- Configurable model parameters and AWS credentials

Adds core support classes:
- BedrockUsage: Implements Usage interface for token tracking
- ConverseApiUtils: Utility class for handling Bedrock API responses including:
  - Tool use event aggregation and processing
  - Chat response transformation from stream outputs
  - Model options conversion
  - Support for metadata aggregation
- URLValidator: Utility for URL validation and normalization with support for:
  - Basic and strict URL validation
  - URL normalization
  - Multimodal input handling
- Enhanced FunctionCallingOptionsBuilder with merge capabilities for both ChatOptions
  and FunctionCallingOptions
- Added BEDROCK_CONVERSE to AiProvider enum for metrics tracking
- Extended AWS credentials support with session token capability
- Added configurable session token property to BedrockAwsConnectionProperties

Adds new auto-configuration support:
- BedrockConverseProxyChatAutoConfiguration for automatic setup of the Bedrock Converse chat model
- BedrockConverseProxyChatProperties for configuration including:
  - Model selection (defaults to Claude 3 Sonnet)
  - Timeout settings (defaults to 5 minutes)
  - Temperature and token control
  - Top-K and Top-P sampling parameters
- Integration with existing BedrockAwsConnectionConfiguration for AWS credentials

Updates to testing infrastructure:
- Adds comprehensive test suite for Bedrock Converse properties and auto-configuration
- Integration tests for chat completion and streaming scenarios
- Property validation tests for configuration options
- Temporarily disabled other Bedrock tests due to AWS quota limitations
- Added ObjectMapper configuration for proper JSON handling

Added new spring-ai-bedrock-converse-spring-boot-starter module

Updates module configuration in parent POM and BOM to include new bedrock-converse
modules and starters. Adds necessary auto-configuration imports for seamless integration
with Spring Boot applications.

Unrelated changes:
- Disabled several Bedrock model tests (Jurassic2, Llama, Titan) due to AWS quota limitations
- Disabled PaLM2 tests due to API decommissioning by Google

Resolves #809, #802

Add docs and fix configs

- Move timeout configuration from chat properties to connection properties
- Add comprehensive documentation for Bedrock Converse API usage and configuration
- Update tests to reflect configuration changes

Co-authored-by: maxjiang153 <maxjiang153@users.noreply.github.com>

Standardize AWS credential handling in integration tests

- Improve how we manage AWS credentials across our integration test
suite and ensures consistent test configuration. We're replacing individual
environment variable checks with @RequiresAwsCredentials
annotation and standardizing the use of BedrockTestUtils for context creation
in tests

We also align all AWS regions to US_EAST_1 for consistency and add missing
dependency versioning for Oracle Free.

These changes make our AWS tests more easier to maintain.

Key changes:
- Replace @EnabledIfEnvironmentVariable with @RequiresAwsCredentials
- Standardize context creation via BedrockTestUtils
- Set AWS region to US_EAST_1
- Add Oracle Free dependency version in pom.xml
2024-11-03 17:10:24 -05:00
jiseunghyeon
cd15b65c7a modify a document 2024-11-03 12:36:05 +01:00
jitokim
cec76318f8 Update documentation for property override precedence in ChatModel and EmbeddingModel configurations.
Signed-off-by: jitokim <pigberger70@gmail.com>
2024-11-03 12:25:34 +01:00
jito
cf17a6dccb Fix example code in ref docs (#1618)
chatclient.adoc
 - Replaced javaCopySimpleLoggerAdvisor with SimpleLoggerAdvisor
 - Fixed typo in the multiline String for ChatClient example

etl-pipeline.adoc
 - Fixed indent in the ParagraphPdfDocumentReader example

imageclient.adoc
 - Fixed indent of override annotation in the ImageGeneration example

testing.adoc
 - Added a semicolon to the Evaluator interface

Signed-off-by: jitokim <pigberger70@gmail.com>
2024-10-30 17:12:06 -04:00
John Silverman
1d8e0b39de Fix HTML document title on main page to "Introduction" 2024-10-29 17:29:55 -04:00
Nermin Karapandzic
f91aa79cd8 Update stabilityai-image.adoc 2024-10-29 13:48:45 -04:00
Mark Pollack
c02d13647e Add createExtension option for PostgresML config
The PostgresMLEmbeddingModel autoconfiguration previously always executed
"CREATE EXTENSION IF NOT EXISTS pgml" on startup. This could cause issues
for users without superuser privileges or those who manage extensions
through other means.

Added a new configuration property 'createExtension' (default false) to
make this behavior optional. Users can now explicitly enable extension
creation when needed.

Updated documentation to explain the new configuration option and its
implications for deployment.
2024-10-28 12:42:59 -04:00
Christian Tzolov
b6222d42e8 Improve the OpenSearch doc structure 2024-10-25 12:56:14 +02:00
Alexandros Pappas
e9b70f4ea5 Updated OpenSearch documentation to reflect correct configuration properties 2024-10-25 12:30:24 +02: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
c979238993 Adding nav entry for Azure Cosmos DB documentation
- Minor code sytle fixes.
2024-10-23 07:45:49 +02:00
keboom
7801119a92 Clarify hugging face TGI model support requirements
Add explicit model compatibility information to prevent failed deployments
with unsupported architectures. Point users to standard endpoints as
alternative for unsupported models.
2024-10-22 17:24:18 -04:00
Christian Tzolov
a1980ec4dd Update Claude 3.5 Sonnet model version to 20241022
- Update Claude 3.5 Sonnet model version from 20240620 to 20241022 across:
  - AnthropicApi model definitions
  - Integration tests
  - Sample events JSON
  - Documentation pages
- Upgrade Ollama container to 0.3.14 in tests
- Add llama3.2:1b model to Ollama tests
- Convert Ollama functionCallTest to parameterized test
2024-10-22 22:24:20 +02:00
Theo van Kraay
7b06fcf98b Add Azure CosmosDB vector store support
- Implement core vector store module for CosmosDB integration
- Add Spring Boot auto-configuration capabilities
- Integrate batch processing strategy for optimized operations
- Include comprehensive tests for core and auto-config modules
- Add reference docs for the CosmosDB vector store support
2024-10-22 15:50:16 -04:00
ks1ksi
740dd18216 docs: bedrock.adoc
anthropic -> anthropic3 for version 3
2024-10-22 12:48:50 +02:00
Sujin Kim
1d6bcbcedf docs : correct typo from "o" to "on" in vertexai-gemini-chat.adoc 2024-10-22 12:42:46 +02:00
Sujin Kim
94dc1a6d42 docs : correct typo from "opean" to "open" in azure-openai-chat.adoc 2024-10-22 12:42:46 +02:00
Sujin Kim
24bb85879d docs : correct typo from "can some" and "can can" in azure-open-ai-chat-function.adoc 2024-10-22 12:42:46 +02:00
Sujin Kim
2d7b00a3fb docs : correct typo "1st" and "supporetd" in anthropic-chat-function 2024-10-22 12:42:46 +02:00
Sujin Kim
91ee20d9cf docs : correct typo from "what it" to "what is" in bedrock-cohere.adoc 2024-10-22 12:42:46 +02:00
Ricken Bazolo
87d055aff2 fix azure openai doc 2024-10-22 12:42:11 +02:00
Ricken Bazolo
27000c4098 fix azure openai doc 2024-10-22 12:42:11 +02:00
Ricken Bazolo
e433d599a1 Fixed broken link to test class in mistralai doc 2024-10-22 12:42:11 +02:00
Benoit Moussaud
57754e8e5d Update azure.adoc fixing type 2024-10-22 12:40:08 +02:00
dafriz
e83bddfb37 docs: fix link to moonshot-chat.adoc 2024-10-22 12:33:19 +02:00
Thomas Vitale
d5bc9c998c Consolidate Ollama auto-pull logic
Consolidate the Ollama auto-pull logic at startup time, supporting the auto-pull for the default models specified via configuration properties and for optional models specified for initialization.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-10-21 23:19:11 +02:00
Christian Tzolov
1cadc49a9b Docs: start tabulating the Maven/Gradle code snippets 2024-10-21 15:02:19 +02:00
Christian Tzolov
278a61fde4 Fix doc ref links 2024-10-21 10:24:28 +02:00
Christian Tzolov
6006bd7abe Docs: start adding tabs for Maven/Gradle sections 2024-10-21 08:58:58 +02:00
Christian Tzolov
1252216f3a Revert antora-component-version-maven-plugin 2024-10-20 13:39:05 +02:00
Christian Tzolov
261f18cc01 Update Spring AI docs build and content
- Upgrade Antora Maven plugin to 1.0.0-alpha.4 (replace
  Replace the io.spring.maven.antora:antora-maven-plugin:0.0.4)
- Update playbook configuration for Antora 3.2.0-alpha.6
- Refine documentation layout and styling
- Enhance observability documentation with formatted tables
- Adjust Spring AI logo size and update integration diagram
2024-10-20 12:30:55 +02:00
Thomas Vitale
5e8cecd8b1 Enhance Ollama model auto-pull feature
* Fix configuration inheritance issue when default value is not specified.
* Make it possible to enable the auto-pull feature only for specific model types (e.g. for chat models only).
* Add the possibility to list explicit models to auto-pull at startup time.

Update Ollama model defaults and add new embedding model

* Change default chat model to Mistral
* Change default embedding model to mxbai-embed-large
* Add MXBAI_EMBED_LARGE to OllamaModel enum
* Remove DEFAULT_MODEL constant from OllamaOptions
* Update relevant classes to use new defaults

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
Co-authored-by:Christian Tzolov <ctzolov@vmware.com>
2024-10-20 08:20:16 +02:00
Christian Tzolov
a09972a29a Dock: improve chat-model documentation 2024-10-19 09:25:23 +02:00
Thomas Vitale
8eef6e6da5 Ollama: Pull models automatically at startup
* Introduce support for Ollama model auto-pull at startup time
* Enhance support for Ollama model auto-pull at run time
* Update documentation about integrating with Ollama and managing models
* Adopt Builder pattern in Ollama Model classes for better code readability
* Unify Ollama model auto-pull functionality in production and test code
* Improve integration tests for Ollama with Testcontainers
2024-10-18 15:42:28 +02:00
Christian Tzolov
5dfdd8ddcd Doc: improve table formating 2024-10-17 21:45:07 +02:00