Skip to content

Commit

Permalink
Remove mention of LANGCHAIN_COMET_TRACING for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothiraldan committed Feb 2, 2024
1 parent 2180107 commit 788f6d6
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions integrations/llm/langchain/notebooks/Comet_with_Langchain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
"source": [
"# Tracing with Comet\n",
"\n",
"There are two ways to trace your LangChains executions with Comet:\n",
"In order to trace your LangChains executions with Comet:\n",
"\n",
"1. Setting the `LANGCHAIN_COMET_TRACING` environment variable to \"true\". This is the recommended way.\n",
"2. Import the `CometTracer` manually and pass it explicitely."
"1. Import the `CometTracer` manually and pass it explicitely.\n",
"2. Pass it to each execution"
]
},
{
Expand All @@ -109,7 +109,6 @@
"metadata": {},
"outputs": [],
"source": [
"os.environ[\"LANGCHAIN_COMET_TRACING\"] = \"true\"\n",
"from langchain.callbacks.tracers.comet import CometTracer"
]
},
Expand All @@ -132,8 +131,10 @@
"\n",
"llm = OpenAI(temperature=0.9, verbose=True)\n",
"\n",
"callback = CometTracer()\n",
"\n",
"for prompt in [\"Tell me a joke\", \"Tell me a poem\", \"Tell me a fact\"]:\n",
" llm_result = llm.generate([prompt])\n",
" llm_result = llm.generate([prompt], callbacks=[callback])\n",
" print(\"LLM result\", llm_result)"
]
},
Expand Down Expand Up @@ -162,8 +163,10 @@
"prompt_template = PromptTemplate(input_variables=[\"title\"], template=template)\n",
"synopsis_chain = LLMChain(llm=llm, prompt=prompt_template)\n",
"\n",
"callback = CometTracer()\n",
"\n",
"test_prompts = [{\"title\": \"Documentary about Bigfoot in Paris\"}]\n",
"print(synopsis_chain.apply(test_prompts))"
"print(synopsis_chain.apply(test_prompts, callbacks=[callback]))"
]
},
{
Expand All @@ -190,10 +193,21 @@
" llm,\n",
" agent=\"zero-shot-react-description\",\n",
")\n",
"\n",
"callback = CometTracer()\n",
"\n",
"agent.run(\n",
" \"What is 2 raised to .123243 power?\",\n",
" callbacks=[callback],\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 788f6d6

Please sign in to comment.