Skip to content

Commit

Permalink
community[patch]: chore warn deprecate the wandb callback handler (#2…
Browse files Browse the repository at this point in the history
…7062)

- **Description:**: This PR deprecates the wandb callback handler in
favor of the new
[WeaveTracer](https://weave-docs.wandb.ai/guides/integrations/langchain#using-weavetracer)
in W&B
- **Dependencies:** No dependencies, just a deprecation warning.
- **Twitter handle:** @parambharat


@baskaryan
  • Loading branch information
parambharat authored Oct 3, 2024
1 parent 907c758 commit 103e573
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions libs/community/langchain_community/callbacks/wandb_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
from typing import Any, Dict, List, Optional, Sequence, Union

from langchain_core._api import warn_deprecated
from langchain_core.agents import AgentAction, AgentFinish
from langchain_core.callbacks import BaseCallbackHandler
from langchain_core.outputs import LLMResult
Expand Down Expand Up @@ -206,6 +207,22 @@ def __init__(
self.complexity_metrics = complexity_metrics
self.visualize = visualize
self.nlp = spacy.load("en_core_web_sm")
warn_deprecated(
"0.3.8",
pending=False,
message=(
"Please use the WeaveTracer instead of the WandbCallbackHandler. "
"The WeaveTracer is a more flexible and powerful tool for logging "
"and tracing your LangChain callables."
"Find more information at https://weave-docs.wandb.ai/guides/integrations/langchain"
),
alternative=(
"Please instantiate the WeaveTracer from "
"weave.integrations.langchain import WeaveTracer ."
"For autologging simply use weave.init() and log all traces "
"from your LangChain callables."
),
)

def _init_resp(self) -> Dict:
return {k: None for k in self.callback_columns}
Expand Down

0 comments on commit 103e573

Please sign in to comment.