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
0653c58a
Commit
0653c58a
authored
Mar 17, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add debug output for model input in both streaming and non-streaming modes
parent
3890a849
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
coderai
coderai
+43
-0
No files found.
coderai
View file @
0653c58a
...
@@ -5791,6 +5791,28 @@ async def stream_chat_response(
...
@@ -5791,6 +5791,28 @@ async def stream_chat_response(
try
:
try
:
chunk_count
=
0
chunk_count
=
0
#
Debug
:
Print
what
is
being
passed
to
the
model
if
global_debug
:
print
(
f
"
\n
{'='*80}"
)
print
(
f
"=== MODEL INPUT (DEBUG) ==="
)
print
(
f
"{'='*80}"
)
print
(
f
"Model: {model_name}"
)
print
(
f
"Max tokens: {max_tokens}"
)
print
(
f
"Temperature: {temperature}"
)
print
(
f
"Top P: {top_p}"
)
print
(
f
"Stop sequences: {stop}"
)
print
(
f
"Tools: {tools is not None}"
)
print
(
f
"Response format: {response_format}"
)
print
(
f
"
\n
--- Messages ---"
)
for
i
,
msg
in
enumerate
(
messages
):
role
=
msg
.
get
(
'role'
,
'unknown'
)
content
=
msg
.
get
(
'content'
,
''
)
if
content
and
len
(
content
)
>
500
:
content
=
content
[:
500
]
+
"... [truncated]"
print
(
f
"[{i}] {role}: {repr(content)}"
)
print
(
f
"{'='*80}
\n
"
)
#
Use
generate_chat_stream
for
proper
chat
template
handling
#
Use
generate_chat_stream
for
proper
chat
template
handling
async
for
chunk
in
current_manager
.
generate_chat_stream
(
async
for
chunk
in
current_manager
.
generate_chat_stream
(
messages
=
messages
,
messages
=
messages
,
...
@@ -5991,6 +6013,27 @@ async def generate_chat_response(
...
@@ -5991,6 +6013,27 @@ async def generate_chat_response(
completion_id = f"chatcmpl-{uuid.uuid4().hex}"
completion_id = f"chatcmpl-{uuid.uuid4().hex}"
created = int(time.time())
created = int(time.time())
# Debug: Print what is being passed to the model
if global_debug:
print(f"\n{'
=
'*80}")
print(f"=== MODEL INPUT (DEBUG) ===")
print(f"{'
=
'*80}")
print(f"Model: {model_name}")
print(f"Max tokens: {max_tokens}")
print(f"Temperature: {temperature}")
print(f"Top P: {top_p}")
print(f"Stop sequences: {stop}")
print(f"Tools: {tools is not None}")
print(f"Response format: {response_format}")
print(f"\n--- Messages ---")
for i, msg in enumerate(messages):
role = msg.get('
role
', '
unknown
')
content = msg.get('
content
', '')
if content and len(content) > 500:
content = content[:500] + "... [truncated]"
print(f"[{i}] {role}: {repr(content)}")
print(f"{'
=
'*80}\n")
try:
try:
# Use generate_chat for proper chat template handling
# Use generate_chat for proper chat template handling
generated_text = current_manager.generate_chat(
generated_text = current_manager.generate_chat(
...
...
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