ruimluis
ruimluis3mo ago

Convert OpenAI to File and upload to OpenAI Assistant Vectorstore

I need to convert an OpenAI Chat Completion API response that is going into bubble.io and upload that response as a file to an OpenAI Assistant VectorStore. Preferably before it even gets downloaded. Is this possible with Buildship?
2 Replies
AI Support
AI Support3mo ago
AI Support Bot Information
<@973944774400831528> you can react on the relevant answer (message) with a ✅ in this thread when you think it has been solved, by the bot or by a human! Anyone can react on this message with a ❌ if the GPT bot is unhelpful or hallucinating answers. Please note: Team members will review and answer the questions on best efforts basis.
AI Support
AI Support3mo ago
AI Response
Yes, it is possible to achieve this with BuildShip using the OpenAI Assistant and available nodes for file generation and uploads. You'll need to follow these general steps: 1. Generate the OpenAI Chat Completion API Response: - Use OpenAI's API to generate the response. 2. Convert the Response to a File Format: - You can use the Generate EPUB or a similar node to convert the obtained text response to a file format. 3. Upload to OpenAI Assistant VectorStore: - Use the provided nodes to upload the generated file directly to OpenAI Assistant VectorStore. Here are the detailed steps: Step 1: Use OpenAI Assistant Node You can call the OpenAI Chat Completion API using an OpenAI Assistant node in BuildShip. You'll need to configure this node with the necessary prompts and API keys. Step 2: Convert the Response to an EPUB File Use the Generate EPUB node to convert the chat completion response into an EPUB file. The sample input for chapters is provided in the documentation: Text only:
[
{
"title": "Chapter 1",
"data": "Hello world"
},
{
"title": "Chapter 2",
"data": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa."
}
]
[
{
"title": "Chapter 1",
"data": "Hello world"
},
{
"title": "Chapter 2",
"data": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa."
}
]
Or with HTML:
[
{
"title": "Chapter 1",
"data": "<p><img src=\"https://i.pinimg.com/originals/9c/50/2c/9c502ca51a038bf0d3c1262ca6f9ae38.png\" alt=\"Image\"/></p><p>Hello world</p>"
},
{
"title": "Chapter 2",
"data": "<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.</p>"
},
{
"title": "Chapter 3",
"data": "<p>Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</p><p>For more information, visit <a href=\"https://www.example.com\">this link</a>.</p><p><img src=\"https://www.example.com/image.jpg\" alt=\"Example Image\"/></p>"
}
]
[
{
"title": "Chapter 1",
"data": "<p><img src=\"https://i.pinimg.com/originals/9c/50/2c/9c502ca51a038bf0d3c1262ca6f9ae38.png\" alt=\"Image\"/></p><p>Hello world</p>"
},
{
"title": "Chapter 2",
"data": "<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.</p>"
},
{
"title": "Chapter 3",
"data": "<p>Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</p><p>For more information, visit <a href=\"https://www.example.com\">this link</a>.</p><p><img src=\"https://www.example.com/image.jpg\" alt=\"Example Image\"/></p>"
}
]
Step 3: Upload to VectorStore Use an upload node to save the generated EPUB file directly to the OpenAI Assistant VectorStore. For additional specifics about the nodes and detailed steps, refer to the following documentation links: - OpenAI Assistant Integration - Generate EPUB Node By combining these nodes and steps, you can generate a response, convert it into an EPUB file, and upload it directly to the VectorStore, thus bypassing the need for downloading the file manually.
BuildShip AI Support