a2a-source-edit: write agent.py
This commit is contained in:
12
agent.py
12
agent.py
@@ -403,17 +403,9 @@ def _score_quotes(comparison_id: str, quotes: list[QuoteInput], weights: QuoteWe
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
scored.sort(
|
scored.sort(key=_score_sort_key)
|
||||||
key=lambda item: (
|
|
||||||
-item["scores"]["weighted_total"],
|
|
||||||
item["subtotal"],
|
|
||||||
item["delivery_days"],
|
|
||||||
-item["warranty_months"],
|
|
||||||
item["vendor"].lower(),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
winner = scored[0]
|
winner = scored[0]
|
||||||
baseline = min(scored, key=lambda item: item["subtotal"])
|
baseline = min(scored, key=_subtotal_key)
|
||||||
rationale_bits = [
|
rationale_bits = [
|
||||||
f"{winner['vendor']} has the highest weighted score ({winner['scores']['weighted_total']:.2f}).",
|
f"{winner['vendor']} has the highest weighted score ({winner['scores']['weighted_total']:.2f}).",
|
||||||
f"Its normalized total is {winner['subtotal']:.2f} for {winner['quantity']} units.",
|
f"Its normalized total is {winner['subtotal']:.2f} for {winner['quantity']} units.",
|
||||||
|
|||||||
Reference in New Issue
Block a user