Accept any single input (#6888)

If I upload a dataset with a single input and output column, we should
be able to let the chain prepare the input without having to maintain a
strict dataset format.
pull/6990/head
Zander Chase 1 year ago committed by GitHub
parent 8502117f62
commit be164b20d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -226,9 +226,10 @@ async def _arun_llm_or_chain(
)
else:
chain = llm_or_chain_factory()
output = await chain.acall(
example.inputs, callbacks=callbacks, tags=tags
)
inputs_ = example.inputs
if len(inputs_) == 1:
inputs_ = next(iter(inputs_.values()))
output = await chain.acall(inputs_, callbacks=callbacks, tags=tags)
outputs.append(output)
except Exception as e:
logger.warning(f"Chain failed for example {example.id}. Error: {e}")
@ -486,7 +487,10 @@ def run_llm_or_chain(
)
else:
chain = llm_or_chain_factory()
output = chain(example.inputs, callbacks=callbacks, tags=tags)
inputs_ = example.inputs
if len(inputs_) == 1:
inputs_ = next(iter(inputs_.values()))
output = chain(inputs_, callbacks=callbacks, tags=tags)
outputs.append(output)
except Exception as e:
logger.warning(f"Chain failed for example {example.id}. Error: {e}")

Loading…
Cancel
Save