Skip to content

Commit

Permalink
fix langsmith link with proper tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Jul 17, 2024
1 parent 402f738 commit 3cb6ed4
Showing 1 changed file with 15 additions and 28 deletions.
43 changes: 15 additions & 28 deletions docs/core_docs/docs/how_to/convert_runnable_to_tool.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,6 @@
"```"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "d06c9f2a-4475-450f-9106-54db1d99623b",
"metadata": {},
"outputs": [],
"source": [
"import { ChatOpenAI } from \"@langchain/openai\";\n",
"\n",
"const llm = new ChatOpenAI({ model: \"gpt-3.5-turbo-0125\", temperature: 0 })"
]
},
{
"cell_type": "markdown",
"id": "e8a2038a-d762-4196-b5e3-fdb89c11e71d",
Expand All @@ -214,15 +202,14 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 2,
"id": "23d2a47e-6712-4294-81c8-2c1d76b4bb81",
"metadata": {},
"outputs": [],
"source": [
"import { Document } from \"@langchain/core/documents\"\n",
"import { MemoryVectorStore } from \"langchain/vectorstores/memory\";\n",
"import { OpenAIEmbeddings } from \"@langchain/openai\";\n",
"import { RunnableLambda } from \"@langchain/core/runnables\";\n",
"\n",
"const documents = [\n",
" new Document({\n",
Expand Down Expand Up @@ -253,7 +240,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 8,
"id": "c939cf2a-60e9-4afd-8b47-84d76ccb13f5",
"metadata": {},
"outputs": [],
Expand All @@ -273,7 +260,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 9,
"id": "be29437b-a187-4a0a-9a5d-419c56f2434e",
"metadata": {},
"outputs": [
Expand All @@ -288,15 +275,15 @@
" name: 'pet_info_retriever',\n",
" args: [Object],\n",
" type: 'tool_call',\n",
" id: 'call_VHSXMmcH5MRCXhqNXP6O4NLD'\n",
" id: 'call_HAyKm6RayDyup1aj75Jfxl11'\n",
" }\n",
" ]\n",
"}\n",
"----\n",
"ToolMessage {\n",
" name: 'pet_info_retriever',\n",
" content: '[{\"pageContent\":\"Dogs are great companions, known for their loyalty and friendliness.\",\"metadata\":{}}]',\n",
" tool_call_id: 'call_VHSXMmcH5MRCXhqNXP6O4NLD'\n",
" tool_call_id: 'call_HAyKm6RayDyup1aj75Jfxl11'\n",
"}\n",
"----\n",
"AIMessage {\n",
Expand Down Expand Up @@ -333,7 +320,7 @@
"```{=mdx}\n",
"\n",
":::tip\n",
"See [LangSmith trace](https://smith.langchain.com/public/f0c01a8f-e02b-4c4d-8ca9-a1377d26c82d/r) for the above run.\n",
"See [LangSmith trace](https://smith.langchain.com/public/7fc14abe-042d-421b-8c98-a705a8cc5c41/r) for the above run.\n",
":::\n",
"\n",
"```"
Expand All @@ -349,7 +336,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 7,
"id": "bea518c9-c711-47c2-b8cc-dbd102f71f09",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -379,7 +366,7 @@
"\n",
"const ragChain = RunnableSequence.from([\n",
" RunnablePassthrough.assign({\n",
" context: (input: RagChainInput) => retriever.invoke(input.question),\n",
" context: async (input: RagChainInput, config) => retriever.invoke(input.question, config),\n",
" }),\n",
" prompt,\n",
" llm,\n",
Expand All @@ -389,7 +376,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 8,
"id": "a3f9cf5b-8c71-4b0f-902b-f92e028780c9",
"metadata": {},
"outputs": [],
Expand All @@ -414,7 +401,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 10,
"id": "06409913-a2ad-400f-a202-7b8dd2ef483a",
"metadata": {},
"outputs": [
Expand All @@ -428,18 +415,18 @@
" name: 'pet_expert',\n",
" args: { question: 'What are dogs known for?', answer_style: 'pirate' },\n",
" type: 'tool_call',\n",
" id: 'call_IU6i9sr8rtTn4RLTfUUNZD1I'\n",
" id: 'call_rWmwOVaPNaJ1PvrrN8QJDOeu'\n",
" }\n",
"}\n",
"----\n",
"ToolMessage {\n",
" name: 'pet_expert',\n",
" content: \"Arrr, dogs be known for their loyalty to their mateys, their keen sense o' smell for sniffin' out treasure, and their bark that can make even the bravest pirate shiver in their boots!\",\n",
" tool_call_id: 'call_IU6i9sr8rtTn4RLTfUUNZD1I'\n",
" content: \"Arrr, dogs be known fer their loyalty to their mateys, their keen sense o' smell, and their barkin' to alert ye of danger. They be good companions on land and sea, always ready to stand by yer side. Dogs be fetchin', protectin', and bringin' joy to all who befriend 'em.\",\n",
" tool_call_id: 'call_rWmwOVaPNaJ1PvrrN8QJDOeu'\n",
"}\n",
"----\n",
"AIMessage {\n",
" content: 'A pirate would say that dogs are known for their loyalty to their mateys, their keen sense of smell for sniffing out treasure, and their bark that can make even the bravest pirate shiver in their boots!',\n",
" content: \"A pirate would say that dogs are known for their loyalty to their mateys, their keen sense of smell, and their barkin' to alert ye of danger. They are good companions on land and sea, always ready to stand by yer side. Dogs be fetchin', protectin', and bringin' joy to all who befriend 'em.\",\n",
" tool_calls: undefined\n",
"}\n",
"----\n"
Expand Down Expand Up @@ -475,7 +462,7 @@
"\n",
":::tip\n",
"\n",
"See [LangSmith trace](https://smith.langchain.com/public/678618e6-2d7f-4c1a-bcd0-d91873d50cc7/r) for the above run.\n",
"See [LangSmith trace](https://smith.langchain.com/public/7a5d93ab-3b9a-43f4-87af-947bf9999cb4/r) for the above run.\n",
"\n",
":::\n",
"\n",
Expand Down

0 comments on commit 3cb6ed4

Please sign in to comment.