Commit Graph

1321 Commits

Author SHA1 Message Date
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
Thomas Vitale
bc50d28f2d Modular RAG: Query Augmentor
* Add new QueryAugmentor API, a component for augmenting a user query with contextual data.
* Implement ContextualQueryAugmentor that combines the content of each document and add it to the original user prompt, with support for the scenario where the context is empty.
* Extend RetrievalAugmentationAdvisor to use the new augmentation building block.
* Introduce utility to assist in validating arguments for prompt-related operations.

Relates to gh-#1603

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-11-03 12:07:20 +01:00
Thomas Vitale
cca430428e Support case with missing system text in VectorStoreChatMemoryAdvisor
The system text advise prompt is only joined with the value of the system text if it's non-null and non-empty.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-11-03 11:54:45 +01:00
Thomas Vitale
048d54b82b Make ChatClient APIs null-safe and predictable
* Introduced null-safety for all ChatClient APIs and verified via extensive auto-tests.
* Made the final message list computed by ChatClient consistent and predictable across the different options for providing messages (prompt(), messages(), user(), prompt()) and verified via extensive auto-tests.
* Added even more auto-tests to cover as many scenarios and edge cases as possible.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-11-03 07:30:05 +01:00
Mark Pollack
25f386bb14 Disable opensearch vector store test searchDocumentsInTwoIndicesTest 2024-11-02 16:25:51 -04:00
Mark Pollack
0c07edc2e7 Revert back to previous OpenAiApi implementation and disable config prop tests 2024-11-02 16:16:22 -04: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
jitokim
291da720a6 Remove redundant condition in RedisVectorStore
- Fix Javadoc typo: change 'algorithmto use' to 'algorithm to use'

Signed-off-by: jitokim <pigberger70@gmail.com>
2024-11-01 12:33:13 -04:00
Soby Chacko
254239cfe0 More checkstyle fixes 2024-11-01 12:25:19 -04:00
Mark Pollack
12ff83b068 Comment out flaky assertion in OpenAiChatModelObservationIT 2024-10-31 15:15:30 -04:00
Soby Chacko
e72ab6ba25 Addressing more checkstyle violations
- Enable checkstyle on more modules and adressing violations
review
2024-10-31 01:04:41 -04:00
Soby Chacko
cdc1cecb57 Enabling checkstyle on spring-ai-openai 2024-10-31 00:03:25 -04:00
Thomas Vitale
5d8c032bb7 Modular RAG: Retrieval with Vector Stores
* Establish new package for Modular RAG components.
* Add new Query API, representing a query in the context of a RAG flow.
* Define Retrieval package for the RAG building blocks handling the data retrieval operations.
* Relocate DocumentRetriever to Retrieval package and implement VectorStoreDocumentRetriever.
* Introduce RetrievalAugmentationAdvisor as the successor of QuestionAnswerAdvisor. It uses the Retrieval building blocks described in the previous point.
* Make Advisor APIs null-safe and update tests accordingly.

Relates to gh-#1603

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-10-30 23:57:38 -04:00
leevh0908
3fc03233c0 Milvus vector store: Pass databaseName in DeleteParam for non-default databases
When using a non-default database, MilvusVectorStore's doDelete method wasn't
passing the specified databaseName in DeleteParam, causing searches to fall back
to the default database where collections couldn't be found. Added explicit
databaseName parameter to fix this issue.

- Add databaseName to DeleteParam builder
- Upgrade milvus-sdk from 2.3.4 to 2.3.5
2024-10-30 20:37:55 -04: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
jito
1e980d13b2 Azure cosmos-db vector store maven cleanup (#1631)
- Define the version for Azure Cosmos DB
- Add dependencies for the azure-cosmos-db-store module and boot starter
- Include the artifacts in spring-ai-bom

Signed-off-by: jitokim <pigberger70@gmail.com>
2024-10-30 17:07:13 -04:00
Ilayaperumal Gopinathan
d8f7ddb72c GH-513 fix: Support custom field names for Milvus VectorStore collection (#1616)
* GH-513 fix: Support custom field names for Milvus VectorStore collection

- Add configuration properties to override the default field names for doc_id, content, metadata and embedding
- Add support to allow auto-id when enabled
- Add tests

Resolves #513

* Fix package modifier
2024-10-30 14:44:50 -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
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