Management Commands
Create the ApiConnections of the managed vector database services: Pinecone, and Qdrant Cloud.
- class smarter.apps.vectorstore.management.commands.initialize_vectorstore_providers.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]
Bases:
SmarterCommandDjango manage.py initialize_vectorstore_providers command.
For each managed vector database service whose environment variables are set, it creates, or updates, a Secret with its API key, and an ApiConnection, owned by the Smarter admin, which the built-in Vectorstore manifests use:
Pinecone:
PINECONE_API_KEY. The ApiConnectionpinecone.Qdrant Cloud:
QDRANT_CLOUD_URLandQDRANT_CLOUD_API_KEY. The ApiConnectionqdrant_cloud.
A self-hosted Qdrant database needs neither: Smarter runs it, and generates its API key.
- connection(user_profile, name, base_url, secret_name, api_key, description)[source]
Create or update a Secret with an API key, and an ApiConnection that uses it.
- Parameters:
- Return type:
ApiConnection- Returns:
The ApiConnection.
- handle(*args, **options)[source]
Create the ApiConnections of Pinecone and Qdrant Cloud, skipping each whose environment is not set.
- Parameters:
args – Unused.
options – Unused.
- help = 'Create the ApiConnections of Pinecone and Qdrant Cloud, from PINECONE_API_KEY, QDRANT_CLOUD_URL and QDRANT_CLOUD_API_KEY.'
- initialize(user_profile, name, url, api_key_var, secret_name, description)[source]
Create the ApiConnection of a provider, if its API key’s environment variable and url are set.
- Parameters:
user_profile (
UserProfile) – The owner, the platform’s admin.name (
str) – The ApiConnection’s name.api_key_var (
str) – The name of the environment variable with the API key.secret_name (
str) – The name of the Secret that holds the API key.description (
str) – The provider’s name, e.g.Pinecone.
- Return type:
Add local files, e.g. a folder of PDFs, to a vectorstore, and load them.
- class smarter.apps.vectorstore.management.commands.load_vectorstore_documents.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]
Bases:
SmarterCommandDjango manage.py load_vectorstore_documents command.
Adds a file, or every supported file in a folder and its subfolders, to a vectorstore: PDF, text, Markdown, CSV, JSON, YAML and HTML. Files whose text is already in the vectorstore are skipped. They are loaded by Celery, or now, with
--now.python manage.py load_vectorstore_documents --name example_knowledge_base --path /data/manuals- add_arguments(parser)[source]
Add the command’s options: the vectorstore, the path, the owner, and whether to load now.
- Parameters:
parser – The command’s argument parser.
- handle(*args, **options)[source]
Add each file to the vectorstore, and load it now, with
--now, or queue its Celery task.A file that is already in the vectorstore is skipped. Nothing is loaded until the vectorstore is ready.
- Parameters:
args – Unused.
options – The command’s options, see
add_arguments().
- help = 'Add a file, or a folder of files, e.g. PDFs, to a vectorstore, and load them.'