diff options
Diffstat (limited to 'src/client/apis/gpt')
-rw-r--r-- | src/client/apis/gpt/GPT.ts | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/client/apis/gpt/GPT.ts b/src/client/apis/gpt/GPT.ts index c2b518178..83ead150b 100644 --- a/src/client/apis/gpt/GPT.ts +++ b/src/client/apis/gpt/GPT.ts @@ -10,6 +10,8 @@ export enum GPTDocCommand { } export const DescriptionSeperator = '======'; +export const DescStart = '<description>'; +export const DescEnd = '</description>'; export const DocSeperator = '------'; export const DataSeperator = '>>>>>>'; export enum TextClassifications { @@ -62,14 +64,14 @@ const callTypeMap: { [type in GPTCallType]: GPTCallOpts } = { sort_docs: { model: 'gpt-4o', maxTokens: 2048, - temp: 0.25, + temp: 0, prompt: `The user is going to give you a list of descriptions. - Each one is separated by '${DescriptionSeperator}' on either side. - Descriptions will vary in length, so make sure to only separate when you see '${DescriptionSeperator}'. - Sort them by the user's specifications. - Make sure each description is only in the list once. Each item should be separated by '${DescriptionSeperator}'. + Every description is enclosed within a ${DescStart} and ${DescEnd} tag. + Based on the question the user asks, sort the given descriptions making sure each description is treated as a single entity no matter what its content. + Do NOT omit any descriptions from the final sorted list. + Return the sorted list of descriptions using the same tag format you received them. Immediately afterward, surrounded by '${DocSeperator}' on BOTH SIDES, provide some insight into your reasoning for the way you sorted (and mention nothing about the formatting details given in this description). - It is VERY important that you format it exactly as described, ensuring the proper number of '${DescriptionSeperator[0]}' and '${DocSeperator[0]}' (${DescriptionSeperator.length} of each) and NO commas`, + It is VERY important that you format it exactly as described, ensuring the proper number (${DocSeperator.length} of each) of '${DocSeperator[0]}' and NO commas`, }, edit: { model: 'gpt-4-turbo', maxTokens: 256, temp: 0.5, prompt: 'Reword the text.' }, @@ -210,10 +212,10 @@ const callTypeMap: { [type in GPTCallType]: GPTCallOpts } = { maxTokens: 1024, temp: 0, prompt: `I'm going to give you a list of descriptions. - Each one is separated by '${DescriptionSeperator}' on either side. - Descriptions will vary in length, so make sure to only separate when you see '${DescriptionSeperator}'. + Every description is enclosed within a ${DescStart} and ${DescEnd} tag. Based on the question/command the user asks, provide a tag label of the given descriptions that best matches the user's specifications. - Format your response precisely as a single string that prints each description without including any '${DescriptionSeperator}', followed by '${DataSeperator}', followed by the tag label, followed by '${DescriptionSeperator}'. + Format you response by returnign each description with its tag label in the following format: + ${DescStart}description${DataSeperator}tag label${DescEnd} Do not use any additional formatting marks or punctuation'. Immediately afterward, surrounded by '${DocSeperator}' on BOTH SIDES, provide some insight into your reasoning for the way you sorted (and mention nothing about the formatting details given in this description). `, @@ -223,12 +225,12 @@ const callTypeMap: { [type in GPTCallType]: GPTCallOpts } = { maxTokens: 1024, temp: 0, prompt: `I'm going to give you a list of descriptions. - Each one is separated by '${DescriptionSeperator}' on either side. - Descriptions will vary in length, so make sure to only separate when you see '${DescriptionSeperator}'. + Every description is enclosed within a ${DescStart} and ${DescEnd} tag. Based on the question the user asks, provide a subset of the given descriptions that best matches the user's specifications. - Make sure each description is only in the list once. Each item should be separated by '${DescriptionSeperator}'. + Make sure each description is only in the list once. + Return the filtered list of descriptions using the same tag format you received them. Immediately afterward, surrounded by '${DocSeperator}' on BOTH SIDES, provide some insight into your reasoning in the 2nd person (and mention nothing about the formatting details given in this description). - It is VERY important that you format it exactly as described, ensuring the proper number of '${DescriptionSeperator[0]}' and '${DocSeperator[0]}' (${DescriptionSeperator.length} of each) and NO commas`, + It is VERY important that you format it exactly as described, ensuring the proper number (${DocSeperator.length}) of '${DocSeperator[0]}' and NO commas`, }, //A description of a Chat Assistant, if present, should always be included in the subset. doc_info: { @@ -263,7 +265,7 @@ const gptAPICall = async (inputTextIn: string, callType: GPTCallType, prompt?: s } if (lastCall === inputText && dontCache !== true && lastResp) return lastResp; try { - const usePrompt = prompt ? prompt + '.' + opts.prompt : opts.prompt; + const usePrompt = prompt ? opts.prompt + '.\n' + prompt : opts.prompt; const messages: ChatCompletionMessageParam[] = [ { role: 'system', content: usePrompt }, { role: 'user', content: inputText }, |