refactor: Replace inline call_type Literals with CallTypesLiteral (17 files) #16889
+45
−340
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Closes #16495
This PR continues the refactoring started in #16362 (commit c96da44) by replacing inline
Literaltype definitions forcall_typeparameters with the centralizedCallTypesLiteralimport fromlitellm.types.utilsacross 17 additional files.Changes
CallTypesLiteralimport to 17 filesLiteral[...]definitionsBenefits
Files Modified (17 total)
litellm/cost_calculator.pylitellm/router.py(largest change: 67 lines removed)litellm/litellm_core_utils/llm_response_utils/get_formatted_prompt.pylitellm/proxy/guardrails/guardrail_hooks/aporia_ai/aporia_ai.pylitellm/proxy/guardrails/guardrail_hooks/azure/prompt_shield.pylitellm/proxy/guardrails/guardrail_hooks/azure/text_moderation.pylitellm/proxy/guardrails/guardrail_hooks/custom_guardrail.pylitellm/proxy/guardrails/guardrail_hooks/grayswan/grayswan.pylitellm/proxy/guardrails/guardrail_hooks/guardrails_ai/guardrails_ai.pylitellm/proxy/guardrails/guardrail_hooks/lakera_ai.pylitellm/proxy/guardrails/guardrail_hooks/lasso/lasso.pylitellm/proxy/guardrails/guardrail_hooks/model_armor/model_armor.pylitellm/proxy/guardrails/guardrail_hooks/openai/moderations.pylitellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.pylitellm/proxy/guardrails/guardrail_hooks/pillar/pillar.pylitellm/proxy/guardrails/guardrail_hooks/tool_permission.pylitellm/proxy/hooks/prompt_injection_detection.pyExample
Testing