Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

core[patch]: deprecate v1 tracer #15608

Merged
merged 1 commit into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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