Skip to content

Commit 5edf1a1

Browse files
committed
fix: update LLM model and refine agent instruction
Changed the LLM model from "openai/gpt-4o-mini" to "gemini/gemini-2.5-pro" for improved performance. Updated the agent's instruction to provide clearer context for the task, enhancing user interaction. Also, optimised the suggest_fixes function to handle both dictionary and string inputs, improving its flexibility in suggesting fixes based on issue type. This minimal change aims to enhance the functionality while maintaining existing code integrity.
1 parent 5d8816e commit 5edf1a1

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

src/praisonai-agents/gemini-sequential.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def multiply(a: int, b: int) -> int:
2222

2323
agent = Agent(
2424
instructions="You are a helpful assistant. You can use the tools provided to you to help the user.",
25-
llm="openai/gpt-4o-mini",
25+
llm="gemini/gemini-2.5-pro",
2626
tools=[get_stock_price, multiply]
2727
)
2828

29-
result = agent.start("multiply the Google stock price with 2")
29+
result = agent.start("what is the stock price of Google? multiply the Google stock price with 2")
3030
print(result)

src/praisonai-agents/tests/code_review.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,30 @@ def analyze_code_changes():
1111
]
1212
return issues[int(time.time()) % 3]
1313

14-
def suggest_fixes(issue: Dict):
14+
def suggest_fixes(issue):
1515
"""Simulates fix suggestions"""
1616
fixes = {
1717
"style": "Apply PEP 8 formatting",
18-
"security": "Implement input validation",
18+
"security": "Implement input validation",
1919
"performance": "Use list comprehension"
2020
}
21-
return fixes.get(issue["type"], "Review manually")
21+
22+
# Handle both dict and string inputs
23+
if isinstance(issue, dict):
24+
issue_type = issue.get("type", "unknown")
25+
else:
26+
# If it's a string, try to extract the type
27+
issue_str = str(issue).lower()
28+
if "security" in issue_str:
29+
issue_type = "security"
30+
elif "style" in issue_str:
31+
issue_type = "style"
32+
elif "performance" in issue_str:
33+
issue_type = "performance"
34+
else:
35+
issue_type = "unknown"
36+
37+
return fixes.get(issue_type, "Review manually")
2238

2339
def apply_automated_fix(fix: str):
2440
"""Simulates applying automated fixes"""
@@ -98,11 +114,8 @@ def main():
98114
# Print results
99115
print("\nCode Review Results:")
100116
print("=" * 50)
101-
for task_id, result in results["task_results"].items():
102-
if result:
103-
print(f"\nTask: {task_id}")
104-
print(f"Result: {result.raw}")
105-
print("-" * 50)
117+
print(f"Results: {results}")
118+
print("-" * 50)
106119

107120
if __name__ == "__main__":
108121
main()

0 commit comments

Comments
 (0)