MCPcopy Create free account
hub / github.com/caesarHQ/textSQL / get_retry_prompt

Function get_retry_prompt

api/app/api/utils/sql_gen/prompts.py:145–164  ·  view source on GitHub ↗

Crates the retry prompt for the given scope formatted to the given dialect and schemas. Args: dialect (str): This is something I should know what it is natural_language_query (str): The natural language query that the user is trying to answer schemas (str): The sche

(dialect: str, natural_language_query:str, scope: str="USA")

Source from the content-addressed store, hash-verified

143 return prompt
144
145def get_retry_prompt(dialect: str, natural_language_query:str, scope: str="USA") -> str:
146 """
147 Crates the retry prompt for the given scope formatted to the given dialect and schemas.
148
149 Args:
150 dialect (str): This is something I should know what it is
151 natural_language_query (str): The natural language query that the user is trying to answer
152 schemas (str): The schemas of the tables (currently formatted as CREATE TABLE...)
153 scope (str, optional): The project the prompt belongs to (e.g. USA, SF, etc.), defaults to 'USA'
154
155 Returns:
156 str: The formatted prompt
157 """
158
159 if scope in RETRY_PROMPTS2:
160 prompt = RETRY_PROMPTS2[scope]
161 else: prompt = RETRY_PROMPTS2["USA"]
162 prompt = prompt.format(dialect,natural_language_query, natural_language_query)
163 prompt = 'generation_id: ' + uuid.uuid4().hex + '\n' + prompt
164 return prompt

Callers 2

text_to_sql_with_retryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected