Skip to content

Commit c232151

Browse files
committed
fixes to orchestration - smoke tested
1 parent 9b6ec87 commit c232151

File tree

12 files changed

+111
-69
lines changed

12 files changed

+111
-69
lines changed

src/backend/sql_agents/agent_base.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def __init__(
2828
self,
2929
agent_type: AgentType,
3030
config: AgentBaseConfig,
31-
deployment_name: None,
3231
temperature: float = 0.0,
3332
):
3433
"""Initialize the base SQL agent.
@@ -41,7 +40,6 @@ def __init__(
4140
"""
4241
self.agent_type = agent_type
4342
self.config = config
44-
self.deployment_name = deployment_name
4543
self.temperature = temperature
4644
self.agent: AzureAIAgent = None
4745

@@ -60,6 +58,15 @@ def num_candidates(self) -> Optional[int]:
6058
"""
6159
return None
6260

61+
@property
62+
def deployment_name(self) -> Optional[str]:
63+
"""Get the name of the model to be used for this agent.
64+
65+
Returns:
66+
The model name, or None if not applicable.
67+
"""
68+
return None
69+
6370
@property
6471
def plugins(self) -> Optional[List[Union[str, Any]]]:
6572
"""Get the plugins for this agent.

src/backend/sql_agents/agent_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AgentBaseConfig:
2222

2323
def __init__(self, project_client: AIProjectClient, sql_from: str, sql_to: str):
2424

25-
self.ai_project_client: AIProjectClient = project_client
25+
self.ai_project_client = project_client
2626
self.sql_from = sql_from
2727
self.sql_to = sql_to
2828

src/backend/sql_agents/fixer/agent.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
import logging
44

5-
from sql_agents.agent_base import (
6-
BaseSQLAgent,
7-
) # Ensure this import is correct and the module exists
5+
from common.models.api import AgentType
6+
from sql_agents.agent_base import BaseSQLAgent
87
from sql_agents.fixer.response import FixerResponse
98

109
logger = logging.getLogger(__name__)
@@ -18,3 +17,8 @@ class FixerAgent(BaseSQLAgent[FixerResponse]):
1817
def response_schema(self) -> type:
1918
"""Get the response schema for the fixer agent."""
2019
return FixerResponse
20+
21+
@property
22+
def deployment_name(self) -> str:
23+
"""Get the name of the model to use for the picker agent."""
24+
return self.config.model_type[AgentType.FIXER]

src/backend/sql_agents/migrator/agent.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import logging
44

5+
from common.models.api import AgentType
56
from sql_agents.agent_base import BaseSQLAgent
67
from sql_agents.migrator.response import MigratorResponse
78

@@ -21,3 +22,8 @@ def response_schema(self) -> type:
2122
def num_candidates(self) -> int:
2223
"""Get the number of candidates for the migrator agent."""
2324
return 3
25+
26+
@property
27+
def deployment_name(self) -> str:
28+
"""Get the name of the model to use for the picker agent."""
29+
return self.config.model_type[AgentType.MIGRATOR]

src/backend/sql_agents/picker/agent.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import logging
44

5+
from common.models.api import AgentType
56
from sql_agents.agent_base import BaseSQLAgent
67
from sql_agents.picker.response import PickerResponse
78

@@ -21,3 +22,8 @@ def response_schema(self) -> type:
2122
def num_candidates(self) -> int:
2223
"""Get the number of candidates for the picker agent."""
2324
return 3
25+
26+
@property
27+
def deployment_name(self) -> str:
28+
"""Get the name of the model to use for the picker agent."""
29+
return self.config.model_type[AgentType.PICKER]

src/backend/sql_agents/picker/prompt.txt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,7 @@
1818
# Output structure description
1919
Your final answer should **strictly** adhere to the following JSON structure:
2020
{
21-
"source_summary": "Here, you should provide a summary of the logic in the source query.",
22-
"candidate_summaries": [
23-
{
24-
"candidate_index": "The index of the candidate in the list of candidates.",
25-
"summary": "Here, you should provide a summary of the logic in this candidate query."
26-
},
27-
<more candidate summaries>
28-
],
2921
"conclusion": "A brief reasoning of which candidate you picked and why."
30-
"summary": "A one sentence description about your activities."
3122
"picked_query": "The picked candidate query."
23+
"summary": "A one sentence description about your activities."
3224
}
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
from semantic_kernel.kernel_pydantic import KernelBaseModel
22

33

4-
class PickerCandidateSummary(KernelBaseModel):
5-
candidate_index: int
6-
candidate_summary: str
7-
8-
94
class PickerResponse(KernelBaseModel):
105
"""
116
The response of the picker agent.
127
"""
138

14-
source_summary: str
15-
candidate_summaries: list[PickerCandidateSummary]
169
conclusion: str
1710
picked_query: str
1811
summary: str | None

src/backend/sql_agents/semantic_verifier/agent.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ def response_schema(self) -> type:
4444
"""Get the response schema for the semantic verifier agent."""
4545
return SemanticVerifierResponse
4646

47+
@property
48+
def deployment_name(self) -> str:
49+
"""Get the name of the model to use for the picker agent."""
50+
return self.config.model_type[AgentType.SEMANTIC_VERIFIER]
51+
4752
def get_kernel_arguments(self) -> Dict[str, Any]:
4853
"""Get the kernel arguments for this agent.
4954

src/backend/sql_agents/semantic_verifier/prompt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- You are allowed to make common sense assumptions about the data and return types.
1010
- Your final answer should be a JSON with the following fields: 'analysis', 'judgement', 'differences'.
1111
- If the scripts are not semantically equivalent, judgement would be 'Semantically Not Equivalent' and list the differences in the 'differences' field.
12-
- If the scripts are semantically equivalent, judgement would be 'Semantically Equivalent' and skip the differences field.
12+
- If the scripts are semantically equivalent, judgement would be 'Semantically Equivalent' and the differences filed would be an empty list.
1313

1414
# Output structure description
1515
Your final answer should **strictly** adhere to the following JSON structure:

src/backend/sql_agents/semantic_verifier/setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ async def setup_semantic_verifier_agent(
1818
) -> AzureAIAgent:
1919
"""Setup the semantic verifier agent using the factory."""
2020
return await SQLAgentFactory.create_agent(
21-
AgentType.SEMANTIC_VERIFIER,
22-
config,
21+
agent_type=AgentType.SEMANTIC_VERIFIER,
22+
config=config,
23+
temperature=0.0,
2324
source_query=source_query,
2425
target_query=target_query,
2526
)

0 commit comments

Comments
 (0)