@prismshadow/penguin-library-model · library/model/src/tool-model-bindings.ts:94

ToolModelBindings

interface

What a plugin reads and the routes serve: the declared bindings and a Project's choices.

API

@Interface("@prismshadow/penguin-server#ToolModelBindings")
export abstract class ToolModelBindings {
  abstract list(projectId: string): Promise<ToolModelBindingView[]>;
  abstract get(projectId: string, key: string): Promise<ModelRefDto | undefined>;
  abstract set(
      projectId: string,
      key: string,
      model: ModelRefDto | null,
    ): Promise<ToolModelBindingView[]>;
  abstract testRequest(model: ToolModelTestSubject): ToolModelTestRequest | undefined;
}

Contract Topology

Static AST wiring across @Module / @Provide / @Use
@Moduleexported by
@Provideprovided by
@Useconsumed by (1)

Members (4)

list

list(projectId: string): Promise<ToolModelBindingView[]>

Every declared binding, in load order, with this Project's model and its candidates.

@paramprojectIdstring
@returnsPromise<ToolModelBindingView[]>

get

get(projectId: string, key: string): Promise<ModelRefDto | undefined>

The model bound to key in this Project, or undefined: none is, or the one bound is no longer configured. Reads the file's entry whether or not a loaded plugin declares the key.

@paramprojectIdstring
@paramkeystring
@returnsPromise<ModelRefDto | undefined>

set

set(projectId: string, key: string, model: ModelRefDto | null): Promise<ToolModelBindingView[]>

Binds a declared key, or with null unbinds it, and answers the list. An undeclared key is a 404 unknown_binding; a model the Project does not configure a 400; one the binding does not accept a 400 model_not_accepted.

@paramprojectIdstring
@paramkeystring
@parammodelModelRefDto | null
@returnsPromise<ToolModelBindingView[]>

testRequest

testRequest(model: ToolModelTestSubject): ToolModelTestRequest | undefined

The request the connection test sends this model: the test request of the first binding, in load order, that declares one and accepts the model; undefined when none does (the chat probe). The model need not be configured yet — a draft is tested before it is saved.

@parammodelToolModelTestSubject
@returnsToolModelTestRequest | undefined