Client

The client, new Smarter({...}), and its options. See Configuration.

class Smarter(options)

A client of a Smarter platform’s api.

The client’s properties group the api’s operations:

  • Smarter.manifests: apply, validate, get, describe, delete, deploy, undeploy and logs, for any kind

  • Smarter.llmClients: LLMClients, and prompting and chatting with them

  • Smarter.guardrails, Smarter.mcpClients, Smarter.vectorstores, Smarter.llmHosts, Smarter.secrets, Smarter.plugins, Smarter.orchestrators, Smarter.vectorsearches

  • Smarter.accounts (and accounts.users, accounts.contacts and accounts.userProfiles)

  • Smarter.history, Smarter.journal, Smarter.providers, Smarter.proxies

  • Smarter.whoami, Smarter.version, Smarter.status and Smarter.kinds

A client holds no open connections of its own: there is nothing to close.

Arguments:
  • options (SmarterOptions) – The api key, base url, environment, timeout (seconds), retries, headers, fetch and logging.

Throws:

SmarterConfigurationError – If no api key is found, or an option or environment variable is invalid.

Smarter.accounts

Accounts, and their users and contacts.

Type:

Accounts

Smarter.config

The client’s resolved configuration, without its api key.

Type:

Omit<ClientConfig, “apiKey”>

Smarter.guardrails

Guardrails.

Type:

Guardrails

Smarter.history

The history of chat sessions, tool calls and plugin uses.

Type:

PromptHistory

Smarter.http

The http transport, for endpoints that the SDK does not wrap.

Type:

SmarterHttpClient

Smarter.journal

The Smarter Journal. Superusers only.

Type:

Journal

Smarter.llmClients

LLMClients.

Type:

LLMClients

Smarter.llmHosts

LLMHosts.

Type:

LLMHosts

Smarter.manifests

The manifest api, for any resource kind.

Type:

Manifests

Smarter.mcpClients

MCPClients.

Type:

MCPClients

Smarter.orchestrators

Orchestrators.

Type:

Orchestrators

Smarter.plugins

Plugins.

Type:

Plugins

Smarter.providers

LLM providers and their models.

Type:

Providers

Smarter.proxies

Proxies to LLM providers’ own apis.

Type:

Proxies

Smarter.secrets

Secrets.

Type:

Secrets

Smarter.vectorsearches

Vectorsearches.

Type:

Vectorsearches

Smarter.vectorstores

Vectorstores.

Type:

Vectorstores

Smarter.apiKey

The api key, e.g. to use a proxy with a provider’s own SDK.

Type:

string

Smarter.baseUrl

The api’s base url, e.g. https://platform.smarter.sh/api/v1/.

Type:

string

Smarter.[custom]()

How console.log and util.inspect show the client: without its api key.

Return type:

string

Smarter.kinds(options?)

The resource kinds that the platform supports, and which of them can be deployed.

Arguments:
  • options (RequestOptions | undefined) – Per-request options.

Returns:

The kinds.

Return type:

Promise<object[]>

Smarter.status(options?)

The state of the platform’s infrastructure and compute.

Arguments:
  • options (RequestOptions | undefined) – Per-request options.

Returns:

The status.

Return type:

Promise<object>

Smarter.toJSON()

The client as JSON, with its api key masked.

Returns:

The base url and the masked api key.

Return type:

object

Smarter.toString()
Returns:

e.g. Smarter(baseUrl="https://platform.smarter.sh/api/v1/", apiKey="****5150").

Return type:

string

Smarter.version(options?)

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

Arguments:
  • options (RequestOptions | undefined) – Per-request options.

Returns:

The versions.

Return type:

Promise<object>

Smarter.whoami(options?)

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

Arguments:
  • options (RequestOptions | undefined) – Per-request options.

Returns:

The owner.

Return type:

Promise<object>

VERSION

The SDK’s version.

Type:

“0.0.0”

class SmarterOptions()

The options of a Smarter client. Every option is optional: see src/core/config.ts for where each is looked up.

Extends ConfigOptions, and has its methods.

SmarterOptions.defaultHeaders

Headers to add to every request.

Type:

Record<string, string>

SmarterOptions.fetch

The fetch to send requests with, e.g. one with a proxy agent. The global fetch by default.

Type:

Fetch

SmarterOptions.logger

Where to log: console, or any logger with debug, info, warn and error methods.

Type:

SmarterLogger

SmarterOptions.logLevel

How much to log, instead of SMARTER_LOG. Nothing is logged by default.

Type:

SmarterLogLevel