mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-21 14:18:52 +00:00
core[patch]: deprecate v1 tracer (#15608)
This commit is contained in:
parent
dbb582d227
commit
46446a100d
@ -18,6 +18,7 @@ from uuid import UUID
|
|||||||
from langsmith import utils as ls_utils
|
from langsmith import utils as ls_utils
|
||||||
from langsmith.run_helpers import get_run_tree_context
|
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 import LangChainTracer
|
||||||
from langchain_core.tracers.langchain_v1 import LangChainTracerV1
|
from langchain_core.tracers.langchain_v1 import LangChainTracerV1
|
||||||
from langchain_core.tracers.run_collector import RunCollectorCallbackHandler
|
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.base import BaseCallbackHandler, Callbacks
|
||||||
from langchain_core.callbacks.manager import AsyncCallbackManager, CallbackManager
|
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_var: ContextVar[Optional[LangChainTracerV1]] = ContextVar( # noqa: E501
|
||||||
"tracing_callback", default=None
|
"tracing_callback", default=None
|
||||||
)
|
)
|
||||||
@ -43,6 +45,7 @@ run_collector_var: ContextVar[Optional[RunCollectorCallbackHandler]] = ContextVa
|
|||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
@deprecated("0.1.0", alternative="tracing_v2_enabled", removal="0.2.0")
|
||||||
def tracing_enabled(
|
def tracing_enabled(
|
||||||
session_name: str = "default",
|
session_name: str = "default",
|
||||||
) -> Generator[TracerSessionV1, None, None]:
|
) -> Generator[TracerSessionV1, None, None]:
|
||||||
|
@ -6,6 +6,7 @@ from typing import Any, Dict, Optional, Union
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
from langchain_core._api import deprecated
|
||||||
from langchain_core.messages import get_buffer_string
|
from langchain_core.messages import get_buffer_string
|
||||||
from langchain_core.tracers.base import BaseTracer
|
from langchain_core.tracers.base import BaseTracer
|
||||||
from langchain_core.tracers.schemas import (
|
from langchain_core.tracers.schemas import (
|
||||||
@ -34,6 +35,7 @@ def _get_endpoint() -> str:
|
|||||||
return os.getenv("LANGCHAIN_ENDPOINT", "http://localhost:8000")
|
return os.getenv("LANGCHAIN_ENDPOINT", "http://localhost:8000")
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("0.1.0", alternative="LangChainTracer", removal="0.2.0")
|
||||||
class LangChainTracerV1(BaseTracer):
|
class LangChainTracerV1(BaseTracer):
|
||||||
"""An implementation of the SharedTracer that POSTS to the langchain endpoint."""
|
"""An implementation of the SharedTracer that POSTS to the langchain endpoint."""
|
||||||
|
|
||||||
|
@ -9,10 +9,12 @@ from uuid import UUID
|
|||||||
from langsmith.schemas import RunBase as BaseRunV2
|
from langsmith.schemas import RunBase as BaseRunV2
|
||||||
from langsmith.schemas import RunTypeEnum as RunTypeEnumDep
|
from langsmith.schemas import RunTypeEnum as RunTypeEnumDep
|
||||||
|
|
||||||
|
from langchain_core._api import deprecated
|
||||||
from langchain_core.outputs import LLMResult
|
from langchain_core.outputs import LLMResult
|
||||||
from langchain_core.pydantic_v1 import BaseModel, Field, root_validator
|
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]:
|
def RunTypeEnum() -> Type[RunTypeEnumDep]:
|
||||||
"""RunTypeEnum."""
|
"""RunTypeEnum."""
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
@ -23,6 +25,7 @@ def RunTypeEnum() -> Type[RunTypeEnumDep]:
|
|||||||
return RunTypeEnumDep
|
return RunTypeEnumDep
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("0.1.0", removal="0.2.0")
|
||||||
class TracerSessionV1Base(BaseModel):
|
class TracerSessionV1Base(BaseModel):
|
||||||
"""Base class for TracerSessionV1."""
|
"""Base class for TracerSessionV1."""
|
||||||
|
|
||||||
@ -31,28 +34,33 @@ class TracerSessionV1Base(BaseModel):
|
|||||||
extra: Optional[Dict[str, Any]] = None
|
extra: Optional[Dict[str, Any]] = None
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("0.1.0", removal="0.2.0")
|
||||||
class TracerSessionV1Create(TracerSessionV1Base):
|
class TracerSessionV1Create(TracerSessionV1Base):
|
||||||
"""Create class for TracerSessionV1."""
|
"""Create class for TracerSessionV1."""
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("0.1.0", removal="0.2.0")
|
||||||
class TracerSessionV1(TracerSessionV1Base):
|
class TracerSessionV1(TracerSessionV1Base):
|
||||||
"""TracerSessionV1 schema."""
|
"""TracerSessionV1 schema."""
|
||||||
|
|
||||||
id: int
|
id: int
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("0.1.0", removal="0.2.0")
|
||||||
class TracerSessionBase(TracerSessionV1Base):
|
class TracerSessionBase(TracerSessionV1Base):
|
||||||
"""Base class for TracerSession."""
|
"""Base class for TracerSession."""
|
||||||
|
|
||||||
tenant_id: UUID
|
tenant_id: UUID
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("0.1.0", removal="0.2.0")
|
||||||
class TracerSession(TracerSessionBase):
|
class TracerSession(TracerSessionBase):
|
||||||
"""TracerSessionV1 schema for the V2 API."""
|
"""TracerSessionV1 schema for the V2 API."""
|
||||||
|
|
||||||
id: UUID
|
id: UUID
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("0.1.0", alternative="Run", removal="0.2.0")
|
||||||
class BaseRun(BaseModel):
|
class BaseRun(BaseModel):
|
||||||
"""Base class for Run."""
|
"""Base class for Run."""
|
||||||
|
|
||||||
@ -68,6 +76,7 @@ class BaseRun(BaseModel):
|
|||||||
error: Optional[str] = None
|
error: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("0.1.0", alternative="Run", removal="0.2.0")
|
||||||
class LLMRun(BaseRun):
|
class LLMRun(BaseRun):
|
||||||
"""Class for LLMRun."""
|
"""Class for LLMRun."""
|
||||||
|
|
||||||
@ -75,6 +84,7 @@ class LLMRun(BaseRun):
|
|||||||
response: Optional[LLMResult] = None
|
response: Optional[LLMResult] = None
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("0.1.0", alternative="Run", removal="0.2.0")
|
||||||
class ChainRun(BaseRun):
|
class ChainRun(BaseRun):
|
||||||
"""Class for ChainRun."""
|
"""Class for ChainRun."""
|
||||||
|
|
||||||
@ -85,6 +95,7 @@ class ChainRun(BaseRun):
|
|||||||
child_tool_runs: List[ToolRun] = Field(default_factory=list)
|
child_tool_runs: List[ToolRun] = Field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated("0.1.0", alternative="Run", removal="0.2.0")
|
||||||
class ToolRun(BaseRun):
|
class ToolRun(BaseRun):
|
||||||
"""Class for ToolRun."""
|
"""Class for ToolRun."""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user