From f18c45fc4f80b11acf5794a9e5b58d0ba5c279f1 Mon Sep 17 00:00:00 2001 From: Roger Yang Date: Fri, 1 Nov 2024 13:38:14 -0700 Subject: [PATCH] clean up --- .../src/openinference/instrumentation/guardrails/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/instrumentation/openinference-instrumentation-guardrails/src/openinference/instrumentation/guardrails/__init__.py b/python/instrumentation/openinference-instrumentation-guardrails/src/openinference/instrumentation/guardrails/__init__.py index 316ef2d5d..6d0120fce 100644 --- a/python/instrumentation/openinference-instrumentation-guardrails/src/openinference/instrumentation/guardrails/__init__.py +++ b/python/instrumentation/openinference-instrumentation-guardrails/src/openinference/instrumentation/guardrails/__init__.py @@ -50,8 +50,6 @@ def instrumentation_dependencies(self) -> Collection[str]: return _instruments def _instrument(self, **kwargs: Any) -> None: - import guardrails as gd - version = Version(metadata.version("guardrails-ai")) global GUARDRAILS_VERSION GUARDRAILS_VERSION = (version.major, version.minor, version.micro) @@ -60,6 +58,8 @@ def _instrument(self, **kwargs: Any) -> None: logger.info("Guardrails version >= 0.5.2 detected, skipping instrumentation") return + import guardrails as gd + if not (tracer_provider := kwargs.get("tracer_provider")): tracer_provider = trace_api.get_tracer_provider() if not (config := kwargs.get("config")):