Skip to content

Commit

Permalink
Prime prompt generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Dainius Kirsnauskas committed May 1, 2024
1 parent 4c69ece commit 8dd1f33
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions prime_prompt/generate_prime_promt.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
""" Script for generating prime prompt """

import os
from os.path import normpath, join


project_folder = normpath(join(__file__, '..', '..'))


def scan_docs(path: str):
"""
Scans Python file and yields function and its documentation
:param path: path of file
"""
with open(path, "r") as file:

lines = file.readlines()
with open(path, "r", encoding="utf=8") as python_file:
lines = python_file.readlines()
i = 0
while i < len(lines):
line = lines[i]
i += 1
if not line.startswith("def ") or line[4] == "_":
continue


function = line[4:line.index("(")]
function_name = line[4:line.index("(")]
i += 1 # skip first """

documentation = ""
function_documentation = ""
while True:
if lines[i].strip() == "\"\"\"":
break
documentation += lines[i]
function_documentation += lines[i]
i += 1
yield function, documentation
yield function_name, documentation


llm_related_modules = ["data_collection"]
with open("prime_prompt.txt", "w") as f:
with open("prime_prompt.txt", "w", encoding="utf=8") as f:
for module in llm_related_modules:
for directory, folder, files in os.walk(join(project_folder, module)):
for file in files:
Expand Down

0 comments on commit 8dd1f33

Please sign in to comment.