= Qdrant Component
:doctitle: Qdrant
:shortname: qdrant
:artifactid: camel-qdrant
:description: Perform operations on the Qdrant Vector Database.
:since: 4.5
:supportlevel: Stable
:tabs-sync-option:
:component-header: Only producer is supported
//Manually maintained attributes
:group: AI
:camel-spring-boot-name: qdrant

*Since Camel {since}*

*{component-header}*

The Qdrant Component provides support for interacting with the https://qdrant.tech[Qdrant Vector Database].

== URI format

----
qdrant:collection[?options]
----

Where *collection* represents a named set of points (vectors with a payload) defined in your database.


// component options: START
include::partial$component-configure-options.adoc[]
include::partial$component-endpoint-options.adoc[]
include::partial$component-endpoint-headers.adoc[]
// component options: END

== Examples

=== Collection Examples

In the route below, we use the Qdrant component to create a collection named _myCollection_ with the given parameters:

==== Create Collection

[tabs]
====
Java::
+
[source,java]
----
from("direct:in")
    .setHeader(QdrantHeaders.ACTION)
        .constant(QdrantAction.CREATE_COLLECTION)
    .setBody()
        .constant(
            Collections.VectorParams.newBuilder()
                .setSize(2)
                .setDistance(Collections.Distance.Cosine).build())
    .to("qdrant:myCollection");
----
====

==== Delete Collection

In the route below, we use the Qdrant component to delete a collection named _myCollection_:

[tabs]
====
Java::
+
[source,java]
----
from("direct:in")
    .setHeader(QdrantHeaders.ACTION)
        .constant(QdrantAction.DELETE_COLLECTION)
    .to("qdrant:myCollection");
----
====


==== Collection Info

In the route below, we use the qdrant component to get information about the collection named `myCollection`:

[tabs]
====
Java::
+
[source,java]
----
from("direct:in")
    .setHeader(QdrantHeaders.ACTION)
        .constant(QdrantAction.COLLECTION_INFO)
    .to("qdrant:myCollection")
    .process(this::process);
----
====

If there is a collection, you will receive a reply of type `Collections.CollectionInfo`.
If there is not, the exchange will contain an exception of type `QdrantActionException` with a cause of type
`StatusRuntimeException statusRuntimeException` and status `Status.NOT_FOUND`.


=== Points Examples

==== Upsert

In the route below we use the qdrant component to perform insert + updates (upsert) on points in the collection named _myCollection_:

[tabs]
====
Java::
+
[source,java]
----
from("direct:in")
    .setHeader(QdrantHeaders.ACTION)
        .constant(QdrantAction.UPSERT)
    .setBody()
        .constant(
            Points.PointStruct.newBuilder()
                .setId(id(8))
                .setVectors(VectorsFactory.vectors(List.of(3.5f, 4.5f)))
                .putAllPayload(Map.of(
                        "foo", value("hello"),
                        "bar", value(1)))
                .build())
    .to("qdrant:myCollection");
----
====


==== Retrieve

In the route below, we use the Qdrant component to retrieve information of a single point by id from the collection named _myCollection_:

[tabs]
====
Java::
+
[source,java]
----
from("direct:in")
    .setHeader(QdrantHeaders.ACTION)
        .constant(QdrantAction.RETRIEVE)
    .setBody()
        .constant(PointIdFactory.id(8))
    .to("qdrant:myCollection");
----
====



==== Delete

In the route below, we use the qdrant component to delete points from the collection named `myCollection` according to a criteria:

[tabs]
====
Java::
+
[source,java]
----
from("direct:in")
    .setHeader(QdrantHeaders.ACTION)
        .constant(QdrantAction.DELETE)
    .setBody()
        .constant(ConditionFactory.matchKeyword("foo", "hello"))
    .to("qdrant:myCollection");
----
====






include::spring-boot:partial$starter.adoc[]
