Compare commits
1 Commits
gemini/pas
...
gemini/pas
| Author | SHA1 | Date | |
|---|---|---|---|
| 5dd8622539 |
24
tasks.py
24
tasks.py
@@ -2126,3 +2126,27 @@ def cross_review_prs():
|
||||
continue
|
||||
|
||||
return {"reviews": len(results), "details": results}
|
||||
|
||||
def get_model_for_task(task_class, agent_name=None):
|
||||
"""Implement the Fallback Portfolio doctrine (docs/fallback-portfolios.md).
|
||||
|
||||
Reads fallback-portfolios.yaml and returns the primary model for the given task class.
|
||||
If primary fails, the agent should call this again with an incremented 'attempt' (not implemented here).
|
||||
"""
|
||||
import yaml
|
||||
portfolio_path = Path(__file__).parent / "fallback-portfolios.yaml"
|
||||
if not portfolio_path.exists():
|
||||
return "gemini-1.5-flash" # Default fallback
|
||||
|
||||
with open(portfolio_path, "r") as f:
|
||||
portfolios = yaml.safe_load(f)
|
||||
|
||||
# 1. Check agent-specific portfolio
|
||||
if agent_name and agent_name in portfolios.get("agents", {}):
|
||||
return portfolios["agents"][agent_name]["primary"]["model"]
|
||||
|
||||
# 2. Check task-class portfolio
|
||||
if task_class in portfolios.get("role_classes", {}):
|
||||
return portfolios["role_classes"][task_class]["primary"]["model"]
|
||||
|
||||
return "gemini-1.5-flash"
|
||||
|
||||
Reference in New Issue
Block a user