MCPcopy Create free account
hub / github.com/TIGER-AI-Lab/TheoremExplainAgent / call_parse_prompt

Function call_parse_prompt

task_generator/parse_prompt.py:5–27  ·  view source on GitHub ↗

Find the prompts_raw directory and generate an __init__.py file containing prompt texts. Searches for prompts_raw directory in current and parent directories. Once found, calls create_python_file_with_texts() to generate the __init__.py file.

()

Source from the content-addressed store, hash-verified

3
4
5def call_parse_prompt():
6 """
7 Find the prompts_raw directory and generate an __init__.py file containing prompt texts.
8
9 Searches for prompts_raw directory in current and parent directories. Once found,
10 calls create_python_file_with_texts() to generate the __init__.py file.
11 """
12 current_file_path = os.path.abspath(__file__)
13 current_folder_path = os.path.dirname(current_file_path)
14 folder_path = os.path.join(current_folder_path, "prompts_raw")
15
16 # If prompts_raw not found in current directory, search parent directories
17 if not os.path.exists(folder_path):
18 parent_dir = current_folder_path
19 while parent_dir != os.path.dirname(parent_dir): # Stop at root directory
20 parent_dir = os.path.dirname(parent_dir)
21 test_path = os.path.join(parent_dir, "prompts_raw")
22 if os.path.exists(test_path):
23 folder_path = test_path
24 break
25
26 output_file = os.path.join(folder_path, "__init__.py")
27 create_python_file_with_texts(folder_path, output_file)
28
29
30def create_python_file_with_texts(folder_path: str, output_file: str) -> None:

Callers 1

parse_prompt.pyFile · 0.70

Calls 1

Tested by

no test coverage detected