Skip to content

Commit be6ada4

Browse files
committed
fix langsmith evaluation related issues
1 parent 2bfc161 commit be6ada4

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

langchain/langsmith/evaluation.ipynb

+39-15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
"本教程展示一个非常简单的 LLM 应用(分类器)的评估流程,该应用会将输入数据标记为“有毒(Toxic)”或“无毒(Not Toxic)”。"
1818
]
1919
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"id": "4913e104-82e6-4932-8e80-2b8bd57553c3",
24+
"metadata": {},
25+
"outputs": [],
26+
"source": [
27+
"!pip show langsmith"
28+
]
29+
},
2030
{
2131
"cell_type": "markdown",
2232
"id": "9c8c8225-42bd-4c9b-adeb-62c83f80c9d3",
@@ -157,19 +167,33 @@
157167
},
158168
{
159169
"cell_type": "code",
160-
"execution_count": 20,
170+
"execution_count": 4,
161171
"id": "eeec0c29-5e85-46e1-915b-619b68627d63",
162172
"metadata": {},
163173
"outputs": [
164174
{
165-
"ename": "ImportError",
166-
"evalue": "cannot import name 'evaluate' from 'langsmith.evaluation' (/home/ubuntu/miniconda3/envs/langchain/lib/python3.10/site-packages/langsmith/evaluation/__init__.py)",
167-
"output_type": "error",
168-
"traceback": [
169-
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
170-
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
171-
"Cell \u001b[0;32mIn[20], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangsmith\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mevaluation\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m evaluate\n\u001b[1;32m 3\u001b[0m \u001b[38;5;66;03m# 数据集名称\u001b[39;00m\n\u001b[1;32m 4\u001b[0m dataset_name \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mToxic Queries\u001b[39m\u001b[38;5;124m\"\u001b[39m\n",
172-
"\u001b[0;31mImportError\u001b[0m: cannot import name 'evaluate' from 'langsmith.evaluation' (/home/ubuntu/miniconda3/envs/langchain/lib/python3.10/site-packages/langsmith/evaluation/__init__.py)"
175+
"name": "stderr",
176+
"output_type": "stream",
177+
"text": [
178+
"/home/ubuntu/miniconda3/envs/langchain/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
179+
" from .autonotebook import tqdm as notebook_tqdm\n"
180+
]
181+
},
182+
{
183+
"name": "stdout",
184+
"output_type": "stream",
185+
"text": [
186+
"View the evaluation results for experiment: 'Toxic Queries-465b0ea2' at:\n",
187+
"https://smith.langchain.com/o/3d35c1a5-b729-4d18-b06d-db0f06a30bc1/datasets/e1df55ff-b66c-4bcf-b5fd-7c63a847136e/compare?selectedSessions=2900c5b7-9dd5-482a-ab79-32888be3d5b9\n",
188+
"\n",
189+
"\n"
190+
]
191+
},
192+
{
193+
"name": "stderr",
194+
"output_type": "stream",
195+
"text": [
196+
"6it [00:01, 4.71it/s]\n"
173197
]
174198
}
175199
],
@@ -218,7 +242,7 @@
218242
},
219243
{
220244
"cell_type": "code",
221-
"execution_count": 23,
245+
"execution_count": 5,
222246
"id": "46817304-1e17-4ca1-a5ba-faebd80c3728",
223247
"metadata": {},
224248
"outputs": [],
@@ -251,7 +275,7 @@
251275
},
252276
{
253277
"cell_type": "code",
254-
"execution_count": null,
278+
"execution_count": 6,
255279
"id": "096e3129-8e5e-42b9-8c42-d59f072f20c5",
256280
"metadata": {},
257281
"outputs": [],
@@ -308,17 +332,17 @@
308332
},
309333
{
310334
"cell_type": "code",
311-
"execution_count": 32,
335+
"execution_count": 7,
312336
"id": "431bbdb3-d4a3-445a-9cfc-2e62adff3ad0",
313337
"metadata": {},
314338
"outputs": [
315339
{
316340
"data": {
317341
"text/plain": [
318-
"\"To build a RAG (Retrieval-Augmented Generation) chain in LangChain Expression Language (LCEL), you integrate components that handle retrieval (searching for relevant information from a database or document collection) and generation (creating responses based on the retrieved information). The LCEL document provided doesn't go into specifics about a RAG chain configuration, but based on the principles of LCEL, I can guide you through constructing a simplified RAG chain using hypothetical LCEL com\""
342+
"\"To build a Retrieval-Augmented Generation (RAG) chain in LCEL, you would need to compose a chain that includes a retriever component to fetch relevant documents or data based on a query, and then pass that retrieved data to a generator model to produce a final output. In LCEL, this would typically involve using `Retriever` and `Generator` components, which you can easily piece together thanks to LCEL's composable nature.\\n\\nThe following example is a simplified step-by-step guide to building a bas\""
319343
]
320344
},
321-
"execution_count": 32,
345+
"execution_count": 7,
322346
"metadata": {},
323347
"output_type": "execute_result"
324348
}
@@ -331,7 +355,7 @@
331355
{
332356
"cell_type": "code",
333357
"execution_count": null,
334-
"id": "1b4ca951-0ed8-41c5-adb9-694776a7a2e7",
358+
"id": "3a974aa5-7f2e-42f0-bcc4-05ad35cc10d7",
335359
"metadata": {},
336360
"outputs": [],
337361
"source": []

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ langchain-core==0.2.1
55
langchain-community==0.2.0
66
langchain-experimental==0.0.59
77
langchain-text-splitters==0.2.0
8-
langsmith==0.1.62
8+
langsmith==0.1.65
99
chromadb==0.4.24
1010
faiss-cpu==1.8.0
1111
gradio==4.22.0

0 commit comments

Comments
 (0)