Commit Graph

105 Commits

Author SHA1 Message Date
Christian Tzolov
670bf8e259 Adhere to Spring Framework code sytle
- Wildcard imports such as import java.util.* or import static org.assertj.core.api.Assertions.* are forbidden, even in test code.
   https://github.com/spring-projects/spring-framework/wiki/Code-Style#import-statements
2024-05-04 20:32:37 +03:00
mck
8a5f9dfb22 Add option to CassandraVectorStore to return embeddings in documents from similarity searches 2024-05-04 16:15:13 +02:00
mck
ac1a0d67e9 Avoid calling CREATE KEYSPACE|TABLE IF NOT EXISTS … unnecessarily
This also is a fix for AstraDB, which throws an exception if you try to `CREATE KEYSPACE IF NOT EXISTS …`
And use more compatible `USING 'StorageAttachedIndex'` index creation syntax.
2024-05-04 15:36:24 +02:00
wmz7year
f90c51a729 Improve ElasticsearchVectorStore,
- add index configuration and add support for ES response error handling.
 - rename dims to dimension propety.
 - add property javadocs
 - improve the elasticsearch javadoc.
2024-04-30 09:58:21 +03:00
Vaclav Bartacek
b9ba62507d Fix Neo4jVectorStore max allowed dimension size to 4096
- The Neo4j "vector-2.0" index provider allows up to 4096 dimensions.
  - Remove upper dimension boundry check
2024-04-28 20:30:06 +03:00
Christian Tzolov
9026263fd0 Fix javadoc after daf131be2c 2024-04-28 20:28:15 +03:00
mck
daf131be2c Fix column creation, when adding additional normal and embedding colums), and make index name unique (for when there are multiple vector indexes in the same keyspace)
And change stream to for-loop when converting List<Double> to Float[] for performance
2024-04-28 18:34:15 +03:00
Sagar Bhat
773b7bd3ca PgVectorStore: creating an index only if missing
- Resolve an issue where a new index keeps getting created during application start up.
 - Solution is is to create an index only if an index on the embedding column does not exist.
 - Add missing index name.
2024-04-26 19:03:45 +02:00
Ikko Eltociear Ashimine
db6f7cda3e Update AzureVectorStore.java
minor fix
2024-04-26 15:55:35 +02:00
omar.mahamid
6178b3dcc4 Fix CassandraVectorStoreConfig logger name
aligne logger name with the className
2024-04-20 07:40:01 +02:00
mck
0eaf7d05c9 Cassandra Vector Store initial impl follow up
- add concurrency to store.add(..) (bc embeddingClient is slow)
- CassandraVectorStoreAutoConfiguration uses CassandraAutoConfiguration
- driver profiles for production stability+performance,
- small cleanups and naming fixes,
- main doc tidy-up
- astradb compatibility (protocol V4)
– don't create embeddings again for documents that already have them
  similar to https://github.com/spring-projects/spring-ai/pull/413
2024-04-19 18:13:11 +02:00
Eddú Meléndez
eea3801fbd Remove @Testcontainers from HanaDB Tests
HanaDB tests don't rely on Testcontainers.
2024-04-10 17:31:28 +02:00
mck
656d238285 Implement Apache Cassandra vector store
The CassandraVectorStore is for managing and querying vector data in an Apache Cassandra db.
  It offers functionalities like adding, deleting, and performing similarity searches on documents.

  The store utilizes CQL to index and search vector data. It allows for custom metadata fields in
  the documents to be stored alongside the vector and content data.

  This class requires a CassandraVectorStoreConfig configuration object for initialization, which
  includes settings like connection details, index name, field names, etc. It also requires an
  EmbeddingClient to convert documents into embeddings before storing them.

  A schema matching the configuration is automatically created if it doesn't exist. Missing columns
  and indexes in existing tables will also be automatically created. Disable this with the disallowSchemaCreation.

  This class is designed to work with brand new tables that it creates for you, or on top of existing
  Cassandra tables. The latter is appropriate when wanting to keep data in place, creating embeddings
  next to it, and performing vector similarity searches in-situ.

  Instances of this class are not dynamic against server-side schema changes. If you change the schema
  server-side you need a new CassandraVectorStore instance.

 - Add auto-configure with tests.
 - reformat code style
 - Change field terminology to column (as appropriate for cassandra and cql)
 - Add doc page with an advanced example.
 - Add the dependencies to Spring AI BOM
 – add to `AutoConfiguration.imports`

 - Add @since annotation
 - Fix javadoc issue
 - Streamline the adoc content and layout
2024-04-10 16:51:47 +02:00
Christian Tzolov
0b04c8928a Update vector-stores README links 2024-04-09 20:55:39 +02:00
Rahul
466b824840 Add SAP HanaDB vector store integration
- Implement a HanaCloudVectorStore and tests
 - Implement Autoconfiguraiton + properties
 - Add boot starter
 - Update BOM with vector store and boot dependencies.
 - Add antora docuementation
 - added junit for HanaCloudVectorStoreProperties.java and documentation
   to create a BTP trial account and provision an instance for SAP Hana Cloud db
 - updated license, formatting and javadoc
 - IT for HanaCloudVectorStoreAutoConfiguration
 - IT for HanaCloudVectorStoreAutoConfiguration

Additional
 - add @AutoConfiguration(after = { JpaRepositoriesAutoConfiguration.class })
 - update the handa docs structure.
2024-04-09 12:36:42 +02:00
Christian Tzolov
8e0fbe49ee Remove the spring-boot-starter-jdbc dependency from PGVector project 2024-04-09 10:57:17 +02:00
Christian Tzolov
7c09c0963b Fix Chroma package name spelling error
- Rename org.springframework.ai.vectorsore into org.springframework.ai.vectorstore
 - Resolves #540
2024-04-07 13:49:58 +02:00
Eddú Meléndez
50f549d960 Update testcontainers redis version to 2.2.0 2024-04-04 13:43:01 +02:00
Eddú Meléndez
8fa675b145 Update spring boot version to 3.2.4 2024-04-04 13:43:01 +02:00
Sagar Bhat
ed68dfb00c Correct grammar for a message to be thrown as part of an exception when the document was not uploaded successfully (part of the 'add' method). 2024-03-27 09:15:08 +01:00
Christian Tzolov
50c464fd16 Exlucde, a parasite, lombok dependency 2024-03-22 09:23:35 +01:00
Jemin Huh
9334d7d540 Add Elasticsearch vector store integration
- Implement ElasticsearchVectoSotore and IT.
 - Add ElasticsearchAiSearchFilterExpressionConverter.
 - Add dependency to BOM and module to parent pom.
 - Fix ElasticsearchVectorStoreIT FilterExpression with
   Date type requires the use of epoch milliseconds.
 - Add license formatting.
2024-03-20 07:41:05 +01:00
geetrawat
7634c6b780 Add Gemfire vector store
- Implement a GemFireVectorStore implementing the VectorStore interface.
 - Add unit and integration test.
 - Add antora documentation.
 - Add to BOM.
2024-03-19 07:41:17 +01:00
Eddú Meléndez
8503078088 Add ServiceConnection support for
* ChromaDBContainer
 * MilvusContainer
 * QdrantContainer
 * RedisStackContainer
 * WeaviateContainer
 * OllamaContainer

Add docs
2024-03-18 23:29:55 -04:00
Christian Tzolov
666474caff Minor improvements of the MongoDB vector store impl. 2024-03-18 19:51:54 +01:00
Eddú Meléndez
150b268415 Add MongoDB Atlas vector store auto-configuration
It also provides a starter.
2024-03-18 15:07:34 +01:00
Eddú Meléndez
c5f35029f0 Remove withReuse in MongoDBAtlasContainer
`Reuse Container` is a Testcontainers experimental feature. It requires
`testcontainers.reuse.enable=true` in `~/.testcontainers.properties` in
order to take effect but in order to avoid surprises, this commit remove it.

See https://java.testcontainers.org/features/reuse/
2024-03-16 23:54:59 +01:00
Chris Smith
5f0123cc92 Add MongoDB Atlas Vector store
- Add VectorSearchAggregation used to actually preform the search
   on a given collection with embeddings.
 - add MongoDBVectorStore
 - Add MongoDBVectorStoreIT.  Integration test runs fine given...
   - You have a mongo atlas cluster to connect to (local or remote)
   - You have the search index "spring_ai_vector_search" setup correctly
   - Need to explore getting around this
   - Need to filter results using threshold
 - Add postfilter for threshold values - While a post filter is not ideal,
   it gets the job done. The mongo team seems to be working on having
   it availible as a prefilter option, in which this implementation
   can be updated to use later.
 - implement filtering threshold
 - fix a few sonar issues
 - formatting
 - use higher default num_candidates
 - use builder for configuration
 - add documentation and some refactor
 - use consistent property in integration test
 - finish implementing filter support
 - add documentation to filter converter
 - add vector search index auto creation

 - Add to BOM.
 - Fix version to 1.0.0-SN.
 - Move expresion converter from core to models/mongodb.
 - Fix style and license headers
2024-03-16 12:13:02 +01:00
Gerrit Meier
7c6bbef3ec Allow more customization for Neo4j store (id and constraint).
Unrelated to this change, the Neo4j test version increased to be current.
2024-03-15 12:26:20 +01: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
Bragolgirith
777b79e1c5 Fix RedisVectorStore not closing Jedis pipelines 2024-03-12 15:15:05 +01:00
Christian Tzolov
ba940395b6 Use platform independent line separators 2024-03-08 09:43:15 +01:00
Mark Pollack
bcb559a82c add license header plugin and update all java files 2024-03-06 17:39:37 -05:00
Christian Tzolov
cbb59ce616 Improve readability of the PgVector Store code
Related to #461
2024-03-03 08:54:21 +01:00
Anush008
0995515f2f Minor code and doc adjustments
- chore: renamed test file
 - fix: BOOL_VALUE ObjectFactory
2024-03-01 11:49:01 +01:00
Christian Tzolov
a8110bb3da Qdrant improvements
- Update docs
 - Allow colleciton auto-creation if missing
 - Add cloud IT : QdrantVectorStoreCloudAutoConfigurationIT
 - Add auto-configuration properties tests: PgVectorStorePropertiesTests
2024-02-29 09:27:19 +01:00
Anush008
ea0b439dac Implement Qdrant vector store
- Implement QdrantVectorStore.
   Uses a custom parser for converting Spring AI metadata(Map<String, Object>) to Qdrant GRPC payload.
 - Implement Qdrant Expression Filter support.
   Uses a custom parser for converting Spring AI filters to Qdrant-compatible GRPC filters.
 - Add ITs using testcontainers.
 - Add antora docs adrant.adoc.
 - Add Qdrant vector store auto-configuraton and boot starter.

Additional (review) change:

 - Fix poms parent to 0.8.1-SNAPSHOT.
 - Rename ObjectFactory into QdrantObjectFactor.
 - Rename ValueFactory into QdrantValueFactory.
 - Move the org.springframework.ai.vectorstore package into org.springframework.ai.vectorstore.qdrant.
 - Add missing Autoconfigure definition.
 - Add missing license and JavaDocs.
 - Minor code style improvmentes.
 - Move the qdrant version to the main pom
 - Add QdrantVectorStoreAutoConfigurationIT
 - Remove guava dependency
 - Improve gdrant.adoc conent and structure.
 - Remove the grpc-protobuf dependency

Resolves #331
2024-02-28 19:31:54 +01:00
Christian Tzolov
65d42c9d4f Add full support or Vertex AI Gemini and Azure OpenAI function calling
- 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
2024-02-28 15:41:37 +01:00
Eddú Meléndez
6de57d5f37 Use Testcontainers Vector Database modules
- Update testcontainers version to 1.19.6
 - Use ChromaDBContainer
 - Use MilvusContainer
 - Use WeaviateContainer
 - Fix format
2024-02-27 17:30:43 +01:00
Mark Pollack
8532cb7bcc Bump to 0.8.1-SNAPSHOT 2024-02-23 11:11:14 -05:00
Mark Pollack
bc5c4e2c4f add jdbc starter to pgvector starter 2024-02-22 15:48:58 -05:00
Mark Pollack
a107e313fc Fixes #219 - Remove dependency cycles 2024-02-19 12:24:16 -05:00
Christian Tzolov
fdd3fbb2f9 Revert default OpenAI embedding to text-embedding-ada-002 as some vector stores have problems with 3-small 2024-02-16 11:19:34 +01:00
Christian Tzolov
7ef49b8cef Set the default OpenAI Embedding model to text-embedding-3-small
The text-embedding-3-small has the same dimensions as previous text-embedding-ada-002.
  The text-embedding-3-large has higher dimensionality not supported by some Vector Stores.
2024-02-16 10:27:13 +01:00
Gerrit Meier
e62543c761 Use the new vector index creation syntax for Neo4j.
To make the Neo4j module more future-proof, this commit
replaces the old vector index creation syntax with the new style.
Also, the new pattern is in line with the standard Neo4j index creation
and supports the _IF NOT EXISTS_ clause to run idempotent.
This allows us to remove the preceding call to check if the index exists.

As a consequent, the module will require Neo4j to be at least on version 5.15.
2024-02-16 09:40:36 +01:00
Adam Bchouti
36278afdb3 Add Pinecone namespace support for add, search and delete operations 2024-02-14 14:55:21 +01:00
Adam Bchouti
41885a8e62 Enable updating the pinecone vector store namespace 2024-02-14 14:41:09 +01:00
Christian Tzolov
57c66b91d7 Fix a broken test 2024-02-14 09:54:20 +01:00
Gerrit Meier
408337e327 Support filter expressions in Neo4j vector store.
- Move Neo4j filter converters from core to neoj4 vector store project.
 - Update neo4j adoc.

 Resolves #318
2024-02-14 09:23:44 +01:00