Management Commands

manage.py add_example_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_example_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_example_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_example_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 (UserProfile | None) – 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 example Proxy manifests: passthrough access to the built-in LLM Providers’ APIs.

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

Bases: SmarterExamplesCommand

Django manage.py add_example_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_examples(user_profile)[source]

Apply the example Proxies.

Every account may use the Smarter admin’s.

Return type:

list[str]

family: str = 'Proxy'

The resources’ name, for the command’s output, e.g. "Secret".

help = 'Apply the example Proxy manifests, in smarter/apps/proxy/data/proxy. Those whose Provider or API key Secret does not exist are skipped.'