Daemontatox commited on
Commit
e4bfe20
·
verified ·
1 Parent(s): c09fdef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
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