Management Commands

manage.py add_builtin_proxies applies the built-in Proxy manifests, in smarter/apps/proxy/data/proxy/. manage.py initialize_platform calls it after manage.py initialize_providers.

The built-in Proxies: one for each of the built-in LLM Providers that has an API key.

manage.py initialize_providers creates the built-in Providers, e.g. openai and anthropic, and their API key Secrets, from environment variables, e.g. OPENAI_API_KEY. manage.py add_builtin_proxies, which manage.py initialize_platform calls after it, applies a Proxy manifest for each of them, from smarter/apps/proxy/data/proxy. The Smarter admin owns them, so every account may use them.

A manifest is skipped if its Provider, or its API key Secret, does not exist, e.g. because the environment variable of its API key is not set.

class smarter.apps.proxy.builtins.BuiltinProxiesResult(applied=<factory>, skipped=<factory>, failed=<factory>)[source]

Bases: object

The outcome of add_builtin_proxies(): the names of the Proxies, by outcome.

__init__(applied=<factory>, skipped=<factory>, failed=<factory>)
applied: list[str]
failed: list[str]
skipped: list[str]
property success: bool
smarter.apps.proxy.builtins.add_builtin_proxies(user_profile=None, path='/Users/mcdaniel/Desktop/gh/smarter-sh/smarter/smarter/smarter/apps/proxy/data/proxy')[source]

Apply the built-in Proxy manifests, in data/proxy/, for a user.

A manifest whose Provider or Secret does not exist is skipped. One that fails to apply is logged, and the others are still applied.

Parameters:

user_profile (Optional[UserProfile]) – The owner. Defaults to the Smarter admin.

Return type:

BuiltinProxiesResult

Returns:

The names of the Proxies that were applied, skipped, and failed.

smarter.apps.proxy.builtins.builtin_manifest_files(path='/Users/mcdaniel/Desktop/gh/smarter-sh/smarter/smarter/smarter/apps/proxy/data/proxy')[source]

The built-in Proxy manifests’ files, in name order.

Return type:

list[str]

smarter.apps.proxy.builtins.builtin_proxies()[source]

The built-in Proxies: those that the Smarter admin owns, which every account may use.

Apply the built-in Proxy manifests: passthrough access to the built-in LLM Providers’ APIs.

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

Bases: SmarterCommand

Django manage.py add_builtin_proxies command.

Applies the Proxy manifests in smarter/apps/proxy/data/proxy, one for each built-in LLM Provider, e.g. openai and anthropic. Run it after manage.py initialize_providers, which creates the Providers and their API key Secrets: a manifest whose Provider or Secret does not exist, e.g. because the environment variable of its API key is not set, 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 Proxy manifests, in smarter/apps/proxy/data/proxy. Those whose Provider or API key Secret does not exist are skipped.'