Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerHYang committed Nov 1, 2024
1 parent f18c45f commit 8b6c734
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import contextvars
import logging
from importlib import import_module, metadata
from typing import Any, Collection, Tuple
from typing import Any, Collection

from opentelemetry import trace as trace_api
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor # type: ignore
Expand All @@ -24,8 +24,6 @@
_LLM_PROVIDERS_MODULE = "guardrails.llm_providers"
_RUNNER_MODULE = "guardrails.run"

GUARDRAILS_VERSION: Tuple[int, int, int] = (0, 0, 0)


class _Contextvars(ObjectProxy): # type: ignore
def __init__(self, cv: Any) -> None:
Expand All @@ -51,10 +49,7 @@ def instrumentation_dependencies(self) -> Collection[str]:

def _instrument(self, **kwargs: Any) -> None:
version = Version(metadata.version("guardrails-ai"))
global GUARDRAILS_VERSION
GUARDRAILS_VERSION = (version.major, version.minor, version.micro)

if GUARDRAILS_VERSION >= (0, 5, 2):
if (version.major, version.minor, version.micro) >= (0, 5, 2):
logger.info("Guardrails version >= 0.5.2 detected, skipping instrumentation")
return

Expand Down

0 comments on commit 8b6c734

Please sign in to comment.