streamCopilot function

AssistantMessageEventStream streamCopilot(
  1. Model model,
  2. Context context, [
  3. CopilotOptions? options,
  4. Client? client,
])

Streams an assistant message from GitHub Copilot.

client overrides the HTTP client (tests inject http.testing mocks); when omitted the shared keep-alive client is used.

Implementation

AssistantMessageEventStream streamCopilot(
  Model model,
  Context context, [
  CopilotOptions? options,
  http.Client? client,
]) {
  final events = AssistantMessageEventStream();
  unawaited(
    _runCopilotStream(
      events,
      model,
      context,
      options ?? const CopilotOptions(githubToken: ''),
      client,
    ),
  );
  return events;
}