Commit
Β·
02c81d2
1
Parent(s):
57cfafe
add template doc
Browse files- template.py +3 -3
template.py
CHANGED
@@ -28,7 +28,7 @@ LLM_TOP_P = 1.0 # Top-p sampling parameter (1.0 means no filtering)
|
|
28 |
TARGET_MODELLING_FRAMEWORK = "CPMpy"
|
29 |
OUTPUT_FILE = "template_submission.jsonl"
|
30 |
|
31 |
-
#
|
32 |
SYSTEM_PROMPT_TEMPLATE = f"""You are an expert in constraint programming.
|
33 |
Your task is to convert the given natural language problem description into a complete and runnable {TARGET_MODELLING_FRAMEWORK} model.
|
34 |
The model should be self-contained.
|
@@ -42,7 +42,7 @@ For example:
|
|
42 |
```
|
43 |
"""
|
44 |
|
45 |
-
|
46 |
def generate_model_with_llm(problem_id: str, description: str, input_data: str, decision_variables: [str]) -> str:
|
47 |
|
48 |
user_prompt = f"Problem Description:\n{description}\n\n"
|
@@ -82,7 +82,7 @@ def generate_model_with_llm(problem_id: str, description: str, input_data: str,
|
|
82 |
print(f" [LLM Call] Error generating model for problem {problem_id}: {type(e).__name__} - {e}")
|
83 |
return f"# Error generating model for problem {problem_id}: {type(e).__name__} - {e}\n# Please check the LLM configuration and try again."
|
84 |
|
85 |
-
|
86 |
def main():
|
87 |
print(f"Starting model generation script for {TARGET_MODELLING_FRAMEWORK}.")
|
88 |
print(f"Loading dataset '{GT_DATASET_NAME}'...")
|
|
|
28 |
TARGET_MODELLING_FRAMEWORK = "CPMpy"
|
29 |
OUTPUT_FILE = "template_submission.jsonl"
|
30 |
|
31 |
+
# TODO: Write the main instruction given to the LLM to generate the model.
|
32 |
SYSTEM_PROMPT_TEMPLATE = f"""You are an expert in constraint programming.
|
33 |
Your task is to convert the given natural language problem description into a complete and runnable {TARGET_MODELLING_FRAMEWORK} model.
|
34 |
The model should be self-contained.
|
|
|
42 |
```
|
43 |
"""
|
44 |
|
45 |
+
# TODO: Write your approach.
|
46 |
def generate_model_with_llm(problem_id: str, description: str, input_data: str, decision_variables: [str]) -> str:
|
47 |
|
48 |
user_prompt = f"Problem Description:\n{description}\n\n"
|
|
|
82 |
print(f" [LLM Call] Error generating model for problem {problem_id}: {type(e).__name__} - {e}")
|
83 |
return f"# Error generating model for problem {problem_id}: {type(e).__name__} - {e}\n# Please check the LLM configuration and try again."
|
84 |
|
85 |
+
# --- Main Function (no need to change) ---
|
86 |
def main():
|
87 |
print(f"Starting model generation script for {TARGET_MODELLING_FRAMEWORK}.")
|
88 |
print(f"Loading dataset '{GT_DATASET_NAME}'...")
|