Skip to content

Commit

Permalink
refine model provider API
Browse files Browse the repository at this point in the history
  • Loading branch information
Mini256 committed Jan 10, 2025
1 parent b461cfe commit 2c51dab
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
9 changes: 8 additions & 1 deletion backend/app/api/admin_routes/embedding_model/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@
logger = logging.getLogger(__name__)


@router.get("/admin/embedding-models/options")
@router.get("/admin/embedding-models/provider/options")
def list_embedding_model_provider_options(
user: CurrentSuperuserDep,
) -> List[EmbeddingProviderOption]:
return embedding_provider_options


@router.get("/admin/embedding-models/options", deprecated=True)
def get_embedding_model_options(
user: CurrentSuperuserDep,
) -> List[EmbeddingProviderOption]:
Expand Down
7 changes: 6 additions & 1 deletion backend/app/api/admin_routes/llm/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
logger = logging.getLogger(__name__)


@router.get("/admin/llms/options")
@router.get("/admin/llms/provider/options")
def list_llm_provider_options(user: CurrentSuperuserDep) -> List[LLMProviderOption]:
return llm_provider_options


@router.get("/admin/llms/options", deprecated=True)
def get_llm_options(user: CurrentSuperuserDep) -> List[LLMProviderOption]:
return llm_provider_options

Expand Down
13 changes: 10 additions & 3 deletions backend/app/api/admin_routes/reranker_model/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,26 @@
from app.repositories.reranker_model import reranker_model_repo
from app.rag.rerankers import (
get_reranker_model,
admin_reranker_model_options,
reranker_provider_options,
RerankerProviderOption,
)

router = APIRouter()
logger = logging.getLogger(__name__)


@router.get("/admin/reranker-models/options")
@router.get("/admin/reranker-models/provider/options")
def list_reranker_model_provider_options(
user: CurrentSuperuserDep,
) -> List[RerankerProviderOption]:
return reranker_provider_options


@router.get("/admin/reranker-models/options", deprecated=True)
def get_reranker_model_options(
user: CurrentSuperuserDep,
) -> List[RerankerProviderOption]:
return admin_reranker_model_options
return reranker_provider_options


@router.post("/admin/reranker-models/test")
Expand Down
4 changes: 2 additions & 2 deletions backend/app/rag/rerankers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .provider import (
RerankerProvider,
RerankerProviderOption,
admin_reranker_model_options,
reranker_provider_options,
)
from .resolver import (
get_reranker_model,
Expand All @@ -22,5 +22,5 @@
"get_reranker_model",
"get_default_reranker_model",
"must_get_default_reranker_model",
"admin_reranker_model_options",
"reranker_provider_options",
]
2 changes: 1 addition & 1 deletion backend/app/rag/rerankers/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RerankerProviderOption(BaseModel):
credentials_type: str = "str"


admin_reranker_model_options: List[RerankerProviderOption] = [
reranker_provider_options: List[RerankerProviderOption] = [
RerankerProviderOption(
provider=RerankerProvider.JINA,
provider_display_name="Jina AI",
Expand Down

0 comments on commit 2c51dab

Please sign in to comment.