-
-
Notifications
You must be signed in to change notification settings - Fork 593
feat: call AI streamtools manually #1898
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
* | ||
* (alternative to writing to the writable stream using {@link writable}) | ||
*/ | ||
async executeOne(chunk: StreamToolCall<T>): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be noted that running this once, will close the stream, so you can't call it in a loop or anything (since the .execute method closes the writer once it is done).
imo, this is a bit unexpected, I'd expect to be able to apply multiple executeOne calls, but I see how this is overlapping with just a writer.write.
This PR exposes low-level functionality to apply operations (add / update / delete blocks) suggested by an LLM to the editor manually.
This makes it possible to completely offload LLM invocation to the client application. The client application can then (based on an LLM response), manually invoke the applicable StreamTools.
Demo @ https://blocknote-git-feature-call-streamtools-manually-typecell.vercel.app/ai/manual-execution (view example source)
Future work
Note that this will not integrate with the BlockNote AI UI components (UI toolbar) and is a very low-level way where the consumer will have full responsibility of setting up the LLM call (including prompts), and BlockNote only handles the "diffing" + display of document updates.
We'll also work on a more higher level abstraction that will make it easier to integrate BlockNote AI with custom backends. The proposed abstraction levels / integration points: