Skip to main content

An UNofficial Python SDK and CLI for Vectara's RAG platform

It supports major features of Vectara's RAG platform for you to build your own search engine.

Additional features:

  • It expands the upload function to allow you to upload a list of files or all files under a directory in one function call.
  • Renders query results in beautiful Markdown printout.

Installation

# pip install from Github
pip install "git+https://github.com/forrestbao/vectara-python-cli.git"

Usage

Credentials

You can obtain the Vectara credentials following this guide. Then set up your Vectara credentials as environment variables.

export VECTARA_CUSTOMER_ID=123
export VECTARA_CLIENT_ID=abc
export VECTARA_CLIENT_SECRET=xyz

This unofficial SDK and CLI will read your credentials from the environment variables above. The ability to pass in credentials as arguments is also supported.

Python

Try the Jupyter notebook demo.ipynb or read the docstring.

from vectara import vectara

client = vectara() # get default credentials from environment variables 
                   # You can also manually pass in your credentials as arguments

corpus_id = client.create_corpus('my knowledge base')

client.upload(corpus_id, 'one_file.pdf', description='My precious doc')  # add one file to the corpus 
client.upload(corpus_id, 'a_folder_of_documents') # add all files under a folder to the corpus
client.upload(corpus_id, ['user_manual.md', 'notes.txt'], description=['user manual', 'my memory']) # add a list of files to the corpus

client.query(corpus_id, 'Vectara allows me to search for anything, right?', top_k=5) # query the corpus for top 5 answers

client.reset_corpus(corpus_id) # delete all documents in the corpus

Command line

To learn the command line usage, run vectara --help.

You must set up your Vectara credentials as environment variables before using the command line interface.

# create a corpus
vectara create_corpus 'my knowledge base'
# output: corpus_id = 12

# upload a file to the corpus
vectara upload 12 one_file.pdf # corpurs_id = 12

# upload a folder to the corpus
vectara upload 12 ./a_folder_of_documents # corpurs_id = 12

# query the corpus
vectara query 12 'Vectara allows me to search for anything, right?' --top_k=5  # corpurs_id = 12

# reset the corpus
vectara reset_corpus 12 # corpurs_id = 12

Beautiful Markdown printout

Questions

Contact forrest at vectara dot come

Disclaimer

This is an UNofficial SDK and CLI for Vectara's RAG platform. Use at your own risk. Vectara does NOT provide support for this SDK or CLI.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vectara-0.0.1.tar.gz (43.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vectara-0.0.1-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file vectara-0.0.1.tar.gz.

File metadata

  • Download URL: vectara-0.0.1.tar.gz
  • Upload date:
  • Size: 43.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for vectara-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2c189215de040c91b9e13af614f98d88a021df7473190287ddfffcf365e71310
MD5 e74ea87bc03926cd3f6df7c7d8ad470a
BLAKE2b-256 b16a4bb6b1ad2c942445b1a781aa6bd225e8693a7959e2518465638889619170

See more details on using hashes here.

File details

Details for the file vectara-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: vectara-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for vectara-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae781624ea30f96d1793e531b70b92c89589b00c9b23315764135e185b28ddb4
MD5 1472d3ce0279cc3f42acd093fff4dd9c
BLAKE2b-256 23b5e7a881a436d8533eb7a74b0b630116d2d308b77262483acd643773a1fd74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page