Spaces:
Runtime error
Runtime error
Fix Planner Agent for google-generativeai 0.3.2 compatibility
Browse files
backend/app/agents/planner.py
CHANGED
|
@@ -80,11 +80,8 @@ class PlannerAgent:
|
|
| 80 |
settings = get_settings()
|
| 81 |
genai.configure(api_key=settings.gemini_api_key)
|
| 82 |
|
| 83 |
-
# Use Gemini
|
| 84 |
-
self.model = genai.GenerativeModel(
|
| 85 |
-
model_name="gemini-2.5-flash",
|
| 86 |
-
system_instruction=PLANNER_SYSTEM_PROMPT,
|
| 87 |
-
)
|
| 88 |
|
| 89 |
async def create_plan(
|
| 90 |
self,
|
|
@@ -103,8 +100,8 @@ class PlannerAgent:
|
|
| 103 |
Returns:
|
| 104 |
Step-by-step execution plan as a string
|
| 105 |
"""
|
| 106 |
-
# Build the prompt
|
| 107 |
-
prompt_parts = []
|
| 108 |
|
| 109 |
# Add context if available
|
| 110 |
if context and context != "No previous conversation context.":
|
|
|
|
| 80 |
settings = get_settings()
|
| 81 |
genai.configure(api_key=settings.gemini_api_key)
|
| 82 |
|
| 83 |
+
# Use Gemini Pro (compatible with older API)
|
| 84 |
+
self.model = genai.GenerativeModel(model_name="gemini-pro")
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
async def create_plan(
|
| 87 |
self,
|
|
|
|
| 100 |
Returns:
|
| 101 |
Step-by-step execution plan as a string
|
| 102 |
"""
|
| 103 |
+
# Build the prompt with system instruction prepended
|
| 104 |
+
prompt_parts = [PLANNER_SYSTEM_PROMPT, ""]
|
| 105 |
|
| 106 |
# Add context if available
|
| 107 |
if context and context != "No previous conversation context.":
|