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): added a simple way to interrupt tool execution #1583

Merged
merged 9 commits into from
Jan 23, 2025

Conversation

pavelgj
Copy link
Collaborator

@pavelgj pavelgj commented Jan 4, 2025

ai.defineTool(..., (input, {interrupt}) => {
  interrupt();
});

js/ai/src/tool.ts Outdated Show resolved Hide resolved
js/ai/src/tool.ts Outdated Show resolved Hide resolved
@mbleigh
Copy link
Collaborator

mbleigh commented Jan 23, 2025 via email

@pavelgj pavelgj changed the base branch from pj/toolChoice to main January 23, 2025 14:24
@pavelgj pavelgj changed the base branch from main to pj/toolChoice January 23, 2025 14:27
@pavelgj pavelgj requested a review from mbleigh January 23, 2025 15:21
Copy link
Collaborator

@mbleigh mbleigh left a comment

Choose a reason for hiding this comment

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

I'm actually pretty happy with this API sitting with it overnight, and I think we could do defineInterrupt as a thin sugaring on top of it.

js/ai/src/generate/action.ts Outdated Show resolved Hide resolved
js/ai/src/generate/action.ts Outdated Show resolved Hide resolved
Base automatically changed from pj/toolChoice to main January 23, 2025 18:31
@pavelgj pavelgj merged commit dead0b8 into main Jan 23, 2025
4 checks passed
@pavelgj pavelgj deleted the pj/interruptTool branch January 23, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants