126 except Exception as e:
127 if not group_cm.ended:
128▶ run_manager.on_chain_error(e)
129 raise
130 else:
· · ·
209 except Exception as e:
210 if not group_cm.ended:
211▶ await run_manager.on_chain_error(e)
212 raise
213 else:
· · ·
245 # `call-arg` used to not fail 3.9 or 3.10 tests
246 return await asyncio.shield(task)
247▶ except TypeError:
248 # Python < 3.11 fallback - create task normally then shield
249 # This won't preserve context perfectly but is better than nothing
· · ·
262 """Wrap an async `on_chat_model_start` coroutine with fallback.
263
264▶ Catches `NotImplementedError` and triggers the `on_llm_start` fallback.
265 This covers async handlers invoked from a **sync** `handle_event` call,
266 where the coroutine is collected into `coros` and executed later by
· · ·
267▶ `_run_coros`. Without this wrapper the `NotImplementedError` would be
268 caught generically by `_run_coros` and the trace would be lost.
269 """
+ 89 more matches in this file