mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-13 16:36:06 +00:00
runnable bind how to nit (#10718)
This commit is contained in:
parent
c3e52ba8ab
commit
3992c1ae9b
@ -79,7 +79,12 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"runnable = {\"equation_statement\": RunnablePassthrough()} | prompt | model.bind(stop=\"SOLUTION\") | StrOutputParser()\n",
|
"runnable = (\n",
|
||||||
|
" {\"equation_statement\": RunnablePassthrough()} \n",
|
||||||
|
" | prompt \n",
|
||||||
|
" | model.bind(stop=\"SOLUTION\") \n",
|
||||||
|
" | StrOutputParser()\n",
|
||||||
|
")\n",
|
||||||
"print(runnable.invoke(\"x raised to the third plus seven equals 12\"))"
|
"print(runnable.invoke(\"x raised to the third plus seven equals 12\"))"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -147,10 +152,11 @@
|
|||||||
" (\"human\", \"{equation_statement}\")\n",
|
" (\"human\", \"{equation_statement}\")\n",
|
||||||
" ]\n",
|
" ]\n",
|
||||||
")\n",
|
")\n",
|
||||||
|
"model = ChatOpenAI(model=\"gpt-4\", temperature=0).bind(function_call={\"name\": \"solver\"}, functions=functions)\n",
|
||||||
"runnable = (\n",
|
"runnable = (\n",
|
||||||
" {\"equation_statement\": RunnablePassthrough()} \n",
|
" {\"equation_statement\": RunnablePassthrough()} \n",
|
||||||
" | prompt \n",
|
" | prompt \n",
|
||||||
" | ChatOpenAI(model=\"gpt-4\", temperature=0).bind(function_call={\"name\": \"solver\"}, functions=functions)\n",
|
" | model\n",
|
||||||
")\n",
|
")\n",
|
||||||
"runnable.invoke(\"x raised to the third plus seven equals 12\")"
|
"runnable.invoke(\"x raised to the third plus seven equals 12\")"
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user