mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-06 09:47:51 +02:00
[Docs] use END instead of set_finish_point (#903)
This commit is contained in:
@@ -129,6 +129,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain_openai import ChatOpenAI\n",
|
||||
"\n",
|
||||
"model_tested = \"gpt-4o\"\n",
|
||||
"metadata = \"CRAG, gpt-4o\"\n",
|
||||
"llm = ChatOpenAI(model_name=model_tested, temperature=0)"
|
||||
@@ -150,6 +151,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain_fireworks import ChatFireworks\n",
|
||||
"\n",
|
||||
"model_tested = \"firefunction-v2\"\n",
|
||||
"metadata = \"CRAG, firefunction-v\"\n",
|
||||
"llm = ChatFireworks(model=\"accounts/fireworks/models/firefunction-v2\", temperature=0)"
|
||||
@@ -344,9 +346,9 @@
|
||||
"source": [
|
||||
"@tool\n",
|
||||
"def generate_answer(answer: str) -> str:\n",
|
||||
" \"\"\"You are an assistant for question-answering tasks. \n",
|
||||
" Use the retrieved documents to answer the user question. \n",
|
||||
" If you don't know the answer, just say that you don't know. \n",
|
||||
" \"\"\"You are an assistant for question-answering tasks.\n",
|
||||
" Use the retrieved documents to answer the user question.\n",
|
||||
" If you don't know the answer, just say that you don't know.\n",
|
||||
" Use three sentences maximum and keep the answer concise\"\"\"\n",
|
||||
" return f\"Here is the answer to the user question: {answer}\""
|
||||
]
|
||||
@@ -439,7 +441,7 @@
|
||||
" (\n",
|
||||
" \"system\",\n",
|
||||
" \" You are a helpful assistant tasked with answering user questions using the provided vector store. \"\n",
|
||||
" \" Use the provided vector store to retrieve documents. Then grade them to ensure they are relevant before answering the question. \"\n",
|
||||
" \" Use the provided vector store to retrieve documents. Then grade them to ensure they are relevant before answering the question. \",\n",
|
||||
" ),\n",
|
||||
" (\"placeholder\", \"{messages}\"),\n",
|
||||
" ]\n",
|
||||
@@ -629,7 +631,8 @@
|
||||
" ]\n",
|
||||
" return tool_calls\n",
|
||||
"\n",
|
||||
"find_tool_calls_react(response['messages'])"
|
||||
"\n",
|
||||
"find_tool_calls_react(response[\"messages\"])"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1080,6 +1083,7 @@
|
||||
"# Grade prompt\n",
|
||||
"grade_prompt_answer_accuracy = hub.pull(\"langchain-ai/rag-answer-vs-reference\")\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def answer_evaluator(run, example) -> dict:\n",
|
||||
" \"\"\"\n",
|
||||
" A simple evaluator for RAG answer accuracy\n",
|
||||
@@ -1140,6 +1144,7 @@
|
||||
" \"generate_answer\",\n",
|
||||
"]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def check_trajectory_react(root_run: Run, example: Example) -> dict:\n",
|
||||
" \"\"\"\n",
|
||||
" Check if all expected tools are called in exact order and without any additional tool calls.\n",
|
||||
|
||||
Reference in New Issue
Block a user