|
70 | 70 | } |
71 | 71 | ], |
72 | 72 | "source": [ |
| 73 | + "# NBVAL_SKIP\n", |
73 | 74 | "import getpass\n", |
74 | 75 | "import os\n", |
75 | 76 | "\n", |
|
173 | 174 | "REDIS_URL = os.getenv(\"REDIS_URL\", \"redis://localhost:6379\")\n", |
174 | 175 | "\n", |
175 | 176 | "client = Redis.from_url(REDIS_URL)\n", |
176 | | - "client.ping()\n" |
| 177 | + "client.ping()" |
177 | 178 | ] |
178 | 179 | }, |
179 | 180 | { |
|
501 | 502 | "outputs": [], |
502 | 503 | "source": [ |
503 | 504 | "from typing import Literal, TypedDict\n", |
504 | | - "\n", |
505 | 505 | "from langgraph.graph import END, StateGraph\n", |
506 | 506 | "\n", |
507 | 507 | "\n", |
|
526 | 526 | "\n", |
527 | 527 | "# Add nodes\n", |
528 | 528 | "workflow.add_node(\"agent\", call_tool_model)\n", |
529 | | - "\n", |
530 | 529 | "workflow.add_node(\"tools\", tool_node)\n", |
531 | 530 | "workflow.add_node(\"structure_response\", structure_response)\n", |
532 | 531 | "\n", |
|
542 | 541 | "\n", |
543 | 542 | "\n", |
544 | 543 | "# We now add a normal edge from `tools` to `agent`.\n", |
545 | | - "# This means that after `tools` is called, `agent` node is called next.\n", |
546 | 544 | "workflow.add_edge(\"tools\", \"agent\")\n", |
547 | | - "# workflow.add_edge(\"multi_choice_structured\", END)\n", |
548 | 545 | "workflow.add_edge(\"structure_response\", END)\n", |
549 | 546 | "\n", |
550 | 547 | "\n", |
551 | | - "# Finally, we compile it!\n", |
552 | 548 | "# This compiles it into a LangChain Runnable,\n", |
553 | 549 | "# meaning you can use it as you would any other runnable\n", |
554 | 550 | "graph = workflow.compile()\n" |
|
641 | 637 | "cell_type": "markdown", |
642 | 638 | "metadata": {}, |
643 | 639 | "source": [ |
644 | | - "## Scenario 2" |
| 640 | + "## Scenario 2 - restocking tool\n", |
| 641 | + "\n", |
| 642 | + "In this test we want to see the agent choose the restocking tool and choose to use the multiple choice output." |
645 | 643 | ] |
646 | 644 | }, |
647 | 645 | { |
|
693 | 691 | "cell_type": "markdown", |
694 | 692 | "metadata": {}, |
695 | 693 | "source": [ |
696 | | - "## Scenario 3" |
| 694 | + "## Scenario 3 - retriever tool\n", |
| 695 | + "\n", |
| 696 | + "In this test, we want to see the retrieval tool invoked and multiple choice structured response." |
697 | 697 | ] |
698 | 698 | }, |
699 | 699 | { |
|
981 | 981 | " \n", |
982 | 982 | " return graph.invoke({\"messages\": question})\n" |
983 | 983 | ] |
984 | | - }, |
985 | | - { |
986 | | - "cell_type": "code", |
987 | | - "execution_count": null, |
988 | | - "metadata": {}, |
989 | | - "outputs": [], |
990 | | - "source": [] |
991 | 984 | } |
992 | 985 | ], |
993 | 986 | "metadata": { |
|
0 commit comments