Repository navigation
fix(proxy): resolve list files credentials from team BYOK deployments #30495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,7 @@ | |
| encode_file_id_with_model, | ||
| extract_file_creation_params, | ||
| get_credentials_for_model, | ||
| get_team_provider_credentials, | ||
| handle_model_based_routing, | ||
| prepare_data_with_credentials, | ||
| validate_managed_files_requirement, | ||
|
|
@@ -1351,14 +1352,20 @@ async def list_files( | |
| status_code=400, | ||
| detail="target_model_names on list files must be a list of one model name. Example: ['gpt-4o']", | ||
| ) | ||
| ## Use router to list fine-tuning jobs for that model | ||
| if llm_router is None: | ||
| raise HTTPException( | ||
| status_code=500, | ||
| detail="LLM Router not initialized. Ensure models added to proxy.", | ||
| ) | ||
| data["model"] = target_model_names_list[0] | ||
| response = await llm_router.afile_list( | ||
| credentials = get_credentials_for_model( | ||
| llm_router=llm_router, | ||
| model_id=target_model_names_list[0], | ||
| operation_context="file list", | ||
| ) | ||
| prepare_data_with_credentials(data=data, credentials=credentials) | ||
| response = await litellm.afile_list( | ||
| custom_llm_provider=credentials["custom_llm_provider"], | ||
| purpose=purpose, | ||
| **data, | ||
| ) | ||
| else: | ||
|
|
@@ -1370,6 +1377,18 @@ async def list_files( | |
| or "openai" | ||
| ) | ||
|
|
||
| # No model/target_model_names pinned: resolve upstream credentials from | ||
| # the team's deployment for this provider so the call is authenticated | ||
| # against the team's own account (e.g. the team's openai deployment). | ||
| team_credentials = get_team_provider_credentials( | ||
| llm_router=llm_router, | ||
| team_models=user_api_key_dict.team_models or [], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. High: Key model restrictions are bypassed for provider file listing Plain
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @veria-ai this is scoped to team members. that is expected. |
||
| custom_llm_provider=custom_llm_provider, | ||
| team_id=user_api_key_dict.team_id, | ||
| ) | ||
| if team_credentials is not None: | ||
| prepare_data_with_credentials(data=data, credentials=team_credentials) | ||
|
|
||
| response = await litellm.afile_list( | ||
| custom_llm_provider=custom_llm_provider, purpose=purpose, **data # type: ignore | ||
| ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.