به‌روزرسانی: دریافت زندهٔ کاتالوگ مدل‌ها و افورت‌های استدلال پشتیبانی‌شده بر اساس اکانت انتخابی

This commit is contained in:
mjalmoudy94
2026-10-13 07:41:00 +00:00
parent da5a2a5d1a
commit 0b72c4ec6d
10 changed files with 229 additions and 39 deletions
+25 -5
View File
@@ -105,6 +105,15 @@ class AgyTestOut(BaseModel):
output_tokens: int
class AgyAccountModelOut(BaseModel):
id: str
display_name: str
supports_thinking: bool = False
supported_efforts: list[str] = Field(default_factory=list)
default_effort: str | None = None
supports_images: bool = False
# ---------------------------------------------------------------------------
# Provider helpers
# ---------------------------------------------------------------------------
@@ -331,16 +340,16 @@ async def test_agy_account(
)
@router.get("/accounts/{credential_id}/models", response_model=list[str])
@router.get("/accounts/{credential_id}/models", response_model=list[AgyAccountModelOut])
async def list_account_models(
credential_id: str,
session: AsyncSession = Depends(get_session),
) -> list[str]:
) -> list[AgyAccountModelOut]:
"""Live model catalog of one account — fetched from Google on every call.
The admin console calls this when an account is selected, so the model
list always reflects that subscription's current entitlement instead of a
cached snapshot.
list always reflects that subscription's current entitlement along with
the supported reasoning efforts for each model.
"""
from app.core.errors import ValidationError
from app.infrastructure.adapters.agy import AgyModelAdapter
@@ -352,7 +361,18 @@ async def list_account_models(
adapter = AgyModelAdapter() # stateless: one forced account
try:
return await adapter.available_models_for(credential)
models = await adapter.available_models_for(credential)
return [
AgyAccountModelOut(
id=m.id,
display_name=m.display_name,
supports_thinking=m.supports_thinking,
supported_efforts=m.supported_efforts,
default_effort=m.default_effort,
supports_images=m.supports_images,
)
for m in models
]
except ValidationError:
raise
except Exception as exc: # noqa: BLE001 - the console wants the reason