MCPcopy Create free account
hub / github.com/LagPixelLOL/ChatGPTCLIBot / construct_initial

Method construct_initial

main/interface/model/Completion.cpp:16–29  ·  view source on GitHub ↗

* Construct the initial prompt with embeddings searching. * @throw std::invalid_argument When chat_history is empty. */

Source from the content-addressed store, hash-verified

14 * @throw std::invalid_argument When chat_history is empty.
15 */
16 void Completion::construct_initial() {
17 if (!chat_history->empty()) {
18 if (documents) {
19 constructed_initial = prompt::construct_reference(initial_prompt, chat_history->back()->getInputEmbeddings(),
20 documents, max_reference_length);
21 } else {
22 constructed_initial = prompt::construct_reference(initial_prompt, chat_history->back()->getInputEmbeddings(),
23 chat_history, search_response, max_reference_length,
24 max_short_memory_length, me_id, bot_id);
25 }
26 } else {
27 throw std::invalid_argument("Field chat_history is empty.");
28 }
29 }
30
31 /**
32 * Call the OpenAI API.

Callers 1

start_loopFunction · 0.80

Calls 2

construct_referenceFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected