Skip to content

Commit

Permalink
core[patch]: deprecate v1 tracer (#15608)
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan committed Jan 6, 2024
1 parent dbb582d commit 46446a1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libs/core/langchain_core/tracers/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from langsmith import utils as ls_utils
from langsmith.run_helpers import get_run_tree_context

from langchain_core._api import deprecated
from langchain_core.tracers.langchain import LangChainTracer
from langchain_core.tracers.langchain_v1 import LangChainTracerV1
from langchain_core.tracers.run_collector import RunCollectorCallbackHandler
Expand All @@ -30,6 +31,7 @@
from langchain_core.callbacks.base import BaseCallbackHandler, Callbacks
from langchain_core.callbacks.manager import AsyncCallbackManager, CallbackManager

# Deprecated as of 0.1.0, will be removed in 0.2.0.
tracing_callback_var: ContextVar[Optional[LangChainTracerV1]] = ContextVar( # noqa: E501
"tracing_callback", default=None
)
Expand All @@ -43,6 +45,7 @@


@contextmanager
@deprecated("0.1.0", alternative="tracing_v2_enabled", removal="0.2.0")
def tracing_enabled(
session_name: str = "default",
) -> Generator[TracerSessionV1, None, None]:
Expand Down
2 changes: 2 additions & 0 deletions libs/core/langchain_core/tracers/langchain_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import requests

from langchain_core._api import deprecated
from langchain_core.messages import get_buffer_string
from langchain_core.tracers.base import BaseTracer
from langchain_core.tracers.schemas import (
Expand Down Expand Up @@ -34,6 +35,7 @@ def _get_endpoint() -> str:
return os.getenv("LANGCHAIN_ENDPOINT", "http://localhost:8000")


@deprecated("0.1.0", alternative="LangChainTracer", removal="0.2.0")
class LangChainTracerV1(BaseTracer):
"""An implementation of the SharedTracer that POSTS to the langchain endpoint."""

Expand Down
11 changes: 11 additions & 0 deletions libs/core/langchain_core/tracers/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
from langsmith.schemas import RunBase as BaseRunV2
from langsmith.schemas import RunTypeEnum as RunTypeEnumDep

from langchain_core._api import deprecated
from langchain_core.outputs import LLMResult
from langchain_core.pydantic_v1 import BaseModel, Field, root_validator


@deprecated("0.1.0", alternative="Use string instead.", removal="0.2.0")
def RunTypeEnum() -> Type[RunTypeEnumDep]:
"""RunTypeEnum."""
warnings.warn(
Expand All @@ -23,6 +25,7 @@ def RunTypeEnum() -> Type[RunTypeEnumDep]:
return RunTypeEnumDep


@deprecated("0.1.0", removal="0.2.0")
class TracerSessionV1Base(BaseModel):
"""Base class for TracerSessionV1."""

Expand All @@ -31,28 +34,33 @@ class TracerSessionV1Base(BaseModel):
extra: Optional[Dict[str, Any]] = None


@deprecated("0.1.0", removal="0.2.0")
class TracerSessionV1Create(TracerSessionV1Base):
"""Create class for TracerSessionV1."""


@deprecated("0.1.0", removal="0.2.0")
class TracerSessionV1(TracerSessionV1Base):
"""TracerSessionV1 schema."""

id: int


@deprecated("0.1.0", removal="0.2.0")
class TracerSessionBase(TracerSessionV1Base):
"""Base class for TracerSession."""

tenant_id: UUID


@deprecated("0.1.0", removal="0.2.0")
class TracerSession(TracerSessionBase):
"""TracerSessionV1 schema for the V2 API."""

id: UUID


@deprecated("0.1.0", alternative="Run", removal="0.2.0")
class BaseRun(BaseModel):
"""Base class for Run."""

Expand All @@ -68,13 +76,15 @@ class BaseRun(BaseModel):
error: Optional[str] = None


@deprecated("0.1.0", alternative="Run", removal="0.2.0")
class LLMRun(BaseRun):
"""Class for LLMRun."""

prompts: List[str]
response: Optional[LLMResult] = None


@deprecated("0.1.0", alternative="Run", removal="0.2.0")
class ChainRun(BaseRun):
"""Class for ChainRun."""

Expand All @@ -85,6 +95,7 @@ class ChainRun(BaseRun):
child_tool_runs: List[ToolRun] = Field(default_factory=list)


@deprecated("0.1.0", alternative="Run", removal="0.2.0")
class ToolRun(BaseRun):
"""Class for ToolRun."""

Expand Down

0 comments on commit 46446a1

Please sign in to comment.