David Potter 4b8352e0f5
feat: add chroma destination connector (#2240)
Adds Chroma (also known as ChromaDB) as a vector destination.

Currently Chroma is an in-memory single-process oriented library with
plans of a hosted and/or more production ready solution
-https://docs.trychroma.com/deployment

Though they now claim to support multiple Clients hitting the database
at once, I found that it was inconsistent. Sometimes multiprocessing
worked (maybe 1 out of 3 times) But the other times I would get
different errors. So I kept it single process.

---------

Co-authored-by: potter-potter <david.potter@gmail.com>
2023-12-19 16:58:23 +00:00

35 lines
1.4 KiB
Bash

#!/usr/bin/env bash
# Processes example-docs/book-war-and-peace-1p.txt/,
# embeds the processed document and writes to results to a Chroma collection.
# Structured outputs are stored in local-to-chroma/
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
cd "$SCRIPT_DIR"/../../.. || exit 1
# As an example we're using the local source connector,
# however ingesting from any supported source connector is possible.
# shellcheck disable=2094
PYTHONPATH=. ./unstructured/ingest/main.py \
local \
--input-path example-docs/book-war-and-peace-1p.txt \
--output-dir local-to-chroma \
--strategy fast \
--chunk-elements \
--embedding-provider "<an unstructured embedding provider, ie. langchain-huggingface>" \
--num-processes 2 \
--verbose \
--work-dir "<directory for intermediate outputs to be saved>" \
chroma \
--path "<Location where Chroma is persisted, if not connecting via http>" \
--settings "<Dictionary of settings to communicate with the chroma server>" \
--tenant "<Tenant to use for this client>" \
--database "<Database to use for this client>" \
--host "<Hostname of the Chroma server>" \
--port "<Port of the Chroma server>" \
--ssl "<Whether to use SSL to connect to the Chroma server>" \
--headers "<Dictionary of headers to send to the Chroma server>" \
--collection-name "<Name of the Chroma collection to write into>" \
--batch-size "<Number of elements to be uploaded in a single batch, ie. 80>"