Commit Graph

1453 Commits

Author SHA1 Message Date
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
jitokim
6d2b22fae3 Add spring-ai-starter-azure-cosmos-db-store submodule to pom.xml
Signed-off-by: jitokim <pigberger70@gmail.com>
2024-10-29 17:31:32 -04:00
John Silverman
1d8e0b39de Fix HTML document title on main page to "Introduction" 2024-10-29 17:29:55 -04:00
Sébastien Deleuze
8c0c2bae08 Introduce Kotlin tests
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.
2024-10-29 17:26:44 -04:00
Mark Pollack
ca1949c825 Replace static initalization block in BaseOllamaIT
The static block was introducing side effects when doing scans of classpath
for AOT and seems to have been the cause of a failing test.

Updated github actions to use ~/.testcontainers.properties to enable
container resuse
2024-10-29 13:58:09 -04:00
Nermin Karapandzic
f91aa79cd8 Update stabilityai-image.adoc 2024-10-29 13:48:45 -04:00
Sébastien Deleuze
081840eef2 Skip tests requiring OpenAI API key
Adds @EnabledIfEnvironmentVariable annotation to integration tests that
use OpenAI embeddings. Tests will be skipped if OPENAI_API_KEY is not set,
making the build process more reliable for contributors who don't have
access to OpenAI services.
2024-10-29 12:15:44 -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
Toshiaki Maki
f3c32df601 Fix flaky tests in PostgresMlEmbeddingModelIT 2024-10-28 11:21:39 -04:00
Craig Walls
ac4571ea52 Fix StabilityAI options merge precedence
This fix ensures proper inheritance of defaults while maintaining the
correct precedence order for both generic and StabilityAI-specific options.

Added tests to verify the merge behavior for runtime options, default options,
and generic ImageOptions cases.
2024-10-28 10:53:51 -04:00
Christian Tzolov
9c7af5641f Increase the timeout/retry for auto-conf BaseOllamaIT
Add ModelManagementOptions configuration to BaseOllamaIT
  with 2 max retries and 10 minute timeout
2024-10-25 15:43:21 +02: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
Mark Pollack
3f85f792c2 fix cassandra tests 2024-10-24 20:31:19 -04:00
Mark Pollack
d9a564050b Fix json serialization in tests 2024-10-24 18:45:25 -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
33a72417e1 Remove deprecated output parser in favour of converter across the project
All output parser functionality has already been migrated to the converter package
 since milestone M1.

 Changes:
 - Replace all instances of 'parser' with 'converter' in variable names and test cases
 - Delete (pre M1) deprecated parser package and all associated classes
 - Remove Output Parsers section from README.md
 - Update Javadoc comments to reference converters instead of parsers
2024-10-24 14:09:54 +01:00
Christian Tzolov
b66ffb4d22 Extend Ollama's model auto-pull timeout for ITs 2024-10-24 12:51:35 +02:00
Christian Tzolov
89e583ca7f Clear/update the project README 2024-10-24 12:03:34 +02:00
Christian Tzolov
12f2f9d0e0 Fix ChromaVectorStoreAutoConfigurationIT configuration 2024-10-24 11:38:32 +02:00
Sébastien Deleuze
f21b8a42b5 Refine Jackson ObjectMapper handling
ObjectMapper instantiation is costly, so unless its usage
is one-shot, it is better to create a reusable instance
for upcoming usage.

Also, before this commit, serialization of most Kotlin
classes was not supported due to the lack of proper
Jackson KotlinModule detection.

This commit:
 - Avoids per invocation ObjectMapper instantiation when
   relevant
 - Automatically detects and enables well-known Jackson
   modules including the Kotlin one
 - Removes org.springframework.ai.vectorstore.JsonUtils
   which looks not needed anymore

More optimizations are possible like reusing more
ObjectMapper instances, but this could introduce more breaking
changes so this commit intends to be a good first step.

Kotlin tests will be provided in a follow-up commit.

Additional changes:
 - Update ModelOptionsUtils to use JacksonUtils.instantiateAvailableModules()
 - Add missing license headers
 - Add missing author Javadoc comments
2024-10-24 09:20:47 +02:00
Christian Tzolov
9f6ca77bbc Ensure unique functions in FunctionCallingOptionsBuilder
- Fix issues caused by cf75640c86
- Modify withFunction() to maintain unique function entries using HashSet
2024-10-23 20:40:06 +02:00
Mark Pollack
cf75640c86 Make FunctionCallingOptions collections immutable
Prevent external modification of internal state by returning unmodifiable
collections and adding defensive copies in setters and builders.

Co-authored-by: youngmoneee@users.noreply.github.com
2024-10-23 17:53:40 +02:00
Christian Tzolov
c544d0c0a9 Add support for BiFunction class type resolution in TypeResolverHelper
- Adds special handling for BiFunction class types
- Adds test cases to verify BiFunction class type resolution
- Removes deprecated AbstractFunctionCallSupport class
- Cleans up unused imports in FunctionCallback

Resolves #1576
2024-10-23 15:29:15 +01:00
dafriz
3288c55ca6 Add Claude 3.5 Sonnet V2 model enum to Bedrock 2024-10-23 15:05:07 +02: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
Soby Chacko
c979d1c606 CosmosDB vector store auto configuration changes
- Configurable BatchingStrategy via auto configuraiton
- Minor code cleanup
2024-10-22 17:08:31 -04:00
Ricken Bazolo
745e718a51 Add Builder pattern and tests for TokenTextSplitter
- Convert TokenTextSplitter configuration parameters to final fields
- Add static Builder class for fluent construction
- Define default constants for configuration values
- Add unit tests validating builder and default configurations
- Test metadata handling and content splitting behavior
2024-10-22 22:47:40 +02: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
dafriz
2c17577f2f Add support for prompt token details in OpenAI usage stats
- Add PromptTokensDetails record to track cached tokens in prompt
- Update Usage record to include promptTokensDetails field
- Add getCachedTokens() method to OpenAiUsage
- Add test cases for cached tokens handling

Resolves #1506
2024-10-22 14:05:40 +02:00
ogbozoyan
8b1882b224 Filter out null keys and values from document metadata for TextSplitter
- Update TextSplitter to filter out metadata entries with null keys or values
- Simplify text substring call in TextSplitterTests
- Add test case for document splitting with null metadata values
2024-10-22 13:45:11 +02:00
ks1ksi
740dd18216 docs: bedrock.adoc
anthropic -> anthropic3 for version 3
2024-10-22 12:48:50 +02:00
Ricken Bazolo
f1e3834f6e add the ability to customize logger order 2024-10-22 12:43: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
ef2e39a8ad Normalize Ollama model names in auto-pull feature
In order to support edge cases due to different naming formats, this PR introduced an explicit normalization logic to ensure the correct matching when checking for the availability of a certain model. Integration tests have been added to cover the different scenarios, including models from Ollama and from Hugging Face.

Also fix the container creation on the useTestcontainers flag (christian)

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-10-22 12:10:58 +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
devholic22
854a7d99a3 fix: remove 1.0-SNAPSHOT in all OpenAI links
- remove 1.0-SNAPSHOT in all OpenAI links
2024-10-21 10:15:59 +02:00