Skip to main content

Interface: IPromptTemplateRepository

Defined in: internal/prompt-template-store/types.ts:179

Persistence seam of the prompt templates: the active rows whole, the history of a key paged.

Implemented by the host's adapter (InMemoryPromptTemplateRepository in the tests and the sandbox); only the PromptTemplateStore calls it. A template is identified by key + version.

Methods​

get()​

get(args): Promise<IPromptTemplate | null>

Defined in: internal/prompt-template-store/types.ts:207

get -- one version of a key

About​

By key + version; null when it does not exist.

The template as stored, whole.

Who needs it​

PromptTemplateStore.activate, to check the version before it flips.

Parameters​

args​
key​

EPromptTemplateKey

version​

number

Returns​

Promise<IPromptTemplate | null>


listVersions()​

listVersions(args): Promise<IPage<IPromptTemplate>>

Defined in: internal/prompt-template-store/types.ts:226

listVersions -- one page of a key's versions

About​

Highest version first; the cursors are version numbers.

endingBefore reads the limit versions below it, startingAfter the limit versions right above it (the page next to the cursor, not the highest). A cursor that is not a version of the key is a 404. The store has validated limit and that only one cursor is set.

Who needs it​

PromptTemplateStore.listVersions; addVersion, for the highest version so far.

Parameters​

args​
key​

EPromptTemplateKey

page​

IPageArgs<number>

Returns​

Promise<IPage<IPromptTemplate>>


loadActive()​

loadActive(): Promise<IPromptTemplate[]>

Defined in: internal/prompt-template-store/types.ts:193

loadActive -- the active template of every key

About​

At most one per key.

Returns the versions whose isActive is set, in any order.

Who needs it​

PromptTemplateStore.getActive, when the active set is not cached.

Returns​

Promise<IPromptTemplate[]>


save()​

save(args): Promise<void>

Defined in: internal/prompt-template-store/types.ts:243

save -- inserts or replaces one version

About​

Upsert by key + version.

The template is stored whole; the same key and version is replaced.

Who needs it​

PromptTemplateStore.addVersion.

Parameters​

args​
template​

IPromptTemplate

Returns​

Promise<void>


setActive()​

setActive(args): Promise<void>

Defined in: internal/prompt-template-store/types.ts:258

setActive -- activates one version of a key

About​

One operation: the version becomes active, the others of the key inactive.

The version must exist; throws a 404 otherwise. A real adapter does the flip in one transaction, so no reader sees two active versions or none.

Who needs it​

PromptTemplateStore.activate.

Parameters​

args​
key​

EPromptTemplateKey

version​

number

Returns​

Promise<void>