Skip to content
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

feat(js/ai): Adds GenerateOptions#resume, ToolAction#reply, Message#interrupts #1660

Merged
merged 5 commits into from
Jan 26, 2025

Conversation

mbleigh
Copy link
Collaborator

@mbleigh mbleigh commented Jan 25, 2025

const myInterrupt = ai.defineInterrupt(...);
const response = await ai.generate({tools: [myInterrupt], prompt: "Call myInterrupt"});

const resumedResponse = await ai.generate({
  messages: response.messages,
  resume: {reply: myInterrupt.reply(response.interrupts[0], "the interrupt response");
});

Checklist (if applicable):

@mbleigh mbleigh requested a review from pavelgj January 25, 2025 05:43
js/ai/src/generate.ts Outdated Show resolved Hide resolved
js/ai/src/generate.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@pavelgj pavelgj left a comment

Choose a reason for hiding this comment

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

I like this very much!

@mbleigh mbleigh merged commit bf38029 into main Jan 26, 2025
4 checks passed
@mbleigh mbleigh deleted the mb/reply branch January 26, 2025 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants