mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 23:29:21 +00:00
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.
This commit is contained in:
parent
8502117f62
commit
be164b20d8
@ -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…
Reference in New Issue
Block a user