Introducing the assistant panel

June 28th, 2023

Text is the ultimate user interface, and that's never been more true than in the age of large language models. That's why Zed Industries is so passionate about creating the ultimate user interface for text.

With today's release of Zed 0.92, we're adding support for editing language model contexts with a new conversation editor.

Editing a conversation with multiple cursors, then sending multiple requests to the language model in parallel.

Interfaces like ChatGPT encourage us to edit conversations sequentially, but interaction with the underlying model is actually stateless. We send the conversation's history as part of every inference, and we need to compress this history when it exceeds a token limit. In ChatGPT, this compression is performed automatically and behind the scenes, which makes sense for a mass-market audience.

But as more technical customers, we found ourselves wanting to work directly with OpenAI's API so we understood and controlled exactly what data we sent to inference. So we built a conversation editor. This special purpose editor treats conversations with language models just like any other text, except we divide the text up into blocks for each message in the conversation.

In addition to typing messages directly, you can also insert selected text from the last active editor pane with cmd->, and Zed will wrap it in a fenced code block if it is code. To send a message to the model, hit cmd-enter with your cursor in a message labeled "You". The assistant's response will be streamed below, and you can cancel with escape. To draft a new reply anywhere in the dialog, place your cursor inside an assistant message and hit cmd-enter. An empty message will be inserted below, and you can cycle it to a different role with ctrl-r. There will also always be an empty user message waiting at the end. Finally, you can split messages with shift-enter.

When you first open the panel, Zed will ask you for an OpenAI API key, which is saved to your keychain. It will also use the OPENAI_API_KEY environment variable if it's defined. Once your conversation is given a name, we automatically save it to your file system in ~/.config/zed/conversations.

While this initial version of the assistant has already become our favorite interface to ChatGPT, we're excited to keep iterating on ways to enable the language model to interact with your codebase, and we're also looking forward to adding multiplayer support. If you're on a Mac, grab an OpenAI API key, download Zed, and give the new assistant a try!