|
|
|
@ -79,7 +79,12 @@
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"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\"))"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
@ -147,10 +152,11 @@
|
|
|
|
|
" (\"human\", \"{equation_statement}\")\n",
|
|
|
|
|
" ]\n",
|
|
|
|
|
")\n",
|
|
|
|
|
"model = ChatOpenAI(model=\"gpt-4\", temperature=0).bind(function_call={\"name\": \"solver\"}, functions=functions)\n",
|
|
|
|
|
"runnable = (\n",
|
|
|
|
|
" {\"equation_statement\": RunnablePassthrough()} \n",
|
|
|
|
|
" | prompt \n",
|
|
|
|
|
" | ChatOpenAI(model=\"gpt-4\", temperature=0).bind(function_call={\"name\": \"solver\"}, functions=functions)\n",
|
|
|
|
|
" | model\n",
|
|
|
|
|
")\n",
|
|
|
|
|
"runnable.invoke(\"x raised to the third plus seven equals 12\")"
|
|
|
|
|
]
|
|
|
|
|