Spaces:
Paused
Paused
Add more debug logging to trace stream iteration
Browse files- llm/oai.py +2 -0
llm/oai.py
CHANGED
|
@@ -158,6 +158,7 @@ class TextChatAtOAI(BaseFnCallModel):
|
|
| 158 |
logger.error(f"An OpenAI error occurred: {ex}")
|
| 159 |
raise ModelServiceError(exception=ex) from ex
|
| 160 |
|
|
|
|
| 161 |
if delta_stream:
|
| 162 |
chunk_count = 0
|
| 163 |
for chunk in response:
|
|
@@ -184,6 +185,7 @@ class TextChatAtOAI(BaseFnCallModel):
|
|
| 184 |
function_json = json.dumps(function_call, ensure_ascii=False)
|
| 185 |
yield [Message(role=ASSISTANT, content=f'<tool_call>{function_json}</tool_call>')]
|
| 186 |
logger.info(f'delta_stream message chunk: {chunk}')
|
|
|
|
| 187 |
else:
|
| 188 |
full_response = ''
|
| 189 |
full_reasoning_content = ''
|
|
|
|
| 158 |
logger.error(f"An OpenAI error occurred: {ex}")
|
| 159 |
raise ModelServiceError(exception=ex) from ex
|
| 160 |
|
| 161 |
+
logger.info(f'delta_stream={delta_stream}, response={response}')
|
| 162 |
if delta_stream:
|
| 163 |
chunk_count = 0
|
| 164 |
for chunk in response:
|
|
|
|
| 185 |
function_json = json.dumps(function_call, ensure_ascii=False)
|
| 186 |
yield [Message(role=ASSISTANT, content=f'<tool_call>{function_json}</tool_call>')]
|
| 187 |
logger.info(f'delta_stream message chunk: {chunk}')
|
| 188 |
+
logger.info(f'delta_stream finished, total chunks: {chunk_count}')
|
| 189 |
else:
|
| 190 |
full_response = ''
|
| 191 |
full_reasoning_content = ''
|