Vector databases
A vector database holds chunks of text with their vectors.
A vector database holds chunks of text with their vectors. A node searches it, and the chunks found go into its
prompt where it writes {{chunks}} (see prompts). Vector databases are declared in
external.vectordb, each with an id; a node, or a validation node, lists the ones it searches in its
external.vectordb. Every key is described in the reference.
external:
vectordb:
- id: docs
provider: qdrant
url: http://localhost:6333
collection: docs
text_field: text
embedding: embedder
graph:
nodes:
- id: analyst
external:
vectordb:
- id: docs
query: user_messageProviders
provider | The search | The text of a chunk | The header of api_key |
|---|---|---|---|
qdrant | POST <url>/collections/<collection>/points/query | the field text_field of the payload; text_field is mandatory | api-key |
chromadb | GET <url>/api/v2/tenants/<tenant>/databases/<database>/collections/<collection>, for the id of the collection, then POST on .../collections/<id>/query | the documents of the collection; text_field is not allowed | x-chroma-token |
urlandcollectionare mandatory. The host ofurl, on its port, must be inallowed_hosts(see the file).tenantanddatabaseare forchromadbonly:default_tenantanddefault_databasewhen they are not written.api_keyis optional. Its variable is read when the database is searched, during the run: a variable that is not set fails the node (io). On the service it must be listed inallowed_envfor theurl.
A search
For every vector database of the node, in the order the node lists them:
- The query is the message of the user (
query: user_message) or a fixed text written in the file. Withuser_message, a node that has no message of the user fails (missing_field). Which message it is, when the node has input utilities, is explained in nodes. - The utilities of
utility.querychange the query. - The embedding model of the database turns the query into a vector (see embeddings).
- The database gives back the
top_kchunks nearest to the vector (5 when it is not written), the nearest first. Withchromadb, a document that is not a text is left out. - The utilities of
utility.chunkschange each chunk.
The chunks of all the databases, joined with an empty line between them, are the value of {{chunks}}. Each search is
a read.vectordb event (see observability).
Errors
A search fails the node (io) when a request to the database does not end within timeout seconds (60 when it is
not written, at least 1; chromadb makes two requests for each search), when the server cannot be reached, when it
answers a status other than 2xx, and when its answer is not JSON or lacks what is read in it (result.points and the
text of each point with qdrant; the id of the collection and documents with chromadb). For a status other than 2xx, the first 500 characters of the body are the detail of
the error, written only as the passport allows (see observability). An error of the embedding
model fails the node with model_failed.
A memory with provider: vectordb cites a vector database with ref: it cannot run yet (see memory).