2023-11-29 22:37:32 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Processes all the files from s3://utic-dev-tech-fixtures/small-pdf-set/,
|
|
|
|
# embeds the processed documents, and writes to results to a Pinecone index.
|
|
|
|
|
|
|
|
# Structured outputs are stored in s3-small-batch-output-to-pinecone/
|
|
|
|
|
2023-12-11 20:04:15 -05:00
|
|
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
2023-11-29 22:37:32 +00:00
|
|
|
cd "$SCRIPT_DIR"/../../.. || exit 1
|
|
|
|
|
|
|
|
# As an example we're using the s3 source connector,
|
|
|
|
# however ingesting from any supported source connector is possible.
|
|
|
|
# shellcheck disable=2094
|
|
|
|
PYTHONPATH=. ./unstructured/ingest/main.py \
|
2023-12-18 23:48:21 -08:00
|
|
|
local \
|
|
|
|
--input-path example-docs/book-war-and-peace-1225p.txt \
|
|
|
|
--output-dir local-to-pinecone \
|
|
|
|
--strategy fast \
|
2024-05-21 13:01:49 -04:00
|
|
|
--chunking-strategy by_title \
|
2023-12-18 23:48:21 -08:00
|
|
|
--embedding-provider "<an unstructured embedding provider, ie. langchain-huggingface>" \
|
|
|
|
--num-processes 2 \
|
|
|
|
--verbose \
|
|
|
|
--work-dir "<directory for intermediate outputs to be saved>" \
|
|
|
|
pinecone \
|
|
|
|
--api-key "<Pinecone API Key to write into a Pinecone index>" \
|
|
|
|
--index-name "<Pinecone index name, ie: ingest-test>" \
|
|
|
|
--environment "<Pinecone index name, ie: ingest-test>" \
|
|
|
|
--batch-size "<Number of elements to be uploaded per batch, ie. 80>" \
|
|
|
|
--num-processes "<Number of processes to be used to upload, ie. 2>"
|