The Journal

The enumerations of the Smarter Journal: the record of every request to the Smarter api.

Each journal entry records the thing that a request was about, from SmarterJournalThings, and the command that it ran, from SmarterJournalCliCommands. Every SAM kind is a thing, so SmarterJournalThings takes its kinds from SAMKinds.

class smarter_types.journal.SCLIResponseMetadata[source]

Bases: object

The keys of the metadata of a journaled response of the cli api’s get command.

class smarter_types.journal.SmarterJournalApiResponseErrorKeys[source]

Bases: object

The keys of the error of a journaled response of the Smarter api.

class smarter_types.journal.SmarterJournalApiResponseKeys[source]

Bases: object

The keys of a journaled response of the Smarter api.

class smarter_types.journal.SmarterJournalCliCommands(*values)[source]

Bases: SmarterEnumAbstract

The commands of the Smarter api’s /api/v1/cli/ endpoints, which the journal records.

command = SmarterJournalCliCommands("apply")
assert command == SmarterJournalCliCommands.APPLY
classmethod choices() → list[tuple[str, str]][source]

Return the choices of the platform’s journal model’s command field, as Django expects them.

The list is part of the platform’s database migrations, so it changes only with a migration.

Returns:

(value, label) pairs.

Return type:

list[tuple[str, str]]

classmethod past_tense() → dict[str, str][source]

Return the past tense of each command, for the messages of journaled responses.

Returns:

The past tense, by command value, e.g. {"apply": "applied", ...}.

Return type:

dict[str, str]

classmethod from_url(url: str | bytes) → str | None[source]

Return the command of a Smarter api url.

SmarterJournalCliCommands.from_url("http://localhost:9357/api/v1/cli/example_manifest/Account/")
# "example_manifest"
Parameters:

url (str | bytes) – The url.

Returns:

The first slug of the url’s path that is a command, or None for a url that is not an api url, or that has no command.

Return type:

str | None

class smarter_types.journal.SmarterJournalThings(*values)[source]

Bases: SmarterEnumAbstract

The kinds of objects (“things”) that the Smarter Journal records requests about.

Every SAM kind is a thing, with the same value. The one thing that is not a SAM kind is PROMPT_CONFIG, a chat’s configuration, which the platform generates on request.

thing = SmarterJournalThings("Plugin")
assert thing == SmarterJournalThings.STATIC_PLUGIN
assert thing.value == SAMKinds.STATIC_PLUGIN.value
PROMPT_CONFIG = 'ChatConfig'

A chat’s configuration: a JSON object that the platform generates on request.

Not a SAM kind.

classmethod choices() → list[tuple[str, str]][source]

Return the choices of the platform’s journal model’s thing field, as Django expects them.

The list is part of the platform’s database migrations, so it changes only with a migration. It doesn’t have LLMHost or LLMHostCompute.

Returns:

(value, label) pairs.

Return type:

list[tuple[str, str]]