Models

smarter.models.base

The base classes of the SDK’s response models.

Every model allows extra fields. The Smarter platform adds fields to its responses in minor releases, and an SDK that rejected them would break whenever the platform is upgraded. Extra fields are kept, and are available as attributes and in SmarterModel.to_dict().

class smarter.models.base.SmarterAccountRef(*, accountNumber: str, **extra_data: Any)[source]

Bases: SmarterCamelModel

The account of a resource’s owner.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.base.SmarterCamelModel(**extra_data: Any)[source]

Bases: SmarterModel

A model of a response whose field names are camelCase, e.g. hashedId.

Its attributes are snake_case (hashed_id), and it accepts either spelling.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.base.SmarterModel(**extra_data: Any)[source]

Bases: BaseModel

The base class of the SDK’s models: a Pydantic model that keeps unknown fields.

Pydantic’s model_ namespace isn’t protected, because the api has fields such as an LLMHost’s modelTask, which older Pydantic versions would warn about.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_dict() → dict[str, Any][source]

The model as a JSON-compatible dict, with the api’s own field names.

Returns:

The fields that the api returned, or that were set.

to_json(indent: int | None = 2) → str[source]

The model as JSON text, with the api’s own field names.

Parameters:

indent – The indentation, or None for compact JSON.

Returns:

The JSON text.

class smarter.models.base.SmarterOwner(*, user: SmarterUserRef | None = None, account: SmarterAccountRef | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

The owner of a resource: its user profile, as the user and the account.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.base.SmarterResource(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, JsonValue]] = [], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

The fields that every Smarter resource shares, as the REST api returns them.

The api’s resources are Django rows with the same metadata as a manifest’s metadata: a name, description, version, tags and annotations. Each resource’s model adds its own fields.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.base.SmarterUserRef(*, username: str, email: str | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

The user of a resource’s owner.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

smarter.models.manifest

Models of Smarter Application Manifests (SAM): the YAML documents that declare every Smarter resource.

A manifest has the same four sections as a Kubernetes manifest: apiVersion, kind, metadata and spec. describe adds a read-only status. The shape of spec depends on the kind and the platform’s version, so it is a JSON object here. The platform publishes the complete JSON Schema of each kind: see smarter.resources.manifests.Manifests.json_schema().

class smarter.models.manifest.KindInfo(*, Singular: str, Plural: str, APIKind: str, Display: str | None = None, DisplayPlural: str | None = None, Deployable: bool = False, **extra_data: Any)[source]

Bases: SmarterCamelModel

A resource kind that the platform supports, as /api/v1/cli/resources/ describes it.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.manifest.Manifest(*, apiVersion: str = 'smarter.sh/v1', kind: str, metadata: ManifestMetadata, spec: dict[str, ~pydantic.types.JsonValue]=<factory>, status: dict[str, ~pydantic.types.JsonValue] | None=None, **extra_data: Any)[source]

Bases: SmarterModel

A Smarter Application Manifest.

manifest = Manifest.from_yaml(open("llmclient.yaml").read())
manifest.metadata.name
manifest.spec["config"]["provider"]
classmethod from_yaml(text: str) → Manifest[source]

Parse a manifest from YAML (or JSON) text.

Parameters:

text – The manifest’s text.

Returns:

The manifest.

Raises:

SmarterValueError – If the text is not a YAML object.

classmethod from_file(path: str | Path) → Manifest[source]

Read a manifest from a YAML or JSON file.

Parameters:

path – The file’s path.

Returns:

The manifest.

to_sam() → SAMModel[source]

The manifest as its kind’s typed SAM model, e.g. a SAMGuardrail.

guardrail = client.guardrails.describe("pii_redactor").to_sam()
print(guardrail.spec.config.action)
Returns:

The typed manifest.

Raises:
  • SmarterValueError – If the SDK has no model of the manifest’s kind.

  • pydantic.ValidationError – If the manifest does not match its kind’s model.

to_yaml() → str[source]

The manifest as YAML text, without its read-only status, ready to apply.

Returns:

The YAML text.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.manifest.ManifestList(*, apiVersion: str = 'smarter.sh/v1', kind: str, name: str | None = None, metadata: ManifestListMetadata = <factory>, data: ManifestListData = <factory>, **extra_data: Any)[source]

Bases: SmarterModel

The result of get: the resources of one kind, as a table.

data.items are the rows, and data.titles their columns. The columns depend on the kind.

property items: list[dict[str, JsonValue]]

The rows.

property names: list[str]

The names of the resources: each row’s name, or its username for the User kind.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.manifest.ManifestListData(*, titles: list[ManifestListTitle] = [], items: list[dict[str, JsonValue]] = [], **extra_data: Any)[source]

Bases: SmarterModel

The table of a get result.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.manifest.ManifestListMetadata(*, count: int = 0, **extra_data: Any)[source]

Bases: SmarterModel

The metadata of a get result.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.manifest.ManifestListTitle(*, name: str, type: str, **extra_data: Any)[source]

Bases: SmarterModel

A column of a get result: the field’s name, and its Django field type.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.manifest.ManifestMetadata(*, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, ~pydantic.types.JsonValue]]=<factory>, **extra_data: Any)[source]

Bases: SmarterModel

A manifest’s metadata: the resource’s name, and descriptive information about it.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

smarter.models.manifest.SMARTER_API_VERSION = 'smarter.sh/v1'

The apiVersion of every Smarter manifest.

smarter.models.platform

Models of the platform’s own endpoints: whoami, version and status.

class smarter.models.platform.ApiVersion(*, version: str, python: dict[str, str | None]=<factory>, **extra_data: Any)[source]

Bases: SmarterModel

The platform’s version, and the versions of its main Python packages.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.platform.CliVersion(*, version: str | None = None, **extra_data: Any)[source]

Bases: SmarterModel

The version of the smarter cli that the platform recommends.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.platform.PlatformStatus(*, infrastructures: dict[str, ~pydantic.types.JsonValue]=<factory>, compute: dict[str, ~pydantic.types.JsonValue]=<factory>, **extra_data: Any)[source]

Bases: SmarterCamelModel

The response of status: the state of the platform’s infrastructure and compute.

The sections’ contents depend on how the platform is hosted, so they are JSON objects.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.platform.PlatformVersion(*, api: ApiVersion, cli: CliVersion | None = None, **extra_data: Any)[source]

Bases: SmarterModel

The response of version.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.platform.WhoAmI(*, user: User, account: Account, environment: str | None = None, **extra_data: Any)[source]

Bases: SmarterModel

The owner of the api key: the user, their account, and the platform’s environment.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

smarter.models.account

Models of accounts, users, user profiles and account contacts, as /api/v1/accounts/ returns them.

class smarter.models.account.Account(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, JsonValue]] = [], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, accountNumber: str, isDefaultAccount: bool | None = None, companyName: str | None = None, phoneNumber: str | None = None, address1: str | None = None, address2: str | None = None, city: str | None = None, state: str | None = None, postalCode: str | None = None, country: str | None = None, language: str | None = None, timezone: str | None = None, currency: str | None = None, isActive: bool | None = None, **extra_data: Any)[source]

Bases: SmarterResource

A Smarter account: the tenant that owns users and resources.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.account.AccountContact(*, id: int, account: SmarterAccountRef | None = None, createdAt: datetime | None = None, updatedAt: datetime | None = None, firstName: str | None = None, lastName: str | None = None, email: str | None = None, phone: str | None = None, isPrimary: bool | None = None, isTest: bool | None = None, welcomed: bool | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A contact of an account, who receives its notices.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.account.User(*, id: int, username: str, firstName: str | None = None, lastName: str | None = None, email: str | None = None, isStaff: bool | None = None, isSuperuser: bool | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A user of the platform.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.account.UserProfile(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, JsonValue]] = [], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, user: User, account: SmarterAccountRef, profileImage: str | None = None, profileImageUrl: str | None = None, isTest: bool | None = None, **extra_data: Any)[source]

Bases: SmarterResource

A user’s membership of an account, which owns the resources that the user creates in it.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

smarter.models.llmclient

Models of LLMClients and their plugins, MCPClients, guardrails, extensions, api keys and custom domains.

class smarter.models.llmclient.LLMClient(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, ~pydantic.types.JsonValue]]=[], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, rfc1034CompliantName: str | None = None, provider: str | None = None, defaultModel: str | None = None, defaultSystemRole: str | None = None, deployed: bool | None = None, defaultHost: str | None = None, defaultUrl: str | None = None, customHost: str | None = None, customUrl: str | None = None, sandboxHost: str | None = None, sandboxUrl: str | None = None, urlLlmclient: str | None = None, urlChatConfig: str | None = None, isAuthenticationRequired: bool | None = None, extensions: list[LLMClientExtension] = [], plugins: list[LLMClientPluginRef] = [], mcpclients: list[LLMClientMCPClientRef] = [], guardrails: list[LLMClientGuardrailRef] = [], tools: list[LLMClientTool] = <factory>, apiKeys: list[LLMClientApiKey] = [], customDomains: list[LLMClientCustomDomain] = [], **extra_data: Any)[source]

Bases: SmarterResource

An LLMClient: a deployable AI agent, built from an LLM provider and model, a system prompt, plugins and extensions.

Prompt it with smarter.resources.llmclients.LLMClients.prompt(), or start a chat with smarter.resources.llmclients.LLMClients.chat().

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmclient.LLMClientApiKey(*, id: int, llmclient: int | None = None, apiKey: str | None = None, createdAt: datetime | None = None, updatedAt: datetime | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

An api key that may call an LLMClient that requires authentication.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmclient.LLMClientCustomDomain(*, id: int, name: str | None = None, description: str | None = None, version: str | None = None, domainName: str | None = None, verificationStatus: str | None = None, verifiedAt: datetime | None = None, verificationMessage: str | None = None, userProfile: int | None = None, createdAt: datetime | None = None, updatedAt: datetime | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A custom domain on which an LLMClient is deployed: the domain itself, and its verification.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmclient.LLMClientExtension(*, id: int, name: str | None = None, extension: int | None = None, llmclient: int | None = None, createdAt: datetime | None = None, updatedAt: datetime | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

An extension of an LLMClient, whose tools the LLMClient offers the LLM, e.g. calculator.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmclient.LLMClientGuardrailRef(*, id: int, name: str | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A guardrail of an LLMClient, by the link’s id and the guardrail’s name.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmclient.LLMClientMCPClientRef(*, id: int, name: str | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

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

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmclient.LLMClientPlugin(*, id: int, pluginMeta: Plugin, llmclient: int | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

The association of a plugin with an LLMClient.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmclient.LLMClientPluginRef(*, id: int, name: str | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A plugin of an LLMClient, by its id and name.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmclient.LLMClientTool(*, id: int, name: str, kind: str, **extra_data: Any)[source]

Bases: SmarterCamelModel

Something that an LLMClient adds to a prompt: an extension, plugin, MCPClient or guardrail.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

smarter.models.plugin

Models of plugins: the tools that an LLMClient’s LLM can call.

class smarter.models.plugin.Plugin(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, JsonValue]] = [], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, pluginClass: str | None = None, kind: str | None = None, **extra_data: Any)[source]

Bases: SmarterResource

A plugin’s metadata.

Its kind is the manifest kind, e.g. ApiPlugin or SqlPlugin, and its plugin_class the implementation: api, skill, sql, static, websearch or imagesearch.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

smarter.models.guardrail

Models of guardrails, their evaluations, and their events.

class smarter.models.guardrail.Guardrail(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, JsonValue]] = [], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, stage: str | None = None, category: str | None = None, strategy: str | None = None, pattern: str | None = None, config: dict[str, JsonValue] | None = None, threshold: float | None = None, action: str | None = None, replacement: str | None = None, message: str | None = None, severity: int | None = None, mode: str | None = None, failClosed: bool | None = None, priority: int | None = None, isActive: bool | None = None, **extra_data: Any)[source]

Bases: SmarterResource

A guardrail: a check that the platform runs on prompts (input) or on the LLM’s replies (output).

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.guardrail.GuardrailEvaluation(*, guardrail: str, stage: str, triggered: bool, disposition: str | None = None, text: str | None = None, message: str | None = None, error: str | None = None, durationMs: float | None = None, findings: list[GuardrailFinding] = [], **extra_data: Any)[source]

Bases: SmarterCamelModel

The result of a guardrail’s dry run on a text.

Nothing is saved: an evaluation does not create an event.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.guardrail.GuardrailEvent(*, id: int, createdAt: datetime | None = None, llmclient: str | None = None, stage: str | None = None, disposition: str | None = None, reviewed: bool | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A guardrail’s finding in a real prompt, saved for review.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.guardrail.GuardrailEvents(*, guardrail: str, events: list[GuardrailEvent] = [], **extra_data: Any)[source]

Bases: SmarterModel

The latest events of a guardrail.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.guardrail.GuardrailFinding(*, confidence: float | None = None, rationale: str | None = None, matches: list[GuardrailMatch] = [], **extra_data: Any)[source]

Bases: SmarterModel

One finding of a guardrail evaluation.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.guardrail.GuardrailMatch(*, start: int, end: int, text: str, label: str | None = None, **extra_data: Any)[source]

Bases: SmarterModel

A span of the text that a guardrail matched.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

smarter.models.mcpclient

Models of MCPClients: connections to Model Context Protocol servers, whose tools an LLMClient’s LLM can call.

class smarter.models.mcpclient.MCPClient(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, ~pydantic.types.JsonValue]]=[], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, transport: str | None = None, endpointUrl: str | None = None, command: str | None = None, timeout: int | None = None, authType: str | None = None, allowedTools: list[str] = [], allowedResources: list[str] = [], includeInstructions: bool | None = None, cacheTtl: int | None = None, isActive: bool | None = None, status: str | None = None, priority: int | None = None, protocolVersion: str | None = None, serverName: str | None = None, serverVersion: str | None = None, tools: list[str] = <factory>, lastConnectedAt: datetime | None = None, lastError: str | None = None, **extra_data: Any)[source]

Bases: SmarterResource

An MCPClient: an MCP server, how to reach it, and which of its tools the LLM may call.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.mcpclient.MCPClientStatus(*, name: str, status: str | None = None, protocolVersion: str | None = None, serverName: str | None = None, serverVersion: str | None = None, lastConnected: datetime | None = None, lastError: str | None = None, error: str | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

The connection state of an MCPClient.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.mcpclient.MCPClientTools(*, name: str, status: str | None = None, protocolVersion: str | None = None, serverName: str | None = None, serverVersion: str | None = None, lastConnected: datetime | None = None, lastError: str | None = None, error: str | None = None, instructions: str | None = None, tools: list[MCPTool] = [], **extra_data: Any)[source]

Bases: MCPClientStatus

An MCPClient’s allowed tools, and the server’s instructions.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.mcpclient.MCPTool(*, name: str, title: str | None = None, description: str | None = None, inputSchema: dict[str, JsonValue] | None = None, readOnly: bool | None = None, destructive: bool | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A tool of an MCP server, which the MCPClient allows the LLM to call.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.mcpclient.MCPToolResult(*, name: str, tool: str, isError: bool = False, content: str | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

The result of a tool call.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

smarter.models.vectorstore

Models of vectorstores, their documents and snapshots, and search results.

class smarter.models.vectorstore.Vectorstore(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, JsonValue]] = [], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, backend: str | None = None, hosting: str | None = None, isActive: bool | None = None, dimension: int | None = None, metric: str | None = None, embeddingsProvider: str | None = None, embeddingsModel: str | None = None, status: str | None = None, statusMessage: str | None = None, indexName: str | None = None, endpointUrl: str | None = None, vectorCount: int | None = None, documentCount: int | None = None, snapshotCount: int | None = None, spec: dict[str, JsonValue] | None = None, deployedAt: datetime | None = None, **extra_data: Any)[source]

Bases: SmarterResource

A vectorstore: a vector database, hosted by Smarter or by a provider, for retrieval-augmented generation.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.vectorstore.VectorstoreDocument(*, id: int, name: str, createdAt: datetime | None = None, updatedAt: datetime | None = None, source: str | None = None, contentType: str | None = None, status: str | None = None, chunkCount: int | None = None, metadata: dict[str, JsonValue] | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A document of a vectorstore: a file, a text or a url, split into chunks and embedded.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.vectorstore.VectorstoreDocumentDeleted(*, document: str, status: str, **extra_data: Any)[source]

Bases: SmarterCamelModel

A document that is being deleted, with its chunks.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.vectorstore.VectorstoreDocuments(*, documents: list[VectorstoreDocument] = [], **extra_data: Any)[source]

Bases: SmarterCamelModel

A vectorstore’s documents.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.vectorstore.VectorstoreDocumentsAdded(*, documents: list[VectorstoreDocument] = [], duplicates: list[VectorstoreDocument] = <factory>, queued: bool = False, message: str | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

The result of adding documents.

Documents are loaded asynchronously, and only once the vectorstore is deployed: see queued.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.vectorstore.VectorstoreRestored(*, vectorstore: str, restored: str, vectorCount: int | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

The result of restoring a snapshot.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.vectorstore.VectorstoreSearchResult(*, id: JsonValue | None = None, text: str, metadata: dict[str, JsonValue] | None = None, score: float | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A chunk that matched a search.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.vectorstore.VectorstoreSearchResults(*, vectorstore: str, results: list[VectorstoreSearchResult] = [], **extra_data: Any)[source]

Bases: SmarterCamelModel

The chunks that matched a search, best first.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.vectorstore.VectorstoreSnapshot(*, id: int, name: str | None = None, createdAt: datetime | None = None, status: str | None = None, scheduled: bool | None = None, sizeBytes: int | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A snapshot of a vectorstore’s data.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.vectorstore.VectorstoreSnapshots(*, snapshots: list[VectorstoreSnapshot] = [], **extra_data: Any)[source]

Bases: SmarterCamelModel

A vectorstore’s snapshots.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.vectorstore.VectorstoreStatus(*, vectorstore: str, status: str, message: str | None = None, vectorCount: int | None = None, stats: dict[str, JsonValue] = {}, **extra_data: Any)[source]

Bases: SmarterCamelModel

A vectorstore’s state, checked now.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

smarter.models.llmhost

Models of LLMHosts: open-weight models that Smarter serves on its own Kubernetes cluster.

class smarter.models.llmhost.DiscoveredManifest(*, manifest: dict[str, JsonValue], **extra_data: Any)[source]

Bases: SmarterModel

The response of discover/manifest/: a drafted LLMHost manifest.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmhost.DiscoveredModel(*, catalog: str | None = None, source: str | None = None, repository: str, task: str | None = None, description: str | None = None, license: str | None = None, gated: bool | None = None, downloads: int | None = None, likes: int | None = None, tags: list[str] = [], manifest: dict[str, JsonValue] | None = None, **extra_data: Any)[source]

Bases: SmarterModel

A model found in a public catalog, e.g. Hugging Face, with the LLMHost manifest that would serve it.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmhost.DiscoveredModels(*, models: list[DiscoveredModel] = [], **extra_data: Any)[source]

Bases: SmarterModel

The models that a catalog search found.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmhost.LLMHost(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, JsonValue]] = [], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, spec: dict[str, JsonValue] | None = None, modelSource: str | None = None, modelRepository: str | None = None, modelRevision: str | None = None, modelTask: str | None = None, inferenceEngine: str | None = None, apiFormat: str | None = None, compute: int | None = None, gpuCount: int | None = None, gpuType: str | None = None, replicas: int | None = None, readyReplicas: int | None = None, status: str | None = None, statusMessage: str | None = None, endpointUrl: str | None = None, publicUrl: str | None = None, servedModelName: str | None = None, isActive: bool | None = None, deployedAt: datetime | None = None, costPerHour: str | None = None, **extra_data: Any)[source]

Bases: SmarterResource

An LLMHost: a model, the inference engine that serves it, and the compute it runs on.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmhost.LLMHostLogs(*, llmhost: str, logs: JsonValue = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

The latest log lines of an LLMHost’s pods.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmhost.LLMHostPlan(*, llmhost: str, resources: list[dict[str, JsonValue]] = [], **extra_data: Any)[source]

Bases: SmarterCamelModel

The Kubernetes resources that deploying an LLMHost would create, without creating them.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmhost.LLMHostReport(*, totals: dict[str, JsonValue] = {}, byStatus: dict[str, int] = {}, byEngine: dict[str, int] = {}, llmhosts: list[dict[str, JsonValue]] = [], **extra_data: Any)[source]

Bases: SmarterCamelModel

A report of every LLMHost that the user may read: counts, and estimated costs.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.llmhost.LLMHostStatus(*, llmhost: str, status: str, message: str | None = None, replicas: int | None = None, readyReplicas: int | None = None, healthy: bool | None = None, endpoint: str | None = None, publicUrl: str | None = None, pods: list[dict[str, JsonValue]] = [], checkedAt: datetime | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

An LLMHost’s state, read from Kubernetes now.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

smarter.models.misc

Models of secrets, prompt history, proxies, orchestrators and vectorsearches.

class smarter.models.misc.Orchestrator(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, ~pydantic.types.JsonValue]]=[], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, strategy: str | None = None, maxIterations: int | None = None, isActive: bool | None = None, llmclients: list[int] = <factory>, **extra_data: Any)[source]

Bases: SmarterResource

An orchestrator: a multi-agent workflow that composes LLMClients.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.misc.PromptPluginUsage(*, id: int, prompt: PromptSession | int | None = None, created_at: datetime | None = None, updated_at: datetime | None = None, plugin: Plugin | None = None, input_text: str | None = None, **extra_data: Any)[source]

Bases: SmarterModel

A use of a plugin in a chat session.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.misc.PromptSession(*, id: int, created_at: datetime | None = None, updated_at: datetime | None = None, name: str | None = None, description: str | None = None, session_key: str | None = None, ip_address: str | None = None, user_agent: str | None = None, url: str | None = None, user_profile: int | None = None, llmclient: int | None = None, **extra_data: Any)[source]

Bases: SmarterModel

A chat session: one conversation with an LLMClient, by its session key.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.misc.PromptToolCall(*, id: int, prompt: PromptSession | int | None = None, created_at: datetime | None = None, updated_at: datetime | None = None, plugin: int | None = None, function_name: str | None = None, function_args: str | None = None, request: JsonValue = None, response: JsonValue = None, **extra_data: Any)[source]

Bases: SmarterModel

A tool call that the LLM made in a chat session.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.misc.Provider(*, name: str, description: str | None = None, baseUrl: str | None = None, isActive: bool | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

An LLM provider that the platform is configured for, e.g. openai.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.misc.ProviderModel(*, name: str, description: str | None = None, maxTokens: int | None = None, supportsStreaming: bool | None = None, supportsTools: bool | None = None, metadata: dict[str, JsonValue] | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A model of an LLM provider.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.misc.Proxies(*, proxies: list[Proxy] = [], **extra_data: Any)[source]

Bases: SmarterModel

The proxies that the user may call.

model_config = {'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.misc.Proxy(*, name: str, description: str | None = None, provider: str | None = None, url: str | None = None, upstreamUrl: str | None = None, allowedPaths: list[str] = [], isActive: bool | None = None, **extra_data: Any)[source]

Bases: SmarterCamelModel

A proxy: authenticated passthrough access to an LLM provider’s own api.

The platform holds the provider’s api key. Callers use their Smarter api key instead, and may reach only the proxy’s allowed_paths.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.misc.Secret(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, JsonValue]] = [], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, expiresAt: datetime | None = None, lastAccessed: datetime | None = None, **extra_data: Any)[source]

Bases: SmarterResource

A secret’s metadata.

The api never returns a secret’s value.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class smarter.models.misc.Vectorsearch(*, id: int, hashedId: str | None = None, name: str, description: str | None = None, version: str | None = None, tags: list[str] = [], annotations: list[dict[str, JsonValue]] = [], createdAt: datetime | None = None, updatedAt: datetime | None = None, userProfile: SmarterOwner | None = None, canDelete: bool | None = None, manifestUrl: str | None = None, ready: bool | None = None, searchType: str | None = None, k: int | None = None, scoreThreshold: float | None = None, fetchK: int | None = None, lambdaMult: float | None = None, metadataFilter: JsonValue | None = None, isEnabled: bool | None = None, vectorstore: int | None = None, authSecret: int | None = None, **extra_data: Any)[source]

Bases: SmarterResource

A vectorsearch: a retrieval pipeline over a vectorstore.

model_config = {'alias_generator': <function to_camel>, 'extra': 'allow', 'populate_by_name': True, 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].