Skip to content

Commit

Permalink
refactor: purge deprecated dummy tracer
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerHYang committed Mar 11, 2024
1 parent 2ec93d7 commit 5db9001
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 177 deletions.
27 changes: 2 additions & 25 deletions src/phoenix/trace/langchain/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
import sys
from typing import Any
from phoenix.trace.langchain.instrumentor import LangChainInstrumentor

import phoenix.trace.langchain.instrumentor as _instrumentor
import phoenix.trace.langchain.tracer as _tracer

_DUMMY = "OpenInferenceTracer"


class _Deprecation:
__all__ = ("LangChainInstrumentor", _DUMMY)

def __getattr__(self, name: str) -> Any:
if name == "tracer":
return _tracer
if name == "instrumentor":
return _instrumentor
if name == _DUMMY:
return getattr(_tracer, name)
if name == "LangChainInstrumentor":
return _instrumentor.LangChainInstrumentor
raise AttributeError(f"module {__name__} has no attribute {name}")


# See e.g. https://stackoverflow.com/a/7668273
sys.modules[__name__] = _Deprecation() # type: ignore
__all__ = ("LangChainInstrumentor",)
2 changes: 0 additions & 2 deletions src/phoenix/trace/langchain/instrumentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from phoenix.config import get_env_project_name
from phoenix.trace.exporter import _OpenInferenceExporter
from phoenix.trace.tracer import _show_deprecation_warnings

logger = logging.getLogger(__name__)

Expand All @@ -21,7 +20,6 @@

class LangChainInstrumentor(Instrumentor):
def __init__(self, *args: Any, **kwargs: Any) -> None:
_show_deprecation_warnings(self, *args, **kwargs)
if find_spec("langchain_core") is None:
raise PackageNotFoundError(
"Missing `langchain-core`. Install with `pip install langchain-core`."
Expand Down
47 changes: 0 additions & 47 deletions src/phoenix/trace/langchain/tracer.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/phoenix/trace/llama_index/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from phoenix.config import get_env_project_name
from phoenix.trace.errors import IncompatibleLibraryVersionError
from phoenix.trace.exporter import _OpenInferenceExporter
from phoenix.trace.tracer import _show_deprecation_warnings

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -95,7 +94,6 @@ class OpenInferenceTraceCallbackHandler(_OpenInferenceTraceCallbackHandler):
"""

def __init__(self, *args: Any, **kwargs: Any) -> None:
_show_deprecation_warnings(self, *args, **kwargs)
tracer_provider = trace_sdk.TracerProvider(
resource=Resource({ResourceAttributes.PROJECT_NAME: get_env_project_name()})
)
Expand Down
2 changes: 0 additions & 2 deletions src/phoenix/trace/openai/instrumentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@

from phoenix.config import get_env_project_name
from phoenix.trace.exporter import _OpenInferenceExporter
from phoenix.trace.tracer import _show_deprecation_warnings

logger = logging.getLogger(__name__)


class OpenAIInstrumentor(Instrumentor):
def __init__(self, *args: Any, **kwargs: Any) -> None:
_show_deprecation_warnings(self, *args, **kwargs)
if find_spec("openai") is None:
raise PackageNotFoundError("Missing `openai`. Install with `pip install openai`.")
super().__init__()
Expand Down
99 changes: 0 additions & 99 deletions src/phoenix/trace/tracer.py

This file was deleted.

0 comments on commit 5db9001

Please sign in to comment.