mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
integrate model inference into get_model_info flow
This commit is contained in:
parent
7a34090175
commit
47d19b863b
1 changed files with 16 additions and 2 deletions
|
|
@ -5521,9 +5521,23 @@ def _get_model_info_helper( # noqa: PLR0915
|
|||
_model_info = None
|
||||
|
||||
if _model_info is None or key is None:
|
||||
raise ValueError(
|
||||
"This model isn't mapped yet. Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json"
|
||||
# Try model inference for self-hosted providers
|
||||
from litellm.model_inference import infer_model_capabilities
|
||||
|
||||
inferred_info = infer_model_capabilities(
|
||||
model=model,
|
||||
custom_llm_provider=custom_llm_provider or ""
|
||||
)
|
||||
|
||||
if inferred_info:
|
||||
# Use inferred model info
|
||||
key = inferred_info.get("key", model)
|
||||
_model_info = inferred_info
|
||||
else:
|
||||
# Inference failed, raise original error
|
||||
raise ValueError(
|
||||
"This model isn't mapped yet. Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json"
|
||||
)
|
||||
|
||||
_input_cost_per_token: Optional[float] = _model_info.get(
|
||||
"input_cost_per_token"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue