Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
26b84ba4
Commit
26b84ba4
authored
Mar 16, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add debug logging to LiteLLM alias resolution
parent
cd1040bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
litellm.py
codai/openai/litellm.py
+20
-8
No files found.
codai/openai/litellm.py
View file @
26b84ba4
...
...
@@ -104,11 +104,15 @@ class LiteLLMBackend:
Returns:
Normalized model name with provider prefix
"""
print
(
f
"DEBUG litellm: normalize_model_name input: {model}"
)
# First, resolve alias to actual model name if we have a model manager
resolved_model
=
self
.
_resolve_model_alias
(
model
)
print
(
f
"DEBUG litellm: After alias resolution: {resolved_model}"
)
# If already has a provider prefix (contains /), return as-is
if
'/'
in
resolved_model
:
print
(
f
"DEBUG litellm: Model has provider prefix, returning: {resolved_model}"
)
return
resolved_model
# Common model name patterns and their providers
...
...
@@ -154,7 +158,9 @@ class LiteLLMBackend:
return
f
"{provider}{resolved_model}"
# Default: assume OpenAI-compatible local model
return
f
"openai/{resolved_model}"
result
=
f
"openai/{resolved_model}"
print
(
f
"DEBUG litellm: Using default provider, returning: {result}"
)
return
result
def
_resolve_model_alias
(
self
,
model
:
str
)
->
str
:
"""
...
...
@@ -170,11 +176,13 @@ class LiteLLMBackend:
Resolved actual model name
"""
if
not
self
.
model_manager
:
print
(
f
"DEBUG litellm: No model_manager, returning model as-is: {model}"
)
return
model
# Check if model is "default" or empty - use default_model
if
not
model
or
model
==
"default"
:
default_model
=
getattr
(
self
.
model_manager
,
'default_model'
,
None
)
print
(
f
"DEBUG litellm: Resolving 'default' alias to: {default_model}"
)
if
default_model
:
return
default_model
return
model
...
...
@@ -182,20 +190,21 @@ class LiteLLMBackend:
# Check if model is "image" - get first image model
if
model
==
"image"
:
image_models
=
getattr
(
self
.
model_manager
,
'image_models'
,
[])
if
image_models
:
return
image_models
[
0
]
return
model
resolved
=
image_models
[
0
]
if
image_models
else
model
print
(
f
"DEBUG litellm: Resolving 'image' alias to: {resolved}"
)
return
resolved
# Check if model is "audio" - get first audio model
if
model
==
"audio"
:
audio_models
=
getattr
(
self
.
model_manager
,
'audio_models'
,
[])
if
audio_models
:
return
audio_models
[
0
]
return
model
resolved
=
audio_models
[
0
]
if
audio_models
else
model
print
(
f
"DEBUG litellm: Resolving 'audio' alias to: {resolved}"
)
return
resolved
# Check if model is "tts" - get tts model
if
model
==
"tts"
:
tts_model
=
getattr
(
self
.
model_manager
,
'tts_model'
,
None
)
print
(
f
"DEBUG litellm: Resolving 'tts' alias to: {tts_model}"
)
if
tts_model
:
return
tts_model
return
model
...
...
@@ -203,8 +212,11 @@ class LiteLLMBackend:
# Check custom aliases registered via --model-alias
model_aliases
=
getattr
(
self
.
model_manager
,
'model_aliases'
,
{})
if
model
in
model_aliases
:
return
model_aliases
[
model
]
resolved
=
model_aliases
[
model
]
print
(
f
"DEBUG litellm: Resolving alias '{model}' to: {resolved}"
)
return
resolved
print
(
f
"DEBUG litellm: Model '{model}' is not an alias, returning as-is"
)
return
model
def
_convert_messages
(
self
,
messages
:
List
[
Dict
])
->
List
[
Dict
]:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment