Replies: 2 comments 1 reply
-
要在LCEL中将 from langchain_core.runnables import RunnableLambda, RunnableParallel
runnable1 = RunnableLambda(lambda x: {"foo": x})
runnable2 = RunnableLambda(lambda x: [x] * 2)
chain = RunnableParallel(first=runnable1, second=runnable2)
chain.invoke(2, config={"max_concurrency": 2}) 在你的代码中,可以这样设置: qa_bot_with_docs = (
RunnableParallel(
{
"context": itemgetter("question") | contextual_rerank_retriever,
"question": itemgetter("question"),
}
)
| RunnableParallel(
answer=qa_bot,
prompt=prompt,
gen_question=gem_question_chain,
event=event_extraction_chain,
org=org_extraction_chain,
human=human_extraction_chain,
mind=mind_extraction_chain,
).with_config(config={"max_concurrency": 2})
) 这样设置后, |
Beta Was this translation helpful? Give feedback.
1 reply
-
查看源码后,现阶段并不支持 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
我想让RunnableParallel 部分最大并发为2,即先执行answer、prompt,若prompt执行完成,则执行gen_question,以此类推,最大同时执行两个子chain
System Info
System Information
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found:
Beta Was this translation helpful? Give feedback.
All reactions