Skip to content

Commit 9dc9abc

Browse files
committed
feat: Support for api_key
Signed-off-by: Anush008 <[email protected]>
1 parent a2b58b1 commit 9dc9abc

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

docs/docs/ops/storages.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ Exports data to a [Qdrant](https://qdrant.tech/) collection.
2121

2222
The spec takes the following fields:
2323

24-
* `grpc_url` (type: `str`, required): The [gRPC URL](https://qdrant.tech/documentation/interfaces/#grpc-interface) of the Qdrant instance. Defaults to `http://localhost:6334/`.
25-
2624
* `collection_name` (type: `str`, required): The name of the collection to export the data to.
2725

26+
* `grpc_url` (type: `str`, optional): The [gRPC URL](https://qdrant.tech/documentation/interfaces/#grpc-interface) of the Qdrant instance. Defaults to `http://localhost:6334/`.
27+
28+
* `api_key` (type: `str`, optional). API key to authenticate requests with.
29+
2830
The field name for the vector embeddings must match the [vector name](https://qdrant.tech/documentation/concepts/vectors/#named-vectors) used when the collection was created.
2931

3032
If no primary key is set during export, a random UUID is used as the Qdrant point ID.

python/cocoindex/storages.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Qdrant(op.StorageSpec):
1717

1818
collection_name: str
1919
grpc_url: str = "http://localhost:6334/"
20+
api_key: str | None = None
2021

2122
@dataclass
2223
class Neo4jConnectionSpec:

src/ops/storages/qdrant.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ fn key_value_fields_iter<'a>(
3737
pub struct Spec {
3838
collection_name: String,
3939
grpc_url: String,
40+
api_key: Option<String>,
4041
}
4142

4243
pub struct Executor {
@@ -51,6 +52,7 @@ impl Executor {
5152
fn new(
5253
url: String,
5354
collection_name: String,
55+
api_key: Option<String>,
5456
key_fields_schema: Vec<FieldSchema>,
5557
value_fields_schema: Vec<FieldSchema>,
5658
) -> Result<Self> {
@@ -60,7 +62,10 @@ impl Executor {
6062
.cloned()
6163
.collect::<Vec<_>>();
6264
Ok(Self {
63-
client: Qdrant::from_url(&url).build()?,
65+
client: Qdrant::from_url(&url)
66+
.api_key(api_key)
67+
.skip_compatibility_check()
68+
.build()?,
6469
key_fields_schema,
6570
value_fields_schema,
6671
all_fields,
@@ -339,6 +344,7 @@ impl StorageFactoryBase for Arc<Factory> {
339344
let executor = Arc::new(Executor::new(
340345
spec.grpc_url,
341346
spec.collection_name.clone(),
347+
spec.api_key,
342348
key_fields_schema,
343349
value_fields_schema,
344350
)?);

0 commit comments

Comments
 (0)