diff --git a/apps/api/src/__init__.py b/apps/api/src/__init__.py index 83122438..4ea3aa55 100644 --- a/apps/api/src/__init__.py +++ b/apps/api/src/__init__.py @@ -18,7 +18,7 @@ ) from .improver import PromptType, improve_prompt from .interfaces import db -from .models import Profile +from .models import Profile, LLMModel from .routers import agents, api_key_types, api_keys from .routers import auth as auth_router from .routers import ( @@ -114,3 +114,8 @@ def auto_build_crew(general_task: str) -> str: @app.get("/me") def get_profile_from_header(current_user=Depends(get_current_user)) -> Profile: return current_user + + +@app.get("/models") +def get_models() -> list[LLMModel]: + return db.get_models() \ No newline at end of file diff --git a/apps/api/src/interfaces/db.py b/apps/api/src/interfaces/db.py index 3d69629d..4f688b0e 100644 --- a/apps/api/src/interfaces/db.py +++ b/apps/api/src/interfaces/db.py @@ -43,6 +43,7 @@ Tool, ToolInsertRequest, ToolUpdateRequest, + LLMModel ) from src.models.tiers import TierGetRequest @@ -869,6 +870,12 @@ def delete_profile(profile_id: UUID) -> Profile: return Profile(**response.data[0]) +def get_models() -> list[LLMModel]: + supabase: Client = create_client(url, key) + response = supabase.table("models").select("*").execute() + return [LLMModel(**data) for data in response.data] + + if __name__ == "__main__": from src.models import Session diff --git a/apps/api/src/models/__init__.py b/apps/api/src/models/__init__.py index d41a62d4..58c97cf7 100644 --- a/apps/api/src/models/__init__.py +++ b/apps/api/src/models/__init__.py @@ -4,6 +4,7 @@ AgentGetRequest, AgentInsertRequest, AgentUpdateModel, + LLMModel, ) from .api_key import ( APIKey, @@ -108,4 +109,5 @@ "BillingInsertRequest", "BillingUpdateRequest", "ValidCrew", + "LLMModel", ]