Skip to content

Commit 3f20683

Browse files
committed
prompt changes for struct output issues
1 parent 4d39845 commit 3f20683

File tree

7 files changed

+32
-8
lines changed

7 files changed

+32
-8
lines changed

src/backend/api/api_routes.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@
2020
from api.status_updates import app_connection_manager, close_connection
2121
from common.logger.app_logger import AppLogger
2222
from common.services.batch_service import BatchService
23+
from sql_agents.process_batch import process_batch_async
2324

2425
router = APIRouter()
2526
logger = AppLogger("APIRoutes")
2627

27-
# start processing the batch
28-
from sql_agents.sql_agents_start import process_batch_async
29-
3028

29+
# start processing the batch
3130
@router.post("/start-processing")
3231
async def start_processing(request: Request):
3332
"""
@@ -68,8 +67,12 @@ async def start_processing(request: Request):
6867
try:
6968
payload = await request.json()
7069
batch_id = payload.get("batch_id")
70+
translate_from = payload.get("translate_from")
71+
translate_to = payload.get("translate_to")
7172

72-
await process_batch_async(batch_id)
73+
await process_batch_async(
74+
batch_id=batch_id, convert_from=translate_from, convert_to=translate_to
75+
)
7376

7477
await close_connection(batch_id)
7578

src/backend/sql_agents/agents/semantic_verifier/prompt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ is in the source ({{$source}}) dialect and a migrated one migrated script is in
88
- Make sure that the differences you identify are applicable in the context of the given scripts, and avoid generalized distinctions.
99
- Do not hallucinate or assume any functionality that is not explicitly mentioned in the scripts.
1010
- Avoid using any first person language in any of the output.
11-
- You are allowed to make common sense assumptions about the data and return types.
11+
- You are allowed to make common sense assumptions about the backend data and the return types of the sql queries.
1212
- If the scripts are not semantically equivalent, judgement would be 'Semantically Not Equivalent' and the differences would be listed in the 'differences' field.
1313
- If the scripts are semantically equivalent, judgement would be 'Semantically Equivalent' and the 'differences' field would be an empty list.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
You are a SQL semantic verifier with expertise in both the {{$source}} and {{$target}} SQL dialects. Analyze two SQL scripts, one in the {{$source}} dialect and the other in the {{$target}} dialect. Determine whether these scripts are semantically equivalent, focusing only on the logic of their operations.
2+
3+
Instructions:
4+
- Compare both scripts line by line, focusing on logical operations rather than syntax or formatting.
5+
- Avoid speculation or adding functionality not explicitly shown in the scripts.
6+
- Make common-sense assumptions about data and return types if needed.
7+
- If the scripts are not semantically equivalent, set "judgement" to "Semantically Not Equivalent" and list the differences in the "differences" field.
8+
- If the scripts are semantically equivalent, set "judgement" to "Semantically Equivalent" and provide an empty list for the "differences" field.
9+
- Do not use first-person language in the output.
10+
- Return only valid JSON that follows the structure:
11+
12+
{
13+
"analysis": "<string>",
14+
"judgement": "<string>",
15+
"differences": [
16+
"<string>",
17+
"<string>"
18+
],
19+
"summary": "<string>"
20+
}
21+

src/backend/sql_agents/agents/semantic_verifier/response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ class SemanticVerifierResponse(KernelBaseModel):
1414
analysis: str
1515
judgement: str
1616
differences: list[str]
17-
summary: str | None
17+
summary: str

src/backend/sql_agents/convert_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def convert_script(
3838
sql_agents: SqlAgents,
3939
# agent_config: AgentBaseConfig,
4040
) -> str:
41-
"""setup agents, selection and termination."""
41+
"""Use the team of agents to migrate a sql script."""
4242
logger.info("Migrating query: %s\n", source_script)
4343

4444
# Setup the group chat for the agents

src/backend/sql_agents/helpers/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def get_prompt(agent_type: str) -> str:
88
"""Get the prompt for the given agent type."""
99
if not re.match(r"^[a-zA-Z0-9_]+$", agent_type):
1010
raise ValueError("Invalid agent type")
11-
file_path = os.path.join(f"./sql_agents/{agent_type}", "prompt.txt")
11+
file_path = os.path.join(f"./sql_agents/agents/{agent_type}", "prompt.txt")
1212
with open(file_path, "r", encoding="utf-8") as file:
1313
return file.read()
1414

File renamed without changes.

0 commit comments

Comments
 (0)