We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Could you please share some insights on how files generated are handled?
The text was updated successfully, but these errors were encountered:
The example below is on the official doc: https://platform.openai.com/docs/assistants/tools/file-search/quickstart?lang=node.js
const stream = openai.beta.threads.runs .stream(thread.id, { assistant_id: assistant.id, }) .on("textCreated", () => console.log("assistant >")) .on("toolCallCreated", (event) => console.log("assistant " + event.type)) .on("messageDone", async (event) => { if (event.content[0].type === "text") { const { text } = event.content[0]; const { annotations } = text; const citations: string[] = []; let index = 0; for (let annotation of annotations) { text.value = text.value.replace(annotation.text, "[" + index + "]"); const { file_citation } = annotation; if (file_citation) { const citedFile = await openai.files.retrieve(file_citation.file_id); citations.push("[" + index + "]" + citedFile.filename); } index++; } console.log(text.value); console.log(citations.join("\n")); }
to retrieve generated images you can add this in the code snipped above
.on('imageFileDone', async (image: { file_id: string}) => { const imageUrl = `\n![${image.file_id}](/api/files/${image.file_id})\n`; // And so on... })
Practical example can be found here: https://github.com/openai/openai-assistants-quickstart/blob/main/app/components/chat.tsx#L197
Sorry, something went wrong.
No branches or pull requests
Could you please share some insights on how files generated are handled?
The text was updated successfully, but these errors were encountered: