From e5e2c7125e493de3a1bb290157538455167dacba Mon Sep 17 00:00:00 2001 From: Howard Gil Date: Wed, 15 May 2024 15:26:38 -0700 Subject: [PATCH] Fixed typo --- agentops/client.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/agentops/client.py b/agentops/client.py index 92653f1e..f85a7905 100644 --- a/agentops/client.py +++ b/agentops/client.py @@ -82,7 +82,6 @@ def __init__(self, self._tags: Optional[List[str]] = tags self._tags_for_future_session: Optional[List[str]] = None - self._env_data_opt_out = os.getenv('AGENTOPS_ENV_DATA_OPT_OUT') and os.getenv( 'AGENTOPS_ENV_DATA_OPT_OUT').lower() == 'true' @@ -97,7 +96,8 @@ def __init__(self, self._handle_unclean_exits() - instrument_llm_calls, auto_start_session = self._check_for_partner_frameworks(instrument_llm_calls, auto_start_session) + instrument_llm_calls, auto_start_session = self._check_for_partner_frameworks( + instrument_llm_calls, auto_start_session) if auto_start_session: self.start_session(tags, self.config, inherited_session_id) @@ -113,9 +113,12 @@ def _check_for_partner_frameworks(self, instrument_llm_calls, auto_start_session for framework in partner_frameworks.keys(): if framework in sys.modules: self.add_tags([framework]) - if 'autogen': - import autogen - autogen.runtime_logging.start(logger_type="agentops") + if framework == 'autogen': + try: + import autogen + autogen.runtime_logging.start(logger_type="agentops") + except: + pass return partner_frameworks[framework] @@ -402,4 +405,5 @@ def parent_key(self): return self.config.parent_key def stop_instrumenting(self): - self.llm_tracker.stop_instrumenting() + if self.llm_tracker: + self.llm_tracker.stop_instrumenting()