Vectara
Process all your records using unstructured-ingest
to store structured outputs locally on your filesystem and upload those to a Vectara corpus.
If you don’t yet have a Vectara account, [sign up](https://vectara.com/integrations/unstructured/) for your account.
Run Locally
The upstream connector can be any of the ones supported, but for convenience here, showing a sample command using the upstream local connector.
#!/usr/bin/env bash
unstructured-ingest \
local \
--input-path example-docs/book-war-and-peace-1225p.txt \
--output-dir local-output-to-vectara \
--strategy fast \
--chunk-elements \
--num-processes 2 \
--verbose \
vectara \
--customer-id "$VECTARA_CUSTOMER_ID" \
--oauth-client-id "$VECTARA_OAUTH_CLIENT_ID" \
--oauth-secret "$VECTARA_OAUTH_SECRET" \
--corpus-name "test-corpus-vectara"
import os
from unstructured.ingest.connector.local import SimpleLocalConfig
from unstructured.ingest.connector.vectara import (
SimpleVectaraConfig,
VectaraAccessConfig,
WriteConfig,
)
from unstructured.ingest.interfaces import (
PartitionConfig,
ProcessorConfig,
ReadConfig,
)
from unstructured.ingest.runner import LocalRunner
from unstructured.ingest.runner.writers.base_writer import Writer
from unstructured.ingest.runner.writers.vectara import (
VectaraWriter,
)
def get_writer() -> Writer:
return VectaraWriter(
connector_config=SimpleVectaraConfig(
access_config=VectaraAccessConfig(
oauth_client_id=os.getenv("VECTARA_OAUTH_CLIENT_ID"),
oauth_secret=os.getenv("VECTARA_OAUTH_SECRET"),
),
customer_id=os.getenv("VECTARA_CUSTOMER_ID"),
corpus_name="test-corpus-vectara",
),
write_config=WriteConfig(),
)
if __name__ == "__main__":
writer = get_writer()
runner = LocalRunner(
processor_config=ProcessorConfig(
verbose=True,
output_dir="local-output-to-vectara",
num_processes=2,
),
connector_config=SimpleLocalConfig(
input_path="example-docs/book-war-and-peace-1225p.txt",
),
read_config=ReadConfig(),
partition_config=PartitionConfig(),
# chunking_config=ChunkingConfig(chunk_elements=True),
writer=writer,
writer_kwargs={},
)
runner.run()
For a full list of the options the CLI accepts check unstructured-ingest <upstream connector> vectara --help
.
NOTE: Keep in mind that you will need to have all the appropriate extras and dependencies for the file types of the documents contained in your data storage platform if you’re running this locally. You can find more information about this in the installation guide.