SendRequest() method » History » Version 8
Tomislav Pleše, 09/21/2025 09:08 AM
| 1 | 1 | Tomislav Pleše | # SendRequest() method |
|---|---|---|---|
| 2 | 2 | Tomislav Pleše | |
| 3 | 4 | Tomislav Pleše | Context is created from message with following roles: |
| 4 | * system (content: instructions to AI model), |
||
| 5 | * assistant (content: AI model responses), |
||
| 6 | * user (content: user prompts) |
||
| 7 | 1 | Tomislav Pleše | |
| 8 | 5 | Tomislav Pleše | Context is created as a messageList where: |
| 9 | * first element is the assistant role/content if it exists |
||
| 10 | * following elements are an ascending list of user prompts and assistant responses in ascending order |
||
| 11 | * last element is the newest user prompt |
||
| 12 | |||
| 13 | 8 | Tomislav Pleše | Sub-prompt is a prompt that is created from the contents of the Response of the currently selected Point (node - prompt + respnse). This: |
| 14 | * creates a new regular Point |
||
| 15 | * previous Response creates a new Point that is inserted in between the response of a current Regular Point. The splitting of the current Point is at the point of that by this becomes a Shard |
||
| 16 | 4 | Tomislav Pleše | |
| 17 | 8 | Tomislav Pleše | |
| 18 | 4 | Tomislav Pleše | Cases for the flow of sending requests to AI model: |
| 19 | |||
| 20 | 1 | Tomislav Pleše | 1. Root Point - First Prompt |
| 21 | 6 | Tomislav Pleše | 1. FE - Create new Point |
| 22 | 2. FE - Show new Point on Screen - only the Prompt |
||
| 23 | 3. FE - Create Context as the messageList. |
||
| 24 | 4. FE - Send new Point and the messageList to BE |
||
| 25 | 5. BE - Save new Point to DB |
||
| 26 | 6. BE - Send messageList to OpenAI. The JSON should comprise of: model, messages, max_tokens |
||
| 27 | 7. BE - Receive the Response from OpenAI |
||
| 28 | 8. BE - Save Response to DB (into the previously saved new Point document) |
||
| 29 | 9. BE - Send the new Point (with updated Response and other elements like Metadata) to FE |
||
| 30 | 10. FE - Show updated new Point on Screen - node consisting of both Prompt message content and Response message content |
||
| 31 | 1 | Tomislav Pleše | |
| 32 | 2 | Tomislav Pleše | 2. Existing Point - Second prompt |
| 33 | 6 | Tomislav Pleše | 1. FE - Create new Point |
| 34 | 2. FE - Show new Point on Screen - the Prompt, under the previous Point |
||
| 35 | 3. FE - Create Context as the messageList. |
||
| 36 | 4. FE - Send new Point and the messageList to BE |
||
| 37 | 5. BE - Save new Point to DB |
||
| 38 | 6. BE - Send messageList to OpenAI. The JSON should comprise of: model, messages, max_tokens |
||
| 39 | 7. BE - Receive the Response from OpenAI |
||
| 40 | 8. BE - Save Response to DB (into the previously saved new Point document) |
||
| 41 | 9. BE - Send the new Point (with updated Response and other elements like Metadata) to FE |
||
| 42 | 7 | Tomislav Pleše | 10. FE - Show updated new Point on Screen - node consisting of both Prompt message content and Response message content |
| 43 | 1 | Tomislav Pleše | |
| 44 | 8 | Tomislav Pleše | 3. New shard - |
| 45 | 1 | Tomislav Pleše | 1. FE - Create new Point |
| 46 | 8 | Tomislav Pleše | 2. FE - Create a Shard in the current Prompt |
| 47 | 3. FE - |
||
| 48 | 3. FE - Show new Point on Screen - the Prompt, under the previous Point |
||
| 49 | 7 | Tomislav Pleše | 3. FE - Create Context as the messageList. |
| 50 | 4. FE - Send new Point and the messageList to BE |
||
| 51 | 5. BE - Save new Point to DB |
||
| 52 | 6. BE - Send messageList to OpenAI. The JSON should comprise of: model, messages, max_tokens |
||
| 53 | 7. BE - Receive the Response from OpenAI |
||
| 54 | 8. BE - Save Response to DB (into the previously saved new Point document) |
||
| 55 | 9. BE - Send the new Point (with updated Response and other elements like Metadata) to FE |
||
| 56 | 10. FE - Show updated new Point on Screen - node consisting of both Prompt message content and Response message content |
||
| 57 | 6 | Tomislav Pleše | |
| 58 | 7 | Tomislav Pleše | 4. Existing Shard - sub-prompt under a Point that has already been a Shard |