mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
[Core] Patch: rm dumpd of outputs from runnables/base (#18295)
It obstructs evaluations when your return a pydantic object.
This commit is contained in:
parent
c7d5ed6f5c
commit
fdab931fd3
@ -1272,7 +1272,7 @@ class Runnable(Generic[Input, Output], ABC):
|
||||
run_manager.on_chain_error(e)
|
||||
raise
|
||||
else:
|
||||
run_manager.on_chain_end(dumpd(output))
|
||||
run_manager.on_chain_end(output)
|
||||
return output
|
||||
|
||||
async def _acall_with_config(
|
||||
@ -1315,7 +1315,7 @@ class Runnable(Generic[Input, Output], ABC):
|
||||
await run_manager.on_chain_error(e)
|
||||
raise
|
||||
else:
|
||||
await run_manager.on_chain_end(dumpd(output))
|
||||
await run_manager.on_chain_end(output)
|
||||
return output
|
||||
|
||||
def _batch_with_config(
|
||||
@ -1379,7 +1379,7 @@ class Runnable(Generic[Input, Output], ABC):
|
||||
first_exception = first_exception or out
|
||||
run_manager.on_chain_error(out)
|
||||
else:
|
||||
run_manager.on_chain_end(dumpd(out))
|
||||
run_manager.on_chain_end(out)
|
||||
if return_exceptions or first_exception is None:
|
||||
return cast(List[Output], output)
|
||||
else:
|
||||
@ -1454,7 +1454,7 @@ class Runnable(Generic[Input, Output], ABC):
|
||||
first_exception = first_exception or out
|
||||
coros.append(run_manager.on_chain_error(out))
|
||||
else:
|
||||
coros.append(run_manager.on_chain_end(dumpd(out)))
|
||||
coros.append(run_manager.on_chain_end(out))
|
||||
await asyncio.gather(*coros)
|
||||
if return_exceptions or first_exception is None:
|
||||
return cast(List[Output], output)
|
||||
@ -2238,7 +2238,7 @@ class RunnableSequence(RunnableSerializable[Input, Output]):
|
||||
first_exception = first_exception or out
|
||||
run_manager.on_chain_error(out)
|
||||
else:
|
||||
run_manager.on_chain_end(dumpd(out))
|
||||
run_manager.on_chain_end(out)
|
||||
if return_exceptions or first_exception is None:
|
||||
return cast(List[Output], inputs)
|
||||
else:
|
||||
@ -2363,7 +2363,7 @@ class RunnableSequence(RunnableSerializable[Input, Output]):
|
||||
first_exception = first_exception or out
|
||||
coros.append(run_manager.on_chain_error(out))
|
||||
else:
|
||||
coros.append(run_manager.on_chain_end(dumpd(out)))
|
||||
coros.append(run_manager.on_chain_end(out))
|
||||
await asyncio.gather(*coros)
|
||||
if return_exceptions or first_exception is None:
|
||||
return cast(List[Output], inputs)
|
||||
|
@ -476,6 +476,10 @@ def _get_standardized_outputs(
|
||||
"""
|
||||
outputs = load(run.outputs)
|
||||
if schema_format == "original":
|
||||
if run.run_type == "prompt" and "output" in outputs:
|
||||
# These were previously dumped before the tracer.
|
||||
# Now we needn't do anything to them.
|
||||
return outputs["output"]
|
||||
# Return the old schema, without standardizing anything
|
||||
return outputs
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user