Upload aco/optimizer.py
Browse files- aco/optimizer.py +6 -2
aco/optimizer.py
CHANGED
|
@@ -90,16 +90,20 @@ class AgentCostOptimizer:
|
|
| 90 |
prompt_layout = None
|
| 91 |
if self.config.enable_cache_layout and context_budget:
|
| 92 |
content_pieces = self._build_content_pieces(context_budget)
|
|
|
|
|
|
|
|
|
|
| 93 |
prompt_layout = self.cache_layout.layout(
|
| 94 |
-
content_pieces, cost_1k,
|
| 95 |
)
|
| 96 |
|
| 97 |
# 5. Check for meta-tool
|
| 98 |
meta_tool_match = None
|
| 99 |
if self.config.enable_meta_tool_miner:
|
| 100 |
planned_tools = run_state.get("planned_tools", [])
|
|
|
|
| 101 |
meta_tool_match = self.meta_tool_miner.match_and_compress(
|
| 102 |
-
prediction.task_type,
|
| 103 |
)
|
| 104 |
|
| 105 |
# 6. Gate tool calls
|
|
|
|
| 90 |
prompt_layout = None
|
| 91 |
if self.config.enable_cache_layout and context_budget:
|
| 92 |
content_pieces = self._build_content_pieces(context_budget)
|
| 93 |
+
cache_discount = 0.5
|
| 94 |
+
if model_cfg:
|
| 95 |
+
cache_discount = model_cfg.cache_discount_rate
|
| 96 |
prompt_layout = self.cache_layout.layout(
|
| 97 |
+
content_pieces, cost_1k, cache_discount
|
| 98 |
)
|
| 99 |
|
| 100 |
# 5. Check for meta-tool
|
| 101 |
meta_tool_match = None
|
| 102 |
if self.config.enable_meta_tool_miner:
|
| 103 |
planned_tools = run_state.get("planned_tools", [])
|
| 104 |
+
planned_tool_names = [t[0] for t in planned_tools]
|
| 105 |
meta_tool_match = self.meta_tool_miner.match_and_compress(
|
| 106 |
+
prediction.task_type, planned_tool_names
|
| 107 |
)
|
| 108 |
|
| 109 |
# 6. Gate tool calls
|