Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

more useful implementation of EchoProvider.generateStream #82

@csells

Description

@csells

This one provides two noticeable delays instead of mashing them together into a single delay:

  @override
  Stream<String> generateStream(
    String prompt, {
    Iterable<Attachment> attachments = const [],
  }) async* {
    if (prompt == 'FAILFAST') throw const LlmFailureException('Failing fast!');

    yield '# Echo\n';
    await Future.delayed(const Duration(milliseconds: 1000));

    switch (prompt) {
      case 'CANCEL':
        throw const LlmCancelException();
      case 'FAIL':
        throw const LlmFailureException('User requested failure');
    }

    yield prompt;
    await Future.delayed(const Duration(milliseconds: 1000));

    yield '\n\n# Attachments\n${attachments.map((a) => a.toString())}';
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions