Last active
June 15, 2024 17:22
-
-
Save calebdre/e448fe85880194fefff05f6bd4311497 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const collectFileData = async (dir: string) => { | |
// collect all the files in the directory | |
const files = findTsFiles(dir) | |
for (const file of files) { | |
// extract functions from each file | |
file.functions = extractFunctions(file.content) | |
for (const func of file.functions) { | |
// get the description for each function | |
const description = await getFunctionDescription(file, func.functionName) | |
if (description) { | |
func.description = description | |
// get the embedding for the description | |
func.embedding = await createEmbedding('', description) | |
} | |
} | |
} | |
return files | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment