Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -233,6 +233,9 @@ async def astream_processor(chain, inputs: dict) -> AsyncGenerator[str, None]:
|
|
| 233 |
async for chunk in chain.astream(inputs):
|
| 234 |
if isinstance(chunk, dict):
|
| 235 |
content = chunk.get('content', '')
|
|
|
|
|
|
|
|
|
|
| 236 |
else:
|
| 237 |
content = str(chunk)
|
| 238 |
yield content
|
|
|
|
| 233 |
async for chunk in chain.astream(inputs):
|
| 234 |
if isinstance(chunk, dict):
|
| 235 |
content = chunk.get('content', '')
|
| 236 |
+
elif hasattr(chunk, 'model_dump'):
|
| 237 |
+
# If the chunk has a model_dump method, convert it to a dictionary and get the content
|
| 238 |
+
content = chunk.model_dump().get('content', '')
|
| 239 |
else:
|
| 240 |
content = str(chunk)
|
| 241 |
yield content
|