diff --git a/src/lib/infrastructure/server/config/openai/openai-utils.ts b/src/lib/infrastructure/server/config/openai/openai-utils.ts index b37f67d..3966ecd 100644 --- a/src/lib/infrastructure/server/config/openai/openai-utils.ts +++ b/src/lib/infrastructure/server/config/openai/openai-utils.ts @@ -164,12 +164,12 @@ export const generateOpenAiAssistantInstructions = (researchContextTitle: string let jsonFileInstructions = ""; if (jsonFileId !== undefined) { - jsonFileInstructions = ` The file '${jsonFileId}' contains a concatenation of JSON data. Within this file, there are markers that indicate the source files of the JSON data. The markers have the following structure: \"### START OF FILE: '\${file.name}' ###\" and \"### END OF FILE ###\". When a user references a specific JSON source file, please search for the data that is between the start of file comment which refers to that source file name, and the next end of file comment.`; + jsonFileInstructions = ` The file '${jsonFileId}' contains a concatenation of JSON data. Within this file, there are markers that indicate the source files of the JSON data. The markers have the following structure: \"// START OF FILE: '\${file.name}' //\" and \"// END OF FILE //\". When a user references a specific JSON source file, please search for the data that is between the start of file comment which refers to that source file name, and the next end of file comment.`; } let txtFileInstructions = ""; if (txtFileId !== undefined) { - txtFileInstructions = ` The file '${txtFileId}' contains a concatenation of TXT data. Within this file, there are markers that indicate the source files of the TXT data. The markers have the following structure: \"### START OF FILE: '\${file.name}' ###\" and \"### END OF FILE ###\". When a user references a specific TXT source file, please search for the data that is between the start of file comment which refers to that source file name, and the next end of file comment.`; + txtFileInstructions = ` The file '${txtFileId}' contains a concatenation of TXT data. Within this file, there are markers that indicate the source files of the TXT data. The markers have the following structure: \"// START OF FILE: '\${file.name}' //\" and \"// END OF FILE //\". When a user references a specific TXT source file, please search for the data that is between the start of file comment which refers to that source file name, and the next end of file comment.`; } const instructions = `You are an expert data analyst specialized working in the research context with title \"${researchContextTitle}\". This research context has the following description \"${researchContextDescription}\". You have also been assigned some files and you have access to scraped data and some results produced by us in your vector store. Some of these are images in different formats (e.g., JPG, JPEG, PNG, etc.), assigned to you via normal code interpreter.${jsonFileInstructions}${txtFileInstructions} Other files, containing key data, have been assigned to you via a vector store. Please consider files from both sources anytime the user asks you about files you have access to, and name which sources you're drawing from. diff --git a/src/lib/infrastructure/server/gateway/openai-vector-store-gateway.ts b/src/lib/infrastructure/server/gateway/openai-vector-store-gateway.ts index 4c21bc4..9287042 100644 --- a/src/lib/infrastructure/server/gateway/openai-vector-store-gateway.ts +++ b/src/lib/infrastructure/server/gateway/openai-vector-store-gateway.ts @@ -103,7 +103,7 @@ export default class OpenAIVectorStoreGateway implements VectorStoreOutputPort { concatenatedJSONFileContent = jsonLocalFiles .map((file) => { const fileContent = fs.readFileSync(file.relativePath).toString(); - return `### START OF FILE: '${file.name}' ###\n${fileContent}\n### END OF FILE ###\n`; + return `// START OF FILE: '${file.name}' //\n${fileContent}\n// END OF FILE //\n`; }) .join("\n"); // print the concatenated JSON file content to a file @@ -115,7 +115,7 @@ export default class OpenAIVectorStoreGateway implements VectorStoreOutputPort { concatenatedTxtFileContent = txtLocalFiles .map((file) => { const fileContent = fs.readFileSync(file.relativePath).toString(); - return `### START OF FILE: '${file.name}' ###\n${fileContent}\n### END OF FILE ###\n`; + return `// START OF FILE: '${file.name}' //\n${fileContent}\n// END OF FILE //\n`; }) .join("\n"); // print the concatenated TXT file content to a file