Skip to content

sidekick(dart generator): Only generate streaming method implementations for white-listed methods #2490

@brianquinlan

Description

@brianquinlan

Currently all methods that can stream results (e.g. StreamGenerateContent) have a corresponding generated Dart binding, e.g.

  /// Generates a [streamed response](https://ai.google.dev/gemini-api/docs/text-generation?lang=python#generate-a-text-stream)
  /// from the model given an input `GenerateContentRequest`.
  Stream<GenerateContentResponse> streamGenerateContent(
    GenerateContentRequest request,
  ) {
    final url = Uri.https(_host, '/v1/${request.model}:streamGenerateContent');
    return _client
        .postStreaming(url, body: request)
        .map(GenerateContentResponse.fromJson);
  }

But not all streaming methods support Server-sent events (SSE), which is the implementation supported by Dart.

So instead whitelist streamed methods known to support SSE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions