Documentation
¶
Overview ¶
Package promptkitty provides PromptKitty's embedded PromptKit component catalog and a deterministic prompt assembler.
Index ¶
- type AmbiguousError
- type AssembleRequest
- type AssembleResult
- type Component
- type ComponentDetail
- type ComponentRef
- type ComponentType
- type Filter
- type Library
- func (l *Library) Assemble(request AssembleRequest) (AssembleResult, error)
- func (l *Library) List(filter Filter) []Component
- func (l *Library) Pipelines() []Pipeline
- func (l *Library) Search(query string, filter Filter) []Component
- func (l *Library) Show(name string) (ComponentDetail, error)
- func (l *Library) Version() string
- type NotFoundError
- type ParametersError
- type Pipeline
- type PipelineStage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmbiguousError ¶
type AmbiguousError struct {
Name string
Types []ComponentType
}
AmbiguousError reports a name shared by more than one component type.
func (*AmbiguousError) Error ¶
func (e *AmbiguousError) Error() string
type AssembleRequest ¶
type AssembleRequest struct {
Template string
Params map[string]string
Persona string
AdditionalProtocols []string
AdditionalTaxonomies []string
// Format leaves the template default when nil, omits the format when it
// points to an empty string, and otherwise replaces the default.
Format *string
}
AssembleRequest selects a template, supplies every declared parameter, and optionally adjusts its component composition.
type AssembleResult ¶
type AssembleResult struct {
Markdown string `json:"markdown"`
Template Component `json:"template"`
Components []ComponentRef `json:"components"`
}
AssembleResult is a completely rendered PromptKit prompt. All declared template parameters have been substituted.
type Component ¶
type Component struct {
Name string `json:"name"`
Type ComponentType `json:"type"`
Category string `json:"category,omitempty"`
Path string `json:"path,omitempty"`
Description string `json:"description,omitempty"`
Language string `json:"language,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
Component is a catalog entry enriched with its Markdown frontmatter. Metadata is a defensive copy and may be inspected by future transports.
type ComponentDetail ¶
type ComponentDetail struct {
Component
UsedByTemplates []string `json:"usedByTemplates,omitempty"`
}
ComponentDetail adds reverse template references to a component.
type ComponentRef ¶
type ComponentRef struct {
Name string `json:"name"`
Type ComponentType `json:"type"`
Path string `json:"path"`
}
ComponentRef records one component included in an assembled prompt.
type ComponentType ¶
type ComponentType string
ComponentType identifies one PromptKit component layer.
const ( ComponentPersona ComponentType = "persona" ComponentProtocol ComponentType = "protocol" ComponentFormat ComponentType = "format" ComponentTaxonomy ComponentType = "taxonomy" ComponentTemplate ComponentType = "template" )
type Filter ¶
type Filter struct {
Type ComponentType
Category string
Language string
}
Filter selects catalog components. Empty fields match every component.
type Library ¶
type Library struct {
// contains filtered or unexported fields
}
Library is an immutable PromptKit catalog and assembler.
func NewFromFS ¶
NewFromFS loads a PromptKit library rooted at root within fsys. It is useful for tests and callers that maintain a compatible private catalog.
func (*Library) Assemble ¶
func (l *Library) Assemble(request AssembleRequest) (AssembleResult, error)
Assemble resolves a template and returns a fully rendered prompt. Mustache examples that are not declared template parameters are ordinary Markdown literals and are preserved verbatim.
func (*Library) Pipelines ¶
Pipelines returns the manifest's artifact pipelines in stable name order.
func (*Library) Search ¶
Search ranks catalog components by their relevance to query, then applies filter. Search is deterministic and uses only the loaded catalog.
type NotFoundError ¶
type NotFoundError struct {
Type ComponentType
Name string
}
NotFoundError reports a requested component that is absent from the catalog.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type ParametersError ¶
ParametersError reports missing or unknown template parameters.
func (*ParametersError) Error ¶
func (e *ParametersError) Error() string
type Pipeline ¶
type Pipeline struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Stages []PipelineStage `json:"stages"`
}
Pipeline is one named sequence from the embedded PromptKit manifest.
type PipelineStage ¶
type PipelineStage struct {
Template string `json:"template"`
Consumes any `json:"consumes,omitempty"`
Produces any `json:"produces,omitempty"`
}
PipelineStage describes one template and its artifact contract.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cli exposes PromptKitty's reusable Cobra command tree and standalone process runner.
|
Package cli exposes PromptKitty's reusable Cobra command tree and standalone process runner. |
|
cmd
|
|
|
promptkitty
command
The promptkitty command browses and assembles embedded PromptKit components.
|
The promptkitty command browses and assembles embedded PromptKit components. |
|
internal
|
|
|
tools/syncpromptkit
command
Command syncpromptkit refreshes the pinned embedded PromptKit component snapshot.
|
Command syncpromptkit refreshes the pinned embedded PromptKit component snapshot. |
|
version
Package version defines the release version shared by PromptKitty surfaces.
|
Package version defines the release version shared by PromptKitty surfaces. |
|
plugins
|
|
|
promptkitty
Package promptkitty contains the cross-host PromptKitty plugin contract.
|
Package promptkitty contains the cross-host PromptKitty plugin contract. |