diff --git a/backend/chainlit/langchain/callbacks.py b/backend/chainlit/langchain/callbacks.py index b0aec29cec..651b718307 100644 --- a/backend/chainlit/langchain/callbacks.py +++ b/backend/chainlit/langchain/callbacks.py @@ -353,7 +353,7 @@ def _build_llm_settings( return provider, settings -DEFAULT_TO_IGNORE = ["RunnableSequence", "RunnableParallel", ""] +DEFAULT_TO_IGNORE = ["Runnable", ""] DEFAULT_TO_KEEP = ["retriever", "llm", "agent", "chain", "tool"] @@ -442,9 +442,14 @@ def _should_ignore_run(self, run: Run): # so we can re-attach a kept child to the right parent id self.parent_id_map[str(run.id)] = parent_id - ignore_by_name = run.name in self.to_ignore + ignore_by_name = False ignore_by_parent = parent_id in self.ignored_runs + for filter in self.to_ignore: + if filter in run.name: + ignore_by_name = True + break + ignore = ignore_by_name or ignore_by_parent # If the ignore cause is the parent being ignored, check if we should nonetheless keep the child