Interface IPromptExecutionCommonsService
public interface IPromptExecutionCommonsService
Service that provides common logic needed when executing prompt queries. Usage of this service is optional, but may
simplify implementation of prompt service handlers. Obtain instances via
CDI.- Since:
- 8.5.0
-
Method Summary
Modifier and TypeMethodDescriptionGets a builder for a replacer that replaces placeholders in the object graph of a deserialized prompt connection or query configuration.Given a list offile set parametersand/or a list of configuredstatic files, resolves those files into the actualbinary data.Given a list ofprompt text parameterdescriptors for a set of text parameters, reads those parameters from the given request object, and returns a map with the parameter name as the key, and the parameter value as the value.
-
Method Details
-
objectGraphPlaceholderReplacer
IPromptExecutionObjectGraphPlaceholderReplacerBuilder objectGraphPlaceholderReplacer()Gets a builder for a replacer that replaces placeholders in the object graph of a deserialized prompt connection or query configuration. Useful for replacing placeholders in your model classes, before accessing their data. Uses the configuredreplacerto perform the replacements. The replacer will process fields annotated with the following annotations: For@Placeholder, replaces placeholders according to the settings of that annotation.For
@PromptTextParams, replaces all context placeholders (i.e. of the form[%<Context-Name>.<Content>%]) that match the configuredcontext name. The content of the context placeholder is interpreted as a JSON path into the providedtext parameters.- Returns:
- A builder for an object graph placeholder replacer.
-
resolveFiles
IPromptExecutionResolveFilesBuilder resolveFiles()Given a list offile set parametersand/or a list of configuredstatic files, resolves those files into the actualbinary data. For dynamic files (file set parameters), this method reads the files from the provided request object.- Returns:
- A new builder for resolving files.
-
resolveTextParameters
IPromptExecutionResolveTextParametersBuilder resolveTextParameters()Given a list ofprompt text parameterdescriptors for a set of text parameters, reads those parameters from the given request object, and returns a map with the parameter name as the key, and the parameter value as the value. Optionally also replaces placeholders in the parameter values when a replacer is configured.- Returns:
- A new builder for resolving text parameters.
-