youssefleb commited on
Commit
b90a3a7
·
verified ·
1 Parent(s): 7f6ef0d

Update mcp_servers.py

Browse files
Files changed (1) hide show
  1. mcp_servers.py +10 -10
mcp_servers.py CHANGED
@@ -1,9 +1,7 @@
1
- # mcp_servers.py (Corrected for NameError)
2
  import asyncio
3
  import json
4
- # --- THIS IS THE FIX ---
5
- from typing import Dict, Optional, Tuple, List, Any # Added 'Any'
6
- # ---
7
  from personas import PERSONAS_DATA
8
  import google.generativeai as genai
9
  from anthropic import AsyncAnthropic
@@ -11,11 +9,11 @@ from openai import AsyncOpenAI
11
  import config
12
  from utils import load_prompt
13
 
14
- # (EVALUATION_PROMPT_TEMPLATE is unchanged)
15
  EVALUATION_PROMPT_TEMPLATE = load_prompt(config.PROMPT_FILES["evaluator"])
16
 
17
  class BusinessSolutionEvaluator:
18
- # (This class is unchanged)
 
19
  def __init__(self, gemini_client: Optional[genai.GenerativeModel]):
20
  if not gemini_client:
21
  raise ValueError("BusinessSolutionEvaluator requires a Google/Gemini client.")
@@ -30,8 +28,9 @@ class BusinessSolutionEvaluator:
30
  response = await self.gemini_model.generate_content_async(
31
  prompt,
32
  generation_config=genai.types.GenerationConfig(
33
- response_mime_type="application/json",
34
- model=config.MODELS["Gemini"]["judge"]
 
35
  )
36
  )
37
  json_text = response.text.strip().replace("```json", "").replace("```", "")
@@ -70,7 +69,7 @@ class AgentCalibrator:
70
  plan = {
71
  "Plant": {"persona": config.CALIBRATION_CONFIG["roles_to_test"]["Plant"], "llm": default_llm},
72
  "Implementer": {"persona": config.CALIBRATION_CONFIG["roles_to_test"]["Implementer"], "llm": default_llm},
73
- "Monitor": {"persona": config.CALAIBRATION_CONFIG["roles_to_test"]["Monitor"], "llm": default_llm}
74
  }
75
  return plan, error_log
76
 
@@ -137,7 +136,8 @@ async def get_llm_response(client_name: str, client, system_prompt: str, user_pr
137
  ]
138
  response = await model.generate_content_async(full_prompt,
139
  generation_config=genai.types.GenerationConfig(
140
- model=config.MODELS["Gemini"]["default"]
 
141
  ))
142
  return response.text
143
 
 
1
+ # mcp_servers.py (Corrected for TypeError)
2
  import asyncio
3
  import json
4
+ from typing import Dict, Optional, Tuple, List, Any
 
 
5
  from personas import PERSONAS_DATA
6
  import google.generativeai as genai
7
  from anthropic import AsyncAnthropic
 
9
  import config
10
  from utils import load_prompt
11
 
 
12
  EVALUATION_PROMPT_TEMPLATE = load_prompt(config.PROMPT_FILES["evaluator"])
13
 
14
  class BusinessSolutionEvaluator:
15
+ """Implements the "LLM-as-a-Judge"."""
16
+
17
  def __init__(self, gemini_client: Optional[genai.GenerativeModel]):
18
  if not gemini_client:
19
  raise ValueError("BusinessSolutionEvaluator requires a Google/Gemini client.")
 
28
  response = await self.gemini_model.generate_content_async(
29
  prompt,
30
  generation_config=genai.types.GenerationConfig(
31
+ response_mime_type="application/json"
32
+ # --- FIX: REMOVED a line here ---
33
+ # model=config.MODELS["Gemini"]["judge"] <-- This was the bug
34
  )
35
  )
36
  json_text = response.text.strip().replace("```json", "").replace("```", "")
 
69
  plan = {
70
  "Plant": {"persona": config.CALIBRATION_CONFIG["roles_to_test"]["Plant"], "llm": default_llm},
71
  "Implementer": {"persona": config.CALIBRATION_CONFIG["roles_to_test"]["Implementer"], "llm": default_llm},
72
+ "Monitor": {"persona": config.CALIBRATION_CONFIG["roles_to_test"]["Monitor"], "llm": default_llm}
73
  }
74
  return plan, error_log
75
 
 
136
  ]
137
  response = await model.generate_content_async(full_prompt,
138
  generation_config=genai.types.GenerationConfig(
139
+ # --- FIX: REMOVED a line here ---
140
+ # model=config.MODELS["Gemini"]["default"] <-- This was the bug
141
  ))
142
  return response.text
143