AgentOps ENG-525: Decouple CrewAI and AgentOps (#1033)

* Make AgentOps import optional upon AGENTOPS_API_KEY
    being set

Co-authored-by: João Moura <joaomdmoura@gmail.com>
This commit is contained in:
Vikram Guhan Subbiah
2024-08-10 05:47:13 -07:00
committed by GitHub
parent f1ad137fb7
commit dbce944934
4 changed files with 42 additions and 20 deletions

View File

@@ -1,5 +1,6 @@
import ast
from difflib import SequenceMatcher
import os
from textwrap import dedent
from typing import Any, List, Union
@@ -11,10 +12,12 @@ from crewai.telemetry import Telemetry
from crewai.tools.tool_calling import InstructorToolCalling, ToolCalling
from crewai.utilities import I18N, Converter, ConverterError, Printer
try:
import agentops
except ImportError:
agentops = None
agentops = None
if os.environ.get("AGENTOPS_API_KEY"):
try:
import agentops
except ImportError:
pass
OPENAI_BIGGER_MODELS = ["gpt-4o"]