diff --git a/examples/tracing/anthropic/anthropic_tracing.ipynb b/examples/tracing/anthropic/anthropic_tracing.ipynb index 94ccd08f..a0ad21a1 100644 --- a/examples/tracing/anthropic/anthropic_tracing.ipynb +++ b/examples/tracing/anthropic/anthropic_tracing.ipynb @@ -65,9 +65,11 @@ "metadata": {}, "outputs": [], "source": [ - "from openlayer.lib import trace_anthropic\n", + "from openlayer.lib import init\n", "\n", - "anthropic_client = trace_anthropic(anthropic.Anthropic())" + "init()\n", + "\n", + "anthropic_client = anthropic.Anthropic() # auto-traced by Openlayer" ] }, { diff --git a/examples/tracing/azure-content-understanding/azure_content_understanding_tracing.ipynb b/examples/tracing/azure-content-understanding/azure_content_understanding_tracing.ipynb index 8f3be0d9..b06553da 100644 --- a/examples/tracing/azure-content-understanding/azure_content_understanding_tracing.ipynb +++ b/examples/tracing/azure-content-understanding/azure_content_understanding_tracing.ipynb @@ -68,20 +68,18 @@ "from azure.ai.contentunderstanding import ContentUnderstandingClient\n", "from azure.ai.contentunderstanding.models import AnalysisInput\n", "\n", - "from openlayer.lib import configure, trace_azure_content_understanding\n", + "from openlayer.lib import init\n", "\n", - "# Configure if you want to upload documents to Openlayer storage\n", - "configure(\n", + "# Set attachment options if you want to upload documents to Openlayer storage\n", + "init(\n", " attachment_upload_enabled=True, # upload binary/file attachments\n", " url_upload_enabled=True, # also download & re-upload external URLs\n", ")\n", "\n", - "client = trace_azure_content_understanding(\n", - " ContentUnderstandingClient(\n", - " endpoint=os.environ.get(\"AZURE_CONTENT_UNDERSTANDING_ENDPOINT\"),\n", - " credential=AzureKeyCredential(os.environ.get(\"AZURE_CONTENT_UNDERSTANDING_KEY\")),\n", - " api_version=\"2025-11-01\",\n", - " )\n", + "client = ContentUnderstandingClient( # auto-traced by Openlayer\n", + " endpoint=os.environ.get(\"AZURE_CONTENT_UNDERSTANDING_ENDPOINT\"),\n", + " credential=AzureKeyCredential(os.environ.get(\"AZURE_CONTENT_UNDERSTANDING_KEY\")),\n", + " api_version=\"2025-11-01\",\n", ")" ] }, @@ -148,4 +146,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/examples/tracing/azure-openai/azure_openai_tracing.ipynb b/examples/tracing/azure-openai/azure_openai_tracing.ipynb index f1562c1b..b8db8897 100644 --- a/examples/tracing/azure-openai/azure_openai_tracing.ipynb +++ b/examples/tracing/azure-openai/azure_openai_tracing.ipynb @@ -67,14 +67,14 @@ "source": [ "from openai import AzureOpenAI\n", "\n", - "from openlayer.lib import trace_openai\n", + "from openlayer.lib import init\n", "\n", - "azure_client = trace_openai(\n", - " AzureOpenAI(\n", - " api_key=os.environ.get(\"AZURE_OPENAI_API_KEY\"),\n", - " api_version=\"2024-02-01\",\n", - " azure_endpoint=os.environ.get(\"AZURE_OPENAI_ENDPOINT\"),\n", - " )\n", + "init()\n", + "\n", + "azure_client = AzureOpenAI( # auto-traced by Openlayer\n", + " api_key=os.environ.get(\"AZURE_OPENAI_API_KEY\"),\n", + " api_version=\"2024-02-01\",\n", + " azure_endpoint=os.environ.get(\"AZURE_OPENAI_ENDPOINT\"),\n", ")" ] }, diff --git a/examples/tracing/google-adk/google_adk_tracing.ipynb b/examples/tracing/google-adk/google_adk_tracing.ipynb index e021a494..b6070b3d 100644 --- a/examples/tracing/google-adk/google_adk_tracing.ipynb +++ b/examples/tracing/google-adk/google_adk_tracing.ipynb @@ -83,10 +83,10 @@ "metadata": {}, "outputs": [], "source": [ - "from openlayer.lib.integrations import trace_google_adk\n", + "from openlayer.lib import init\n", "\n", - "# Enable tracing (must be called before creating agents)\n", - "trace_google_adk()" + "# Auto-instrument the installed LLM SDKs (must be called before creating agents)\n", + "init()" ] }, { diff --git a/examples/tracing/google-gemini/gemini_tracing.ipynb b/examples/tracing/google-gemini/gemini_tracing.ipynb index 1367b6e3..a6505ae6 100644 --- a/examples/tracing/google-gemini/gemini_tracing.ipynb +++ b/examples/tracing/google-gemini/gemini_tracing.ipynb @@ -65,12 +65,13 @@ "metadata": {}, "outputs": [], "source": [ - "from openlayer.lib import trace_gemini\n", + "from openlayer.lib import init\n", "\n", "genai.configure(api_key=os.environ[\"GOOGLE_AI_API_KEY\"])\n", "\n", - "model = genai.GenerativeModel(\"gemini-2.5-flash\")\n", - "traced_model = trace_gemini(model)" + "init()\n", + "\n", + "model = genai.GenerativeModel(\"gemini-2.5-flash\") # auto-traced by Openlayer" ] }, { diff --git a/examples/tracing/groq/groq_tracing.ipynb b/examples/tracing/groq/groq_tracing.ipynb index 958e6efd..4236f23b 100644 --- a/examples/tracing/groq/groq_tracing.ipynb +++ b/examples/tracing/groq/groq_tracing.ipynb @@ -65,9 +65,11 @@ "source": [ "import groq\n", "\n", - "from openlayer.lib import trace_groq\n", + "from openlayer.lib import init\n", "\n", - "groq_client = trace_groq(groq.Groq())" + "init()\n", + "\n", + "groq_client = groq.Groq() # auto-traced by Openlayer" ] }, { diff --git a/examples/tracing/litellm/litellm_tracing.ipynb b/examples/tracing/litellm/litellm_tracing.ipynb index 98254194..06b1b532 100644 --- a/examples/tracing/litellm/litellm_tracing.ipynb +++ b/examples/tracing/litellm/litellm_tracing.ipynb @@ -63,10 +63,10 @@ "metadata": {}, "outputs": [], "source": [ - "from openlayer.lib import trace_litellm\n", + "from openlayer.lib import init\n", "\n", - "# Enable tracing for all LiteLLM completions\n", - "trace_litellm()\n" + "# Auto-instrument the installed LLM SDKs (LiteLLM, etc.)\n", + "init()" ] }, { diff --git a/examples/tracing/mistral/mistral_tracing.ipynb b/examples/tracing/mistral/mistral_tracing.ipynb index a0e3d408..7e680782 100644 --- a/examples/tracing/mistral/mistral_tracing.ipynb +++ b/examples/tracing/mistral/mistral_tracing.ipynb @@ -62,9 +62,11 @@ "source": [ "import mistralai\n", "\n", - "from openlayer.lib import trace_mistral\n", + "from openlayer.lib import init\n", "\n", - "mistral_client = trace_mistral(mistralai.Mistral(api_key=\"YOUR_MISTRAL_AI_API_KEY_HERE\"))" + "init()\n", + "\n", + "mistral_client = mistralai.Mistral(api_key=\"YOUR_MISTRAL_AI_API_KEY_HERE\") # auto-traced by Openlayer" ] }, { diff --git a/examples/tracing/openai/openai_tracing.ipynb b/examples/tracing/openai/openai_tracing.ipynb index a0da652f..8ee0347e 100644 --- a/examples/tracing/openai/openai_tracing.ipynb +++ b/examples/tracing/openai/openai_tracing.ipynb @@ -65,9 +65,11 @@ "metadata": {}, "outputs": [], "source": [ - "from openlayer.lib import trace_openai\n", + "from openlayer.lib import init\n", "\n", - "openai_client = trace_openai(openai.OpenAI())" + "init()\n", + "\n", + "openai_client = openai.OpenAI() # auto-traced by Openlayer" ] }, { diff --git a/examples/tracing/portkey/portkey_tracing.ipynb b/examples/tracing/portkey/portkey_tracing.ipynb index 425b9b7a..357dd398 100644 --- a/examples/tracing/portkey/portkey_tracing.ipynb +++ b/examples/tracing/portkey/portkey_tracing.ipynb @@ -62,10 +62,10 @@ "metadata": {}, "outputs": [], "source": [ - "from openlayer.lib import trace_portkey\n", + "from openlayer.lib import init\n", "\n", - "# Enable openlayer tracing for all Portkey completions\n", - "trace_portkey()" + "# Auto-instrument the installed LLM SDKs (Portkey, etc.)\n", + "init()" ] }, { diff --git a/examples/tracing/rag/rag_tracing.ipynb b/examples/tracing/rag/rag_tracing.ipynb index 16263106..3216e3de 100644 --- a/examples/tracing/rag/rag_tracing.ipynb +++ b/examples/tracing/rag/rag_tracing.ipynb @@ -64,7 +64,7 @@ "from sklearn.metrics.pairwise import cosine_similarity\n", "from sklearn.feature_extraction.text import TfidfVectorizer\n", "\n", - "from openlayer.lib import trace, trace_openai" + "from openlayer.lib import init, trace" ] }, { @@ -76,8 +76,9 @@ "source": [ "class RagPipeline:\n", " def __init__(self, context_path: str):\n", - " # Wrap OpenAI client with Openlayer's `trace_openai` to trace it\n", - " self.openai_client = trace_openai(OpenAI())\n", + " # Auto-instrument the installed LLM SDKs (OpenAI, etc.)\n", + " init()\n", + " self.openai_client = OpenAI() # auto-traced by Openlayer\n", "\n", " self.vectorizer = TfidfVectorizer()\n", " with open(context_path, \"r\", encoding=\"utf-8\") as file:\n",