CLI application for accessing Vantage API. Application is implemented using Python, and Vantage Python SDK.
CLI supports all of the Vantage API endpoints: account management, collections management, search, and API keys management.
Grab latest binary from our releases page, and extract it into your PATH.
- Clone this repository using git, or download and unpack ZIP file.
- Create virtual environment to build the binary [Optional]
- Run
poetry install --all-extras
in the root of the directory - Deactivate and activate your virtual environment [Optional]
- Run
pyinstaller -F vantage_cli/vantage.py
Binary named vantage
will be built in the dist
directory. Copy it into your PATH.
It is recommended to use a binary, but if for whatever reason you need to use this software from source, you can do it in following way.
- Clone this repository using git, or download and unpack ZIP file.
- Ensure that you have
Python 3.10
, andpoetry
tool installed, either locally, or use virtual environment. - Run
poetry install
in the root of the cli directory. - Run
python vantage_cli/vantage.py
from the root directory.
If running for the first time, CLI will ask you a few questions to create initial configuration file, and then show help.
Generally, CLI usage is like following:
vantage [GENRAL_OPTIONS] command [COMMAND_OPTIONS] [COMMAND_ARGUMENTS]
For example:
vantage -o csv -a example-account create-collection --collection-id example --collection-name "My example collection" --embeddings-dimension 1536 --use-provided-embeddings true
Run vantage --help
to show available options and commands.
Each command has specific help available, run vantage command --help
to get help for each one of them
For example, running:
vantage create-collection-openai --help
Will output following help text:
Usage: vantage create-collection-openai [OPTIONS]
Creates a new OpenAI collection.
Options:
--collection-id TEXT ID for the new collection. [required]
--collection-name TEXT Name for the new collection. [required]
--llm-secret TEXT OpenAI account secret key.
--llm-model-name TEXT OpenAI LLM model name.
--external-account-id TEXT OpenAI account key ID from Vantage Console.
--secondary-external-account-id TEXT
Secondary external LLM account key ID.
--collection-preview-url-pattern TEXT
URL pattern for previewing items in the
collection.
--embeddings-dimension INTEGER Dimension of the embeddings stored in the
collection.
--help Show this message and exit.
When running Vantage CLI with -d
switch, it will print out debug messages to STDERR, which can be useful when troubleshooting issues.
For example, vantage -d list-collections
will output something like this:
[2024-05-23 15:49:02] DEBUG [vantage.vantage.cli:228] Invoked command list-collections
[2024-05-23 15:49:02] DEBUG [vantage.vantage.cli:229] Using API host: https://api.vanta.ge
[2024-05-23 15:49:02] DEBUG [vantage.vantage.cli:230] Using account ID: test
[2024-05-23 15:49:02] DEBUG [vantage.vantage.cli:235] Creating client using API key: $2a$********************************************************
[2024-05-23 15:49:02] DEBUG [vantage.collections.list_collections:34] Listing collections...
[
{
"collection_id": "test-collection",
"embeddings_dimension": 1536,
"user_provided_embeddings": false,
"collection_name": "test-collection",
"collection_state": "Active",
"collection_status": "Online",
"collection_created_time": "2024-03-06T10:53:07",
"collection_preview_url_pattern": "test/test-collection"
}
]
In case that something goes wrong when running a command, using debug switch will print more details about error that occurred, including stacktrace.
Configuration file location depends on OS you are using. Most commonly locations are:
Windows: C:\Users\user\AppData\Local\vantage-cli\config.ini
Mac OS: /Users/user/Library/Application Support/vantage-cli/config.ini
Linux/BSD/Other Unix: /home/user/.config/vantage-cli/config.ini
Configuration is stored as .ini
file:
[general]
client_id = <client id>
client_secret = <client secret>
[general.search]
vantage_api_key = <API key>
If no configuration file is present, CLI will ask you for M2M credentials, and API key, as a minimum. All of these parameters can be overridden using CLI options at runtime.
Options in the configuration file have the same name as runtime options, except that dash is replaced by underscore:
vantage --account-id example
Will translate to configuration like this:
[general]
account_id = example
general section contains options passed to the CLI at runtime. You can see the available options by running ./vantage.py --help
.
general.search section contains options common to all of the search commands.
For example, setting accuracy
parameter in this section, will set it as common for all of the search commands:
[general.search]
accuracy = 0.4
When running any of the search commands, for example:
vantage semantic-search --collection-id example-collection lamp
It will be the same as you've ran:
vantage semantic-search --collection-id example-collection --accuracy 0.4 lamp
Note that you can override options from
general.search
section by adding new section for a specific search command, with the overriden option:
[general.search]
accuracy = 0.4
[more-like-this-search]
accuracy = 0.3 # This will override the value above
It is possible to set default values in configuration file for all of the other commands.
For example, setting default --items-per-page
for semantic-search
command would look like this:
[semantic-search]
items_per_page = 20
Note that when specifying command section, dash in the command name will not get converted to underscore, as when specifying options.