Files
landing_page/qdrant-landing/content/documentation/frameworks/spring-ai.md
T
a21aa0c2ab docs: TestContainers integration (#710)
* docs: TestContainers integration

* docs: refactor Spring AI docs

* docs: review changes

* Apply suggestions from code review

Co-authored-by: Eddú Meléndez Gonzales <eddu.melendez@gmail.com>

* Apply suggestions from code review

Co-authored-by: Mike Jang <michael.jang@qdrant.io>

* Update qdrant-landing/content/documentation/frameworks/spring-ai.md

Co-authored-by: Mike Jang <michael.jang@qdrant.io>

* chore: Updated preview image

* Update qdrant-landing/content/documentation/frameworks/testcontainers.md

* docs: Commented out Node/Python modules

---------

Co-authored-by: Eddú Meléndez Gonzales <eddu.melendez@gmail.com>
Co-authored-by: Mike Jang <michael.jang@qdrant.io>
2024-03-20 10:16:32 +05:30

2.5 KiB
Raw Blame History

title, weight
title weight
Spring AI 2200

Spring AI

Spring AI is a Java framework that provides a Spring-friendly API and abstractions for developing AI applications.

Qdrant is available as supported vector database for use within your Spring AI projects.

Installation

You can find the Spring AI installation instructions here.

Add the Qdrant boot starter package.

<dependency>
 <groupId>org.springframework.ai</groupId>
 <artifactId>spring-ai-qdrant-store-spring-boot-starter</artifactId>
</dependency>

Usage

Configure Qdrant with Spring Boot’s application.properties.

spring.ai.vectorstore.qdrant.host=<host of your qdrant instance>
spring.ai.vectorstore.qdrant.port=<the GRPC port of your qdrant instance>
spring.ai.vectorstore.qdrant.api-key=<your api key>
spring.ai.vectorstore.qdrant.collection-name=<The name of the collection to use in Qdrant>

Learn more about these options in the configuration reference.

Or you can set up the Qdrant vector store with the QdrantVectorStoreConfig options.

@Bean
public QdrantVectorStoreConfig qdrantVectorStoreConfig() {

    return QdrantVectorStoreConfig.builder()
        .withHost("<QDRANT_HOSTNAME>")
        .withPort(<QDRANT_GRPC_PORT>)
        .withCollectionName("<QDRANT_COLLECTION_NAME>")
        .withApiKey("<QDRANT_API_KEY>")
        .build();
}

Build the vector store using the config and any of the support Spring AI embedding providers.

@Bean
public VectorStore vectorStore(QdrantVectorStoreConfig config, EmbeddingClient embeddingClient) {
    return new QdrantVectorStore(config, embeddingClient);
}

You can now use the VectorStore instance backed by Qdrant as a vector store in the Spring AI APIs.

📚 Further Reading