core[patch]: deprecate v1 tracer (#15608)

This commit is contained in:
Bagatur 2024-01-05 19:25:19 -05:00 committed by GitHub
parent dbb582d227
commit 46446a100d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -18,6 +18,7 @@ from uuid import UUID
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
@ -30,6 +31,7 @@ if TYPE_CHECKING:
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
)
@ -43,6 +45,7 @@ run_collector_var: ContextVar[Optional[RunCollectorCallbackHandler]] = ContextVa
@contextmanager
@deprecated("0.1.0", alternative="tracing_v2_enabled", removal="0.2.0")
def tracing_enabled(
session_name: str = "default",
) -> Generator[TracerSessionV1, None, None]:

View File

@ -6,6 +6,7 @@ from typing import Any, Dict, Optional, Union
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 (
@ -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."""

View File

@ -9,10 +9,12 @@ from uuid import UUID
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(
@ -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."""
@ -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."""
@ -68,6 +76,7 @@ class BaseRun(BaseModel):
error: Optional[str] = None
@deprecated("0.1.0", alternative="Run", removal="0.2.0")
class LLMRun(BaseRun):
"""Class for LLMRun."""
@ -75,6 +84,7 @@ class LLMRun(BaseRun):
response: Optional[LLMResult] = None
@deprecated("0.1.0", alternative="Run", removal="0.2.0")
class ChainRun(BaseRun):
"""Class for ChainRun."""
@ -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."""