Project

General

Profile

Feature #3579

Add conversation support to Assistants GCF

Added by Ram Kordale 6 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Urgent
Assignee:
Start date:
06/02/2024
Due date:
% Done:

100%

Estimated time:

Description

call_openai_api(model, index, thread_id, new_chat)

-get <assistant_id, instructions, prompt prefix, prompt suffix> for <model, index> from DS
-if (assistant_id == "")
--return error //this will not happen to users
-else
--assistant_id = GET https://api.openai.com/v1/assistants/{assistant_id}

-if (thread_id == "")
--thread_id = create_thread() [POST https://api.openai.com/v1/threads]
-else
--thread_id = GET https://api.openai.com/v1/threads/{thread_id}

-if (new_chat) //delete all messages
--messages = GET https://api.openai.com/v1/threads/{thread_id}/messages
--delete messages [In a loop: 1. GET https://api.openai.com/v1/threads/{thread_id}/messages/{message_id} 2. DELETE https://api.openai.com/v1/threads/{thread_id}/messages/{message_id}]

-create message [POST https://api.openai.com/v1/threads/{thread_id}/messages]

-return thread_id, response

Also available in: Atom PDF