invoke method

  1. @override
Future<ChatResult> invoke(
  1. PromptValue input, {
  2. Options? options,
})
override

Invokes the Runnable on the given input.

  • input - the input to invoke the Runnable on.
  • options - the options to use when invoking the Runnable.

Implementation

@override
Future<ChatResult> invoke(
  final PromptValue input, {
  final Options? options,
}) async {
  final text = await callInternal(input.toChatMessages(), options: options);
  final message = AIChatMessage(content: text);
  return ChatResult(
    id: '1',
    output: message,
    finishReason: FinishReason.unspecified,
    metadata: const {},
    usage: const LanguageModelUsage(),
  );
}