BuildShip Logo
BuildShip Community

REST API Streaming Assistant

Use OpenAI Assistant with BuildShip to generate stream responses to your prompts.

331

Report this template

Select the reason for reporting

Describe the issue in detail

Share template

Link to template

https://templates.buildship.com/template/YGG745BqFWHK/

Inputs

message

Who was Leonardo da Vinci?

threadId

Assistant ID

********
This is a static example using sample inputs. Remix the template to run it with your own values.

Output

Read me

🤖 Streaming AI Chatbot

A simple AI Assistant with conversational memory that you can chat with, that returns a stream response.

In this example of a personal history tutor AI Assistant, it helps you answer questions quickly or give you interesting historical facts.

✅ Prerequisites

This template uses the OpenAI Assistant (Stream Response). Here's what you'll need to successfully test out the template:

  • [ ] Your OpenAI API Key

You can get your OpenAI API Key from the OpenAI Developer Dashboard.

  • [ ] OpenAI Assistant ID

Create an OpenAI Assistant on the OpenAI Developer Dashboard > Assistants, and copy the Assistant ID.

🧪 Testing

The OpenAI Assistant (Stream Response) node can't be tested in a traditional manner. When tested, it will return an object as output, which can be read to generate a stream. However, it will appear to be a regular javascript object when viewed in the test panel. You may, however, test it out from the Usage tab of the Chatbot Widget trigger that the template comes with.

✍️ How to Use

Once the API Key and the Assistant ID is added, the workflow is ready to be used. After receiving an HTTP Request, the workflow will response a Readable stream object in the HTTP Response body for you to use. It will also include the thread ID in a header with the key set to x-thread-id.

🎨 Customization

The default template uses the OpenAI Assistant node. To customize, click on the Additional settings to reveal additional customizable options, like the Thread ID, the Stream Content Form (regular text chunks or server-sent-events) and the Built-in Tools provided by OpenAI, like File Search and Code Interpreter.

🔗 Resources

  • How to set up an OpenAI Assistant (Stream Response): here