PromptResult class

Result returned by a @Prompt-annotated method.

Contains a list of messages that form the prompt template, optionally with a description explaining what the prompt does.

Example:

@Prompt(description: 'Code review prompt')
PromptResult codeReview({required String code}) {
  return PromptResult(
    description: 'Prompts the LLM to review code quality',
    messages: [
      PromptMessage(
        role: PromptRole.user,
        content: TextPromptContent('Please review: $code'),
      ),
    ],
  );
}

Constructors

PromptResult({String? description, required List<PromptMessage> messages})
Creates a prompt result.
const

Properties

description String?
Optional description of what this prompt does.
final
hashCode int
The hash code for this object.
no setterinherited
messages List<PromptMessage>
List of messages that form the prompt.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited