DRF Serializers

LLMClient serializers.

class smarter.apps.llmclient.serializers.LLMClientAPIKeySerializer(*args, **kwargs)[source]

Bases: SmarterCamelCaseSerializer

An api key of an LLMClient.

api_key is the SmarterAuthToken’s public key_id. The token’s primary key is its digest, a hash of the key, which the api never returns.

get_fields()[source]

Return the dict of field names -> field instances that should be used for self.fields when instantiating the serializer.

class smarter.apps.llmclient.serializers.LLMClientConfigSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer for the smarter.apps.prompt.views.PromptConfigView which should not be camelCased.

get_default_system_role(obj)[source]
get_fields()[source]

Return the dict of field names -> field instances that should be used for self.fields when instantiating the serializer.

class smarter.apps.llmclient.serializers.LLMClientCustomDomainListSerializer(*args, **kwargs)[source]

Bases: MetaDataWithOwnershipModelSerializer

A custom domain: the resource’s metadata and owner, the domain, the llmclient that it serves, and its DNS records.

Used by the Custom Domain list in the web console, and by the CustomDomain broker’s get.

get_dns_records(obj)[source]
get_llmclient(obj)[source]

The llmclient that the domain serves, or None if no llmclient uses it.

get_manifest_url(obj)[source]

The URL of the custom domain’s detail view, which renders its manifest.

Return type:

str

class smarter.apps.llmclient.serializers.LLMClientCustomDomainSerializer(*args, **kwargs)[source]

Bases: SmarterCamelCaseSerializer

get_fields()[source]

Return the dict of field names -> field instances that should be used for self.fields when instantiating the serializer.

class smarter.apps.llmclient.serializers.LLMClientFunctionsSerializer(*args, **kwargs)[source]

Bases: SmarterCamelCaseSerializer

get_fields()[source]

Return the dict of field names -> field instances that should be used for self.fields when instantiating the serializer.

class smarter.apps.llmclient.serializers.LLMClientGuardrailMiniSerializer(*args, **kwargs)[source]

Bases: SmarterCamelCaseSerializer

A Guardrail of an LLMClient: the link’s id, and the Guardrail’s name.

class smarter.apps.llmclient.serializers.LLMClientMCPClientMiniSerializer(*args, **kwargs)[source]

Bases: SmarterCamelCaseSerializer

An MCPClient of an LLMClient: the link’s id, and the MCPClient’s name.

class smarter.apps.llmclient.serializers.LLMClientPluginMiniSerializer(*args, **kwargs)[source]

Bases: SmarterCamelCaseSerializer

class smarter.apps.llmclient.serializers.LLMClientPluginSerializer(*args, **kwargs)[source]

Bases: SmarterCamelCaseSerializer

get_fields()[source]

Return the dict of field names -> field instances that should be used for self.fields when instantiating the serializer.

class smarter.apps.llmclient.serializers.LLMClientRequestsSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer for the LLMClientRequests model.

class smarter.apps.llmclient.serializers.LLMClientSerializer(*args, **kwargs)[source]

Bases: MetaDataWithOwnershipModelSerializer

get_api_keys(obj)[source]
get_base_api_domain(obj)[source]
get_base_default_host(obj)[source]
get_custom_domains(obj)[source]
get_custom_host(obj)[source]
get_custom_url(obj)[source]
get_default_host(obj)[source]
get_default_system_role(obj)[source]
get_default_url(obj)[source]
get_fields()[source]

Return the dict of field names -> field instances that should be used for self.fields when instantiating the serializer.

get_functions(obj)[source]
get_guardrails(obj)[source]
get_hashed_id(obj)[source]
get_hostname(obj)[source]
get_is_authentication_required(obj)[source]
get_manifest_url(obj)[source]
get_mcpclients(obj)[source]
get_plugins(obj)[source]
get_ready(obj)[source]
get_rfc1034_compliant_name(obj)[source]
get_sandbox_host(obj)[source]
get_sandbox_url(obj)[source]
get_tools(obj)[source]

Everything that the LLMClient adds to a prompt: its functions, plugins, MCPClients and guardrails.

Parameters:

obj (LLMClient) – The LLMClient.

Returns:

One {"id", "name", "kind"} per function, plugin, MCPClient and guardrail, in that order. id is the link row’s id, and kind is Function or the linked resource’s manifest kind.

Return type:

list[dict]

get_url(obj)[source]
get_url_chat_config(obj)[source]
get_url_chatapp(obj)[source]
get_url_llmclient(obj)[source]