BasePromptTemplate class abstract base

Base class for a prompt template.

Inheritance
Implementers
Annotations
  • @immutable

Constructors

BasePromptTemplate({required Set<String> inputVariables, PartialValues? partialVariables})
Base class for a prompt template.
const

Properties

defaultOptions BaseLangChainOptions
The default options to use when invoking the Runnable.
finalinherited
hashCode int
The hash code for this object.
no setteroverride
inputVariables Set<String>
A set of the names of the variables the prompt template expects.
final
partialVariables PartialValues?
Partial variables.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String
The type of the prompt template.
no setter

Methods

batch(List<InputValues> inputs, {List<BaseLangChainOptions>? options}) Future<List<PromptValue>>
Batches the invocation of the Runnable on the given inputs.
inherited
bind(BaseLangChainOptions options) RunnableBinding<InputValues, BaseLangChainOptions, PromptValue>
Binds the Runnable to the given options.
inherited
close() → void
Cleans up any resources associated with it the Runnable.
inherited
copyWith({Set<String>? inputVariables, Map<String, dynamic>? partialVariables}) BasePromptTemplate
Copy the prompt template with the given parameters.
format(InputValues values) String
Format the prompt given the input values and return a formatted string.
formatPrompt(InputValues values) PromptValue
Format the prompt given the input values and return a formatted prompt value.
getCompatibleOptions(RunnableOptions? options) BaseLangChainOptions?
Returns the given options if they are compatible with the Runnable, otherwise returns null.
inherited
invoke(InputValues input, {BaseLangChainOptions? options}) Future<PromptValue>
Format the prompt given the input values and return a formatted prompt value.
override
mergePartialAndUserVariables(Map<String, dynamic> userVariables) Map<String, Object>
Merge the partial variables with the user variables.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
partial(PartialValues values) BasePromptTemplate
Return a partial of the prompt template.
pipe<NewRunOutput extends Object?, NewCallOptions extends RunnableOptions>(Runnable<PromptValue, NewCallOptions, NewRunOutput> next) RunnableSequence<InputValues, NewRunOutput>
Pipes the output of this Runnable into another Runnable using a RunnableSequence.
inherited
stream(InputValues input, {BaseLangChainOptions? options}) Stream<PromptValue>
Streams the output of invoking the Runnable on the given input.
inherited
streamFromInputStream(Stream<InputValues> inputStream, {BaseLangChainOptions? options}) Stream<PromptValue>
Streams the output of invoking the Runnable on the given inputStream.
override
toString() String
A string representation of this object.
override
validateTemplate() → void
Validate the integrity of the prompt template, checking that all the variables are present and that the right format is used.
withFallbacks(List<Runnable<InputValues, RunnableOptions, PromptValue>> fallbacks) RunnableWithFallback<InputValues, PromptValue>
Adds fallback runnables to be invoked if the primary runnable fails.
inherited
withRetry({int maxRetries = 3, FutureOr<bool> retryIf(Object e)?, List<Duration?>? delayDurations, bool addJitter = false}) RunnableRetry<InputValues, PromptValue>
Adds retry logic to an existing runnable.
inherited

Operators

operator ==(covariant BasePromptTemplate other) bool
The equality operator.
override