Skip to content

Commit

Permalink
Merge branch 'master' into users/akataria/FTS_cosmos_nosql
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush3011 authored Dec 14, 2024
2 parents 0d2ef2e + fc80061 commit a58d28e
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 8 deletions.
42 changes: 42 additions & 0 deletions docs/docs/integrations/providers/wandb.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Weights & Biases

>[Weights & Biases](https://wandb.ai/) is provider of the AI developer platform to train and
> fine-tune AI models and develop AI applications.
`Weights & Biase` products can be used to log metrics and artifacts during training,
and to trace the execution of your code.

There are several main ways to use `Weights & Biases` products within LangChain:
- with `wandb_tracing_enabled`
- with `Weave` lightweight toolkit
- with `WandbCallbackHandler` (deprecated)


## wandb_tracing_enabled

See a [usage example](/docs/integrations/providers/wandb_tracing).

See in the [W&B documentation](https://docs.wandb.ai/guides/integrations/langchain).

```python
from langchain_community.callbacks import wandb_tracing_enabled
```

## Weave

See in the [W&B documentation](https://weave-docs.wandb.ai/guides/integrations/langchain).


## WandbCallbackHandler

**Note:** the `WandbCallbackHandler` is being deprecated in favour of the `wandb_tracing_enabled`.

See a [usage example](/docs/integrations/providers/wandb_tracking).

See in the [W&B documentation](https://docs.wandb.ai/guides/integrations/langchain).

```python
from langchain_community.callbacks import WandbCallbackHandler
```


4 changes: 2 additions & 2 deletions docs/docs/integrations/providers/wandb_tracing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "5371a9bb",
"metadata": {},
"source": [
"# WandB Tracing\n",
"# Weights & Biases tracing\n",
"\n",
"There are two recommended ways to trace your LangChains:\n",
"\n",
Expand Down Expand Up @@ -165,7 +165,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
65 changes: 59 additions & 6 deletions docs/docs/integrations/providers/wandb_tracking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@
"id": "e43f4ea0",
"metadata": {},
"source": [
"# Weights & Biases\n",
"# Weights & Biases tracking\n",
"\n",
"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",
"This notebook goes over how to track your LangChain experiments into one centralized `Weights and Biases` dashboard. \n",
"\n",
"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",
"\n",
"<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",
"\n",
"\n",
"[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",
") \n",
"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",
"). \n",
"\n",
"\n",
"**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)."
"**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",
"\n",
"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",
"\n",
"To know more about Weights & Biases Prompts refer to the following [prompts documentation](https://docs.wandb.ai/guides/prompts)."
]
},
{
Expand Down Expand Up @@ -248,6 +253,38 @@
"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."
]
},
{
"cell_type": "markdown",
"id": "483eefd4-633e-4686-8730-944705fe8a80",
"metadata": {
"execution": {
"iopub.execute_input": "2024-11-12T18:20:31.003316Z",
"iopub.status.busy": "2024-11-12T18:20:31.003152Z",
"iopub.status.idle": "2024-11-12T18:20:31.006033Z",
"shell.execute_reply": "2024-11-12T18:20:31.005546Z",
"shell.execute_reply.started": "2024-11-12T18:20:31.003303Z"
}
},
"source": [
"## Usage Scenarios"
]
},
{
"cell_type": "markdown",
"id": "066adc04-8180-4936-8d75-5c3660b61de7",
"metadata": {
"execution": {
"iopub.execute_input": "2024-11-12T18:20:45.826326Z",
"iopub.status.busy": "2024-11-12T18:20:45.825714Z",
"iopub.status.idle": "2024-11-12T18:20:45.830483Z",
"shell.execute_reply": "2024-11-12T18:20:45.830037Z",
"shell.execute_reply.started": "2024-11-12T18:20:45.826279Z"
}
},
"source": [
"### With LLM"
]
},
{
"cell_type": "code",
"execution_count": 4,
Expand Down Expand Up @@ -373,6 +410,14 @@
"wandb_callback.flush_tracker(llm, name=\"simple_sequential\")"
]
},
{
"cell_type": "markdown",
"id": "7dcfc24b-f0b0-48ec-89ce-beeb2fb763d5",
"metadata": {},
"source": [
"### Within Chains"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -524,6 +569,14 @@
"wandb_callback.flush_tracker(synopsis_chain, name=\"agent\")"
]
},
{
"cell_type": "markdown",
"id": "533cd4c9-56e2-4ad9-a83e-4653bfcf322f",
"metadata": {},
"source": [
"### With Agents"
]
},
{
"cell_type": "code",
"execution_count": 7,
Expand Down Expand Up @@ -646,7 +699,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.1"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down

0 comments on commit a58d28e

Please sign in to comment.