API Reference

Every function, hook, and type that the @emend/ai package exports.

This section lists what the @emend/ai package gives you. If you use the ready-made AI components, you only need a few of these. Read on if you want to build your own AI UI or server route.

Where to import from

The package is split into parts, so browser code and server code only load what they need.

Import fromWhat it has
@emend/ai/reactuseEditorAi, the React hook for running AI requests
@emend/ai/tiptapThe EmendAi Tiptap extension, plus preview and apply helpers
@emend/ai/transportTransports that send requests from the browser, including a mock
@emend/ai/serverThe server route handler and a mock AI for testing
@emend/ai/protocolTypes for requests, streamed answers, actions, and errors
@emend/aiThe most common exports from all of the above

Start here

Also useful

  • Action manifest: the built-in actions like Improve and Shorten, and what each one is allowed to do.
  • Error codes: every error emend can return, and what to show the user.

On this page