mirror of
https://github.com/hwchase17/langchain.git
synced 2025-04-27 19:46:55 +00:00
core[patch]: drop redundant chat model trace content
This commit is contained in:
parent
54eab796ab
commit
c107675125
@ -72,6 +72,19 @@ def _run_to_dict(run: Run, exclude_inputs: bool = False) -> dict:
|
||||
# run.model_dump
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", category=PydanticDeprecationWarning)
|
||||
if (
|
||||
run.outputs
|
||||
and run.outputs.get("generations")
|
||||
and isinstance(run.outputs["generations"], list)
|
||||
and run.outputs["generations"]
|
||||
and isinstance(run.outputs["generations"][0], list)
|
||||
and run.outputs["generations"][0]
|
||||
and isinstance(run.outputs["generations"][0][0], dict)
|
||||
and "text" in run.outputs["generations"][0][0]
|
||||
and "message" in run.outputs["generations"][0][0]
|
||||
):
|
||||
# Drop redundant text contents from trace
|
||||
run.outputs["generations"][0][0]["text"] = None
|
||||
|
||||
res = {
|
||||
**run.dict(exclude={"child_runs", "inputs", "outputs"}),
|
||||
|
Loading…
Reference in New Issue
Block a user