ConversationChain .run()、.predict()、.generate() 不会接受上下文

问题描述 投票:0回答:1

我正在利用 Hugginface 和 langchain 来实施内部法学硕士。我试图将我的问题和上下文参数传递到我的 ConversationChain 对象中,但它不允许我传递多个输入。如果它是单个输入,则一切正常。

但是有两个的时候是否是这样直接传入

conversation.run(input = input, context = context)

或各种字典格式,如

inputs = {
    'input': input,
    'context': context
}

conversation.run(**inputs)

我收到了

ValueError: One input key expected got ['input', 'context']

即使我使用.generate()、.predict()或conversation(),这也成立

我尝试实施 Bananenfraese 和 aigloss here 提出的解决方法,但遇到了一组全新的错误

我还访问了 Langchain Docs,甚至它们在示例中将上下文传递给 .run() 函数。我不知道文档是否尚未更新,或者我需要使用不同版本的langchain(我正在使用最新的),但任何帮助将不胜感激。

# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' string:
question = "What's the temperature in Boise, Idaho?"
context = "Weather report for Boise, Idaho on 07/03/23..."
chain.run(question=question, context=context)
python artificial-intelligence chatbot langchain large-language-model
1个回答
0
投票

我也遇到了和你一样的问题。那你找到解决办法了吗?

© www.soinside.com 2019 - 2024. All rights reserved.