17 lines
450 B
Python
17 lines
450 B
Python
from sqlalchemy import select
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.models import ModelPricing
|
|
|
|
|
|
class ModelService:
|
|
|
|
@staticmethod
|
|
async def list_models(db: AsyncSession) -> list:
|
|
result = await db.execute(
|
|
select(ModelPricing)
|
|
.where(ModelPricing.status == "available")
|
|
.order_by(ModelPricing.provider, ModelPricing.model_name)
|
|
)
|
|
return result.scalars().all()
|