Restore QuoteJudge upload tool compatibility
This commit is contained in:
52
agent.py
52
agent.py
@@ -8,7 +8,6 @@ Deterministic, no-LLM quote comparison product:
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
import csv
|
||||
import hashlib
|
||||
@@ -88,7 +87,7 @@ class QuoteJudgeStudioV1(A2AAgent[QuoteJudgeStudioV1Config, PlatformUserAuth]):
|
||||
"and warranty scoring, persists recommendations, supports upload/paste "
|
||||
"workflows, and exposes typed A2A/MCP tools."
|
||||
)
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
|
||||
config_model = QuoteJudgeStudioV1Config
|
||||
auth_model = PlatformUserAuth
|
||||
@@ -208,6 +207,26 @@ class QuoteJudgeStudioV1(A2AAgent[QuoteJudgeStudioV1Config, PlatformUserAuth]):
|
||||
return {**parsed, "comparison_id": comparison_id}
|
||||
return await self.compare_quotes(ctx, comparison_id=comparison_id, quotes=parsed["quotes"], weights=weights)
|
||||
|
||||
@a2a.tool(
|
||||
description="Compatibility alias for the original QuoteJudge browser upload tool.",
|
||||
timeout_seconds=60,
|
||||
idempotent=True,
|
||||
cost_class="deterministic",
|
||||
)
|
||||
async def compare_uploaded_quotes_browser(
|
||||
self,
|
||||
ctx: RunContext[PlatformUserAuth],
|
||||
comparison_id: Annotated[str, Field(min_length=1, max_length=120)],
|
||||
documents: Annotated[list[BrowserDocument], Field(min_length=1, max_length=MAX_BROWSER_DOCUMENTS)],
|
||||
weights: QuoteWeights,
|
||||
) -> dict[str, Any]:
|
||||
return await self.compare_quotes_from_browser_upload(
|
||||
ctx,
|
||||
comparison_id=comparison_id,
|
||||
documents=documents,
|
||||
weights=weights,
|
||||
)
|
||||
|
||||
@a2a.tool(
|
||||
description=(
|
||||
"External API upload path: accept a typed FileUpload containing "
|
||||
@@ -257,6 +276,35 @@ class QuoteJudgeStudioV1(A2AAgent[QuoteJudgeStudioV1Config, PlatformUserAuth]):
|
||||
return {**parsed, "comparison_id": comparison_id}
|
||||
return await self.compare_quotes(ctx, comparison_id=comparison_id, quotes=parsed["quotes"], weights=weights)
|
||||
|
||||
@a2a.tool(
|
||||
description="Compatibility alias for the original QuoteJudge external upload tool.",
|
||||
timeout_seconds=60,
|
||||
idempotent=True,
|
||||
cost_class="deterministic",
|
||||
grant_mode="read_only",
|
||||
grant_allow_patterns=("**",),
|
||||
)
|
||||
async def compare_uploaded_quote_file(
|
||||
self,
|
||||
ctx: RunContext[PlatformUserAuth],
|
||||
comparison_id: Annotated[str, Field(min_length=1, max_length=120)],
|
||||
document: Annotated[
|
||||
UploadedFile,
|
||||
FileUpload(
|
||||
accept=ACCEPTED_UPLOAD_TYPES,
|
||||
max_bytes=MAX_BROWSER_DOCUMENT_BYTES,
|
||||
description="JSON list/object, CSV, or text containing vendor quotes.",
|
||||
),
|
||||
],
|
||||
weights: QuoteWeights,
|
||||
) -> dict[str, Any]:
|
||||
return await self.compare_quotes_from_upload(
|
||||
ctx,
|
||||
comparison_id=comparison_id,
|
||||
quote_file=document,
|
||||
weights=weights,
|
||||
)
|
||||
|
||||
|
||||
def _tenant_key(ctx: RunContext[PlatformUserAuth]) -> str:
|
||||
auth = ctx.auth
|
||||
|
||||
Reference in New Issue
Block a user