Management Commands

Apply the built-in Vectorstore manifests: example vector databases, which every account may use.

class smarter.apps.vectorstore.management.commands.add_builtin_vectorstores.Command(*args, **kwargs)[source]

Bases: SmarterCommand

Django manage.py add_builtin_vectorstores command.

Applies the Vectorstore manifests in smarter/apps/vectorstore/data/vectorstores. They are not deployed. Run it after manage.py initialize_vectorstore_providers, which creates the ApiConnections of the managed services: a manifest whose Provider or ApiConnection does not exist is skipped.

add_arguments(parser)[source]

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)[source]

Handle the command execution.

help = 'Apply the built-in Vectorstore manifests, in smarter/apps/vectorstore/data/vectorstores. They are not deployed. Those whose Provider or ApiConnection does not exist are skipped.'

Create the ApiConnections of the managed vector database services: Pinecone, and Qdrant Cloud.

class smarter.apps.vectorstore.management.commands.initialize_vectorstore_providers.Command(*args, **kwargs)[source]

Bases: SmarterCommand

Django 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 ApiConnection pinecone.

  • Qdrant Cloud: QDRANT_CLOUD_URL and QDRANT_CLOUD_API_KEY. The ApiConnection qdrant_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.

Return type:

ApiConnection

handle(*args, **options)[source]

Handle the command execution.

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]
Return type:

None

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(*args, **kwargs)[source]

Bases: SmarterCommand

Django 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]

Entry point for subclassed commands to add custom arguments.

static files(path)[source]
Return type:

list[str]

handle(*args, **options)[source]

Handle the command execution.

help = 'Add a file, or a folder of files, e.g. PDFs, to a vectorstore, and load them.'