Theia API Documentation v1.65.0
    Preparing search index...

    Implements

    Index

    Constructors

    Properties

    _builtInFragments: BasePromptFragment[] = []

    Collection of built-in prompt fragments

    _defaultVariantsMap: Map<string, string> = ...

    Map to store default variant for each prompt variant set (key: promptVariantSetId, value: variantId)

    _onPromptsChangeEmitter: Emitter<void> = ...

    Event emitter for prompt changes

    _onSelectedVariantChangeEmitter: Emitter<
        { promptVariantSetId: string; variantId: undefined
        | string },
    > = ...

    Event emitter for selected variant changes

    _promptVariantSetsMap: Map<string, string[]> = ...

    Map to store prompt variants sets (key: promptVariantSetId, value: array of variantIds)

    _selectedVariantsMap: Map<string, string> = ...

    Map to store selected variant for each prompt variant set (key: promptVariantSetId, value: variantId)

    customizationService: undefined | PromptFragmentCustomizationService
    logger: ILogger
    onPromptsChange: Event<void> = ...

    Event fired when the prompts change

    onSelectedVariantChange: Event<
        { promptVariantSetId: string; variantId: undefined
        | string },
    > = ...

    Event fired when the selected variant for a prompt variant set changes

    promptChangeDebounceTimer?: Timeout
    settingsService: undefined | AISettingsService
    toDispose: DisposableCollection = ...
    toolInvocationRegistry: undefined | ToolInvocationRegistry
    variableService: undefined | AIVariableService

    Methods

    • Adds a variant ID to the fragment variants map

      Parameters

      • promptVariantSetId: string

        The prompt variant set id

      • variantId: string

        The variant ID to add

      • isDefault: boolean = false

        Whether this variant should be the default for the prompt variant set (defaults to false)

      Returns void

    • Gets the effective variant ID that is guaranteed to be valid if one exists. This checks if the selected variant ID is valid, and falls back to the default variant if it isn't.

      Parameters

      • variantSetId: string

        The prompt variant set id

      Returns undefined | string

      A valid variant ID if one exists, or undefined if no valid variant can be found

    • Gets the explicitly selected variant ID for a prompt fragment from settings. This returns only the variant that was explicitly selected in settings, not the default.

      Parameters

      • variantSetId: string

        The prompt variant set id

      Returns undefined | string

      The selected variant ID from settings, or undefined if none is selected

    • Recalculates the selected variants map for all variant sets and fires the onSelectedVariantChangeEmitter if the selectedVariants field has changed.

      Returns Promise<void>

    • Removes a variant ID from the fragment variants map

      Parameters

      • promptVariantSetId: string

        The prompt variant set id

      • variantId: string

        The variant ID to remove

      Returns void

    • Calculates all variable and argument replacements for an unresolved template.

      Parameters

      • templateText: string

        the unresolved template text

      • Optionalargs: { [key: string]: unknown }

        the object with placeholders, mapping the placeholder key to the value

      • Optionalcontext: AIVariableContext

        the AIVariableContext to use during variable resolution

      • OptionalresolveVariable: (variable: AIVariableArg) => Promise<undefined | ResolvedAIVariable>

        the variable resolving method. Fall back to using the AIVariableService if not given.

      Returns Promise<
          {
              replacements: { placeholder: string; value: string }[];
              resolvedVariables: ResolvedAIVariable[];
          },
      >

      Object containing replacements and resolved variables

    • Strips comments from a template string

      Parameters

      • templateText: string

        The template text to process

      Returns string

      Template text with comments removed

    • Updates the selected variant for a prompt variant set

      Parameters

      • agentId: string

        The ID of the agent to update

      • promptVariantSetId: string

        The prompt variant set ID

      • newVariant: string

        The new variant ID to set as selected

      Returns Promise<void>