|
6 | 6 | "id": "e43f4ea0",
|
7 | 7 | "metadata": {},
|
8 | 8 | "source": [
|
9 |
| - "# Weights & Biases\n", |
| 9 | + "# Weights & Biases tracking\n", |
10 | 10 | "\n",
|
11 |
| - "This notebook goes over how to track your LangChain experiments into one centralized Weights and Biases dashboard. To learn more about prompt engineering and the callback please refer to this Report which explains both alongside the resultant dashboards you can expect to see.\n", |
| 11 | + "This notebook goes over how to track your LangChain experiments into one centralized `Weights and Biases` dashboard. \n", |
12 | 12 | "\n",
|
| 13 | + "To learn more about prompt engineering and the callback please refer to this notebook which explains both alongside the resultant dashboards you can expect to see:\n", |
13 | 14 | "\n",
|
14 | 15 | "<a href=\"https://colab.research.google.com/drive/1DXH4beT4HFaRKy_Vm4PoxhXVDRf7Ym8L?usp=sharing\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>\n",
|
15 | 16 | "\n",
|
16 | 17 | "\n",
|
17 |
| - "[View Report](https://wandb.ai/a-sh0ts/langchain_callback_demo/reports/Prompt-Engineering-LLMs-with-LangChain-and-W-B--VmlldzozNjk1NTUw#👋-how-to-build-a-callback-in-langchain-for-better-prompt-engineering\n", |
18 |
| - ") \n", |
| 18 | + "View a detailed description and examples in the [W&B article](https://wandb.ai/a-sh0ts/langchain_callback_demo/reports/Prompt-Engineering-LLMs-with-LangChain-and-W-B--VmlldzozNjk1NTUw#👋-how-to-build-a-callback-in-langchain-for-better-prompt-engineering\n", |
| 19 | + "). \n", |
19 | 20 | "\n",
|
20 | 21 | "\n",
|
21 |
| - "**Note**: _the `WandbCallbackHandler` is being deprecated in favour of the `WandbTracer`_ . In future please use the `WandbTracer` as it is more flexible and allows for more granular logging. To know more about the `WandbTracer` refer to the [agent_with_wandb_tracing](/docs/integrations/providers/wandb_tracing) notebook or use the following [colab notebook](http://wandb.me/prompts-quickstart). To know more about Weights & Biases Prompts refer to the following [prompts documentation](https://docs.wandb.ai/guides/prompts)." |
| 22 | + "**Note**: _the `WandbCallbackHandler` is being deprecated in favour of the `WandbTracer`_ . In future please use the `WandbTracer` as it is more flexible and allows for more granular logging. \n", |
| 23 | + "\n", |
| 24 | + "To know more about the `WandbTracer` refer to the [agent_with_wandb_tracing](/docs/integrations/providers/wandb_tracing) notebook or use the following [colab notebook](http://wandb.me/prompts-quickstart). \n", |
| 25 | + "\n", |
| 26 | + "To know more about Weights & Biases Prompts refer to the following [prompts documentation](https://docs.wandb.ai/guides/prompts)." |
22 | 27 | ]
|
23 | 28 | },
|
24 | 29 | {
|
|
248 | 253 | "The `flush_tracker` function is used to log LangChain sessions to Weights & Biases. It takes in the LangChain module or agent, and logs at minimum the prompts and generations alongside the serialized form of the LangChain module to the specified Weights & Biases project. By default we reset the session as opposed to concluding the session outright."
|
249 | 254 | ]
|
250 | 255 | },
|
| 256 | + { |
| 257 | + "cell_type": "markdown", |
| 258 | + "id": "483eefd4-633e-4686-8730-944705fe8a80", |
| 259 | + "metadata": { |
| 260 | + "execution": { |
| 261 | + "iopub.execute_input": "2024-11-12T18:20:31.003316Z", |
| 262 | + "iopub.status.busy": "2024-11-12T18:20:31.003152Z", |
| 263 | + "iopub.status.idle": "2024-11-12T18:20:31.006033Z", |
| 264 | + "shell.execute_reply": "2024-11-12T18:20:31.005546Z", |
| 265 | + "shell.execute_reply.started": "2024-11-12T18:20:31.003303Z" |
| 266 | + } |
| 267 | + }, |
| 268 | + "source": [ |
| 269 | + "## Usage Scenarios" |
| 270 | + ] |
| 271 | + }, |
| 272 | + { |
| 273 | + "cell_type": "markdown", |
| 274 | + "id": "066adc04-8180-4936-8d75-5c3660b61de7", |
| 275 | + "metadata": { |
| 276 | + "execution": { |
| 277 | + "iopub.execute_input": "2024-11-12T18:20:45.826326Z", |
| 278 | + "iopub.status.busy": "2024-11-12T18:20:45.825714Z", |
| 279 | + "iopub.status.idle": "2024-11-12T18:20:45.830483Z", |
| 280 | + "shell.execute_reply": "2024-11-12T18:20:45.830037Z", |
| 281 | + "shell.execute_reply.started": "2024-11-12T18:20:45.826279Z" |
| 282 | + } |
| 283 | + }, |
| 284 | + "source": [ |
| 285 | + "### With LLM" |
| 286 | + ] |
| 287 | + }, |
251 | 288 | {
|
252 | 289 | "cell_type": "code",
|
253 | 290 | "execution_count": 4,
|
|
373 | 410 | "wandb_callback.flush_tracker(llm, name=\"simple_sequential\")"
|
374 | 411 | ]
|
375 | 412 | },
|
| 413 | + { |
| 414 | + "cell_type": "markdown", |
| 415 | + "id": "7dcfc24b-f0b0-48ec-89ce-beeb2fb763d5", |
| 416 | + "metadata": {}, |
| 417 | + "source": [ |
| 418 | + "### Within Chains" |
| 419 | + ] |
| 420 | + }, |
376 | 421 | {
|
377 | 422 | "cell_type": "code",
|
378 | 423 | "execution_count": 5,
|
|
524 | 569 | "wandb_callback.flush_tracker(synopsis_chain, name=\"agent\")"
|
525 | 570 | ]
|
526 | 571 | },
|
| 572 | + { |
| 573 | + "cell_type": "markdown", |
| 574 | + "id": "533cd4c9-56e2-4ad9-a83e-4653bfcf322f", |
| 575 | + "metadata": {}, |
| 576 | + "source": [ |
| 577 | + "### With Agents" |
| 578 | + ] |
| 579 | + }, |
527 | 580 | {
|
528 | 581 | "cell_type": "code",
|
529 | 582 | "execution_count": 7,
|
|
646 | 699 | "name": "python",
|
647 | 700 | "nbconvert_exporter": "python",
|
648 | 701 | "pygments_lexer": "ipython3",
|
649 |
| - "version": "3.9.1" |
| 702 | + "version": "3.10.12" |
650 | 703 | }
|
651 | 704 | },
|
652 | 705 | "nbformat": 4,
|
|
0 commit comments