a2a-source-edit: write agent.py
This commit is contained in:
14
agent.py
14
agent.py
@@ -352,6 +352,20 @@ def _clean_comparison_id(value: str) -> str:
|
|||||||
return cleaned
|
return cleaned
|
||||||
|
|
||||||
|
|
||||||
|
def _score_sort_key(row: dict[str, Any]) -> tuple[float, float, int, int, str]:
|
||||||
|
return (
|
||||||
|
-float(row["scores"]["weighted_total"]),
|
||||||
|
float(row["subtotal"]),
|
||||||
|
int(row["delivery_days"]),
|
||||||
|
-int(row["warranty_months"]),
|
||||||
|
str(row["vendor"]).lower(),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _subtotal_key(row: dict[str, Any]) -> float:
|
||||||
|
return float(row["subtotal"])
|
||||||
|
|
||||||
|
|
||||||
def _score_quotes(comparison_id: str, quotes: list[QuoteInput], weights: QuoteWeights) -> dict[str, Any]:
|
def _score_quotes(comparison_id: str, quotes: list[QuoteInput], weights: QuoteWeights) -> dict[str, Any]:
|
||||||
quote_rows = [quote.model_dump() for quote in quotes]
|
quote_rows = [quote.model_dump() for quote in quotes]
|
||||||
for row in quote_rows:
|
for row in quote_rows:
|
||||||
|
|||||||
Reference in New Issue
Block a user