invoke method

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

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 ChatOllamaOptions? options,
}) async {
  final id = _uuid.v4();
  final completion = await _client.generateChatCompletion(
    request: generateChatCompletionRequest(
      input.toChatMessages(),
      options: options,
      defaultOptions: defaultOptions,
    ),
  );
  return completion.toChatResult(id);
}