Skip to content

feat(ai): Implement async iterator support for AI interface (ENG-380) #1166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

devin-ai-integration[bot]
Copy link
Contributor

PR Description

Implements async iterator support for the ai interface, enabling streaming responses from LLMs. This addresses ticket ENG-380.

Changes

  • Added StreamingAIConfig and updated AI_Instance types in sdks/functions.do/types.ts.
  • Implemented streaming logic in proxy handlers (pkgs/ai-functions/src/ai.ts, sdks/functions.do/index.ts, lib/ai.ts).
  • Added streaming support for tagged template literals.
  • Updated tests in pkgs/ai-functions/test/ai.test.ts and sdks/functions.do/index.test.ts to cover streaming scenarios.
  • Created a changeset for the functions.do package.

Verification

  • Ran pnpm format successfully.
  • Ran pnpm test for ai-functions and functions.do packages locally, all tests passed.

Requestor

Nathan Clevenger ([email protected])

Link to Devin run

https://app.devin.ai/sessions/c75edd02b7484774b200c1f947192340

Adds streaming support to the AI interface via async iterators,
allowing users to process LLM responses chunk by chunk.

Includes:
- Type definition updates for streaming config and AI instance.
- Streaming logic in proxy handlers (ai-functions, functions.do, lib/ai).
- Streaming support for tagged template literals.
- Test coverage for new streaming functionality.
- Consistency updates in lib/ai.ts.
- Changeset for functions.do package.

Co-Authored-By: Nathan Clevenger <[email protected]>
Copy link

linear bot commented Apr 13, 2025

Copy link

vercel bot commented Apr 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ai ❌ Failed (Inspect) Apr 13, 2025 9:33pm

Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Member

@nathanclevenger nathanclevenger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We specifically want the async iterator to support either the ObjectArray or TextArray output types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant