Actions
SendRequest() method » History » Revision 7
« Previous |
Revision 7/19
(diff)
| Next »
Tomislav Pleše, 09/21/2025 08:59 AM
SendRequest() method¶
Context is created from message with following roles:
- system (content: instructions to AI model),
- assistant (content: AI model responses),
- user (content: user prompts)
Context is created as a messageList where:
- first element is the assistant role/content if it exists
- following elements are an ascending list of user prompts and assistant responses in ascending order
- last element is the newest user prompt
Cases for the flow of sending requests to AI model:
-
Root Point - First Prompt
- FE - Create new Point
- FE - Show new Point on Screen - only the Prompt
- FE - Create Context as the messageList.
- FE - Send new Point and the messageList to BE
- BE - Save new Point to DB
- BE - Send messageList to OpenAI. The JSON should comprise of: model, messages, max_tokens
- BE - Receive the Response from OpenAI
- BE - Save Response to DB (into the previously saved new Point document)
- BE - Send the new Point (with updated Response and other elements like Metadata) to FE
- FE - Show updated new Point on Screen - node consisting of both Prompt message content and Response message content
-
Existing Point - Second prompt
- FE - Create new Point
- FE - Show new Point on Screen - the Prompt, under the previous Point
- FE - Create Context as the messageList.
- FE - Send new Point and the messageList to BE
- BE - Save new Point to DB
- BE - Send messageList to OpenAI. The JSON should comprise of: model, messages, max_tokens
- BE - Receive the Response from OpenAI
- BE - Save Response to DB (into the previously saved new Point document)
- BE - Send the new Point (with updated Response and other elements like Metadata) to FE
- FE - Show updated new Point on Screen - node consisting of both Prompt message content and Response message content
-
New shard - sub-prompt under a Regular Point that by this becomes a Shard
- FE - Create new Point
- FE - Show new Point on Screen - only the Prompt
- FE - Create Context as the messageList.
- FE - Send new Point and the messageList to BE
- BE - Save new Point to DB
- BE - Send messageList to OpenAI. The JSON should comprise of: model, messages, max_tokens
- BE - Receive the Response from OpenAI
- BE - Save Response to DB (into the previously saved new Point document)
- BE - Send the new Point (with updated Response and other elements like Metadata) to FE
- FE - Show updated new Point on Screen - node consisting of both Prompt message content and Response message content
-
Existing Shard - sub-prompt under a Point that has already been a Shard
Updated by Tomislav Pleše 3 months ago · 19 revisions