From 3e972faf812ddda4c46f2f0662c93a71dc2d65b3 Mon Sep 17 00:00:00 2001 From: Bharat Ramanathan Date: Wed, 13 Nov 2024 22:03:34 +0530 Subject: [PATCH] community: chore warn deprecate the tracer (#27159) - **Description:**: This PR deprecates the wandb tracer 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 --- .../callbacks/tracers/wandb.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libs/community/langchain_community/callbacks/tracers/wandb.py b/libs/community/langchain_community/callbacks/tracers/wandb.py index 76dbb3d2028..fcc2312f47e 100644 --- a/libs/community/langchain_community/callbacks/tracers/wandb.py +++ b/libs/community/langchain_community/callbacks/tracers/wandb.py @@ -16,6 +16,7 @@ from typing import ( Union, ) +from langchain_core._api import warn_deprecated from langchain_core.output_parsers.pydantic import PydanticBaseModel from langchain_core.tracers.base import BaseTracer from langchain_core.tracers.schemas import Run @@ -325,6 +326,22 @@ class WandbTracer(BaseTracer): self._run_args = run_args self._ensure_run(should_print_url=(wandb.run is None)) self._io_serializer = io_serializer + warn_deprecated( + "0.3.8", + pending=False, + message=( + "Please use the `WeaveTracer` from the `weave` package instead of this." + "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 finish(self) -> None: """Waits for all asynchronous processes to finish and data to upload.