Skip to content

Commit

Permalink
Fixes #4124: Better document output of vector db procedures (#4154)
Browse files Browse the repository at this point in the history
  • Loading branch information
vga91 authored Jul 26, 2024
1 parent 83358f5 commit 60e02de
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ With hostOrKey=null, the default is 'http://localhost:8000'.
CALL apoc.vectordb.chroma.createCollection($host, 'test_collection', 'Cosine', 4, {<optional config>})
----

.Example results
[opts="header"]
|===
| name | metadata | database | id | tenant
| test_collection | {"size": 4, "hnsw:space": "cosine"} | default_database | 9c046861-f46f-417d-bd01-ca8c9f99aee5 | default_tenant
|===

.Delete a collection (it leverages https://docs.trychroma.com/usage-guide#creating-inspecting-and-deleting-collections[this API])
[source,cypher]
----
CALL apoc.vectordb.chroma.deleteCollection($host, '<collection_id>', {<optional config>})
----

which returns an empty result.

.Upsert vectors (it leverages https://docs.trychroma.com/usage-guide#adding-data-to-a-collection[this API])
[source,cypher]
Expand All @@ -63,6 +70,7 @@ CALL apoc.vectordb.qdrant.upsert($host, '<collection_id>',
{<optional config>})
----

which returns an empty result.

.Get vectors (it leverages https://docs.trychroma.com/usage-guide#querying-a-collection[this API])
[source,cypher]
Expand Down Expand Up @@ -231,9 +239,12 @@ CALL apoc.ml.rag(paths, $attributes, $question, $confPrompt) YIELD value
RETURN value
----

which returns a string that answers the `$question` by leveraging the embeddings of the db vector.

.Delete vectors (it leverages https://docs.trychroma.com/usage-guide#deleting-data-from-a-collection[this API])
[source,cypher]
----
CALL apoc.vectordb.chroma.delete($host, '<collection_id>', [1,2], {<optional config>})
----

which returns an array of strings of deleted ids. For example, `["1", "2"]`
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,26 @@ Here is a list of example using a local installation using th default port `1953
CALL apoc.vectordb.milvus.createCollection('http://localhost:19531', 'test_collection', 'COSINE', 4, {<optional config>})
----

.Example results
[opts="header"]
|===
| data | code
| null | 200
|===

.Delete a collection (it leverages https://milvus.io/api-reference/restful/v2.4.x/v2/Collection%20(v2)/Drop.md[this API])
[source,cypher]
----
CALL apoc.vectordb.milvus.deleteCollection('http://localhost:19531', 'test_collection', {<optional config>})
----

.Example results
[opts="header"]
|===
| data | code
| null | 200
|===


.Upsert vectors (it leverages https://milvus.io/api-reference/restful/v2.4.x/v2/Vector%20(v2)/Upsert.md[this API])
[source,cypher]
Expand All @@ -65,6 +78,13 @@ CALL apoc.vectordb.milvus.upsert('http://localhost:19531', 'test_collection',
{<optional config>})
----

.Example results
[opts="header"]
|===
| data | code
| {"upsertCount": 2, "upsertId": [1, 2]} | 200
|===


.Get vectors (it leverages https://milvus.io/api-reference/restful/v2.4.x/v2/Vector%20(v2)/Get.md[this API])
[source,cypher]
Expand Down Expand Up @@ -233,9 +253,17 @@ CALL apoc.ml.rag(paths, $attributes, $question, $confPrompt) YIELD value
RETURN value
----

which returns a string that answers the `$question` by leveraging the embeddings of the db vector.

.Delete vectors (it leverages https://milvus.io/api-reference/restful/v2.4.x/v2/Vector%20(v2)/Delete.md[this API])
[source,cypher]
----
CALL apoc.vectordb.milvus.delete('http://localhost:19531', 'test_collection', [1,2], {<optional config>})
----

.Example results
[opts="header"]
|===
| data | code
| null | 200
|===
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,25 @@ With hostOrKey=null, the default is 'http://localhost:6333'.
CALL apoc.vectordb.qdrant.createCollection($hostOrKey, 'test_collection', 'Cosine', 4, {<optional config>})
----

.Example results
[opts="header"]
|===
| result | time | status
| true | 0.094182458 | "ok"
|===

.Delete a collection (it leverages https://qdrant.github.io/qdrant/redoc/index.html#tag/collections/operation/delete_collection[this API])
[source,cypher]
----
CALL apoc.vectordb.qdrant.deleteCollection($hostOrKey, 'test_collection', {<optional config>})
----

.Example results
[opts="header"]
|===
| result | time | status
| true | 0.094182458 | "ok"
|===

.Upsert vectors (it leverages https://qdrant.github.io/qdrant/redoc/index.html#tag/points/operation/upsert_points[this API])
[source,cypher]
Expand All @@ -64,6 +76,12 @@ CALL apoc.vectordb.qdrant.upsert($hostOrKey, 'test_collection',
{<optional config>})
----

.Example results
[opts="header"]
|===
| result | time | status
| {"result": { "operation_id": 0, "status": "acknowledged" } } | 0.094182458 | "ok"
|===

.Get vectors (it leverages https://qdrant.github.io/qdrant/redoc/index.html#tag/points/operation/get_points[this API])
[source,cypher]
Expand Down Expand Up @@ -234,8 +252,17 @@ CALL apoc.ml.rag(paths, $attributes, $question, $confPrompt) YIELD value
RETURN value
----

which returns a string that answers the `$question` by leveraging the embeddings of the db vector.

.Delete vectors (it leverages https://qdrant.github.io/qdrant/redoc/index.html#tag/points/operation/delete_vectors[this API])
[source,cypher]
----
CALL apoc.vectordb.qdrant.delete($hostOrKey, 'test_collection', [1,2], {<optional config>})
----

.Example results
[opts="header"]
|===
| result | time | status
| {"result": { "operation_id": 2, "status": "acknowledged" } } | 0.094182458 | "ok"
|===
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ With hostOrKey=null, the default is 'http://localhost:8080/v1'.
CALL apoc.vectordb.weaviate.createCollection($host, 'test_collection', 'Cosine', 4, {<optional config>})
----

.Example results
[opts="header"]
|===
| vectorizer | invertedIndexConfig | vectorIndexConfig | multiTenancyConfig | vectorIndexType | replicationConfig | shardingConfig | class | properties
| none | {"bm25": { "b": 0.75, "k1": 1.2 }, "stopwords": { "additions": null, "removals": null, "preset": "en" }, "cleanupIntervalSeconds": 60} | { "ef": -1, "dynamicEfMin": 100, "pq": { "centroids": 256, "trainingLimit": 100000, "encoder": { "type": "kmeans", "distribution": "log-normal" }, "enabled": false, "bitCompression": false, "segments": 0 }, "distance": "cosine", "skip": false, "dynamicEfFactor": 8, "bq": { "enabled": false }, "vectorCacheMaxObjects": 1000000000000, "cleanupIntervalSeconds": 300, "dynamicEfMax": 500, "efConstruction": 128, "flatSearchCutoff": 40000, "maxConnections": 64 } | { "enabled": false } | hnsw | { "factor": 1 } | { "desiredVirtualCount": 128, "desiredCount": 1, "actualCount": 1, "function": "murmur3", "virtualPerPhysical": 128, "strategy": "hash", "actualVirtualCount": 128, "key": "_id" } | TestCollection | null
|===

.Create a collection against a remote connection using an API key (see https://weaviate.io/developers/weaviate/configuration/authentication[here])
[source,cypher]
----
Expand All @@ -56,6 +63,12 @@ CALL apoc.vectordb.weaviate.createCollection("https://<weaviateInstanceId>.weavi
{headers: {Authorization: 'Bearer <apiKey>'}})
----

.Example results
[opts="header"]
|===
| vectorizer | invertedIndexConfig | vectorIndexConfig | multiTenancyConfig | vectorIndexType | replicationConfig | shardingConfig | class | properties
| none | {"bm25": { "b": 0.75, "k1": 1.2 }, "stopwords": { "additions": null, "removals": null, "preset": "en" }, "cleanupIntervalSeconds": 60} | { "ef": -1, "dynamicEfMin": 100, "pq": { "centroids": 256, "trainingLimit": 100000, "encoder": { "type": "kmeans", "distribution": "log-normal" }, "enabled": false, "bitCompression": false, "segments": 0 }, "distance": "cosine", "skip": false, "dynamicEfFactor": 8, "bq": { "enabled": false }, "vectorCacheMaxObjects": 1000000000000, "cleanupIntervalSeconds": 300, "dynamicEfMax": 500, "efConstruction": 128, "flatSearchCutoff": 40000, "maxConnections": 64 } | { "enabled": false } | hnsw | { "factor": 1 } | { "desiredVirtualCount": 128, "desiredCount": 1, "actualCount": 1, "function": "murmur3", "virtualPerPhysical": 128, "strategy": "hash", "actualVirtualCount": 128, "key": "_id" } | TestCollection | null
|===


.Delete a collection (it leverages https://weaviate.io/developers/weaviate/api/rest#tag/schema/delete/schema/{className}[this API])
Expand All @@ -64,6 +77,8 @@ CALL apoc.vectordb.weaviate.createCollection("https://<weaviateInstanceId>.weavi
CALL apoc.vectordb.weaviate.deleteCollection($host, 'test_collection', {<optional config>})
----

which returns an empty result.


.Upsert vectors (it leverages https://weaviate.io/developers/weaviate/api/rest#tag/objects/post/objects[this API])
[source,cypher]
Expand All @@ -76,6 +91,13 @@ CALL apoc.vectordb.weaviate.upsert($host, 'test_collection',
{<optional config>})
----

.Example results
[opts="header"]
|===
| lastUpdateTimeUnix | vector | id | creationTimeUnix | class | properties
| 1721293838439 | [0.05, 0.61, 0.76, 0.74] | 8ef2b3a7-1e56-4ddd-b8c3-2ca8901ce308 | 1721293838439 | TestCollection | {city: "Berlin", foo: "one"}
| 1721293838439 | [0.19, 0.81, 0.75, 0.11] | 9ef2b3a7-1e56-4ddd-b8c3-2ca8901ce308 | 1721293838439 | TestCollection | {city: "London", foo: "two"}
|===

.Get vectors (it leverages https://weaviate.io/developers/weaviate/api/rest#tag/objects/get/objects/\{className\}/\{id\}[this API])
[source,cypher]
Expand Down Expand Up @@ -250,8 +272,17 @@ CALL apoc.ml.rag(paths, $attributes, $question, $confPrompt) YIELD value
RETURN value
----

which returns a string that answers the `$question` by leveraging the embeddings of the db vector.

.Delete vectors (it leverages https://weaviate.io/developers/weaviate/api/rest#tag/objects/delete/objects/\{className\}/\{id\}[this API])
[source,cypher]
----
CALL apoc.vectordb.weaviate.delete($host, 'test_collection', [1,2], {<optional config>})
----

.Example results
[opts="header"]
|===
| value
| ["1", "2"]
|===

0 comments on commit 60e02de

Please sign in to comment.