Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions demos/chat/backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
from typing import Any

from any_llm import AnyLLM, LLMProvider, acompletion, list_models
from any_llm import AnyLLM, LLMProvider, acompletion, alist_models
from any_llm.exceptions import MissingApiKeyError
from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
Expand Down Expand Up @@ -56,7 +56,7 @@ async def get_providers():
async def get_models(request: ListModelsRequest):
"""List available models for a provider."""
try:
models = list_models(provider=request.provider)
models = await alist_models(provider=request.provider)

return {
"models": [
Expand Down
6 changes: 3 additions & 3 deletions demos/finder/backend/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ruff: noqa: T201, S104
import os

from any_llm import AnyLLM, LLMProvider, list_models
from any_llm import AnyLLM, LLMProvider, alist_models
from any_llm.exceptions import MissingApiKeyError
from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
Expand Down Expand Up @@ -109,7 +109,7 @@ async def search_models(request: SearchRequest):
continue

try:
models = list_models(provider=provider_name.value)
models = await alist_models(provider=provider_name.value)

for model in models:
# Check if the model matches the search query
Expand Down Expand Up @@ -190,7 +190,7 @@ async def stream_all_models():
provider_display = provider_name.value.replace("_", " ").title()
yield f"data: {json.dumps({'type': 'status', 'message': f'Loading {provider_display}...', 'progress': completed_providers, 'total': total_providers})}\n\n"

models = list_models(provider=provider_name.value)
models = await alist_models(provider=provider_name.value)

provider_models = []
for model in models:
Expand Down