Skip to content

Commit

Permalink
change file indicators to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ydamit committed Nov 21, 2024
1 parent cd98d6c commit 7718115
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib/infrastructure/server/config/openai/openai-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7718115

Please sign in to comment.