Spaces:
Sleeping
Sleeping
import json | |
def load_json(file_path): | |
""" | |
Load JSON file from the specified path. | |
""" | |
try: | |
with open(file_path, "r") as file: | |
return json.load(file) | |
except json.JSONDecodeError: | |
raise ValueError(f"Invalid JSON format in file: {file_path}") | |
def format_prompt(question, schema, metadata, instructions): | |
""" | |
Combines schema, metadata, and question into a single prompt. | |
""" | |
return f""" | |
### Instructions | |
{instructions} | |
### Schema | |
{schema} | |
### Metadata | |
{metadata} | |
### Question | |
{question} | |
### SQL | |
""" | |