Management Commands
Initialize 3rd party providers.
- class smarter.apps.provider.management.commands.initialize_providers.Command(*args, **kwargs)[source]
Bases:
SmarterCommandDjango manage.py initialize_providers.py command.
Used to create/update the principal Providers that are preloaded on all platforms. Creates/updates the API key Secret, the Provider, and the ProviderModels for each provider. The following providers are initialized:
Anthropic
Cohere
Fireworks
Google Service Account
Google AI
Google Maps
Meta AI
Mistral
OpenAI
TogetherIA
This is called indirectly by initialize_platform and runs during automated deployment.
- initialize_generic_provider(api_key_env_var, name, provider_configuration, logo_filename, provider_api_url)[source]
Initialize a provider and its models.
create/update api key secret
create/update provider
create/update provider models
- initialize_google_service_account()[source]
Initialize Google service account credentials.
A Google service account is a special identity that allows an application, rather than a person, to securely authenticate with Google APIs and services. It uses cryptographic credentials to prove its identity and obtain temporary access tokens without requiring a user to log in. The service account can only perform the actions that have been explicitly granted to it through Google Cloud IAM permissions.
Example service account JSON structure:
service_account_json = { "type": "service_account", "project_id": "smarter-sh", "private_key_id": "65fc3e5bd38b1234567890676f6d6abcdefghijk", "private_key": "PRIVATE-KEY-DATA", "client_email": "smarter-gemini-initializer@smarter-sh.iam.gserviceaccount.com", "client_id": "104887368144732193269", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/smarter-gemini-initializer%40smarter-sh.iam.gserviceaccount.com", "universe_domain": "googleapis.com" } service_account_b64 = base64.b64encode(json.dumps(service_account_json).encode("utf-8")).decode("ascii") print(service_account_b64)
- user_profile: UserProfile