Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.
TypeScript agent-harnessagent-harness-engineeringai-engineeringai-observabilityamd-gpuclaude-codeclickhousecodexcoding-agentcoding-agentscursorgenaigpu-monitoringllm-observabilityllmopsnvidia-smiobservabilityopen-sourceopenaiopentelemetry
feat(ts-sdk): add LangChain, LlamaIndex, Pinecone, Vercel AI integrations, Bedrock & fix OpenAI parity (#1016)
Aman Agarwalb7e9978b2f94
diff --git a/README.md b/README.mdindex ad4c470b..fe76eff0 100644--- a/README.md+++ b/README.md@@ -171,6 +171,105 @@ Just head over to OpenLIT at `127.0.0.1:3000` on your browser to start exploring+## 📦 Supported Integrations++OpenLIT auto-instruments **44+ LLM providers, AI frameworks, and vector databases** with a single line of code. Each integration produces [OpenTelemetry-native](https://opentelemetry.io/) traces and metrics. Click any card to view the integration docs.++<sub>+<img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="16"> Python SDK +<img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="16"> TypeScript SDK+</sub>++### LLM Providers++<table>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/openai"><b>OpenAI</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/anthropic"><b>Anthropic</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/cohere"><b>Cohere</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/mistral"><b>Mistral AI</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+</tr>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/groq"><b>Groq</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/google-ai-studio"><b>Google AI Studio</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/together"><b>Together AI</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/ollama"><b>Ollama</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+</tr>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/bedrock"><b>AWS Bedrock</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/azure-ai-inference"><b>Azure AI Inference</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/vertexai"><b>Vertex AI</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/vllm"><b>vLLM</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/reka"><b>Reka</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/litellm"><b>LiteLLM</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/huggingface"><b>Hugging Face</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/ai21"><b>AI21</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/gpt4all"><b>GPT4All</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/premai"><b>PremAI</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/sarvam"><b>Sarvam AI</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/julep-ai"><b>Julep</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/multion"><b>MultiOn</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+</table>++### AI Frameworks++<table>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/langchain"><b>LangChain</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/llama-index"><b>LlamaIndex</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/crewai"><b>CrewAI</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/pydantic"><b>Pydantic AI</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/phidata"><b>Agno</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/browser-use"><b>Browser Use</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/haystack"><b>Haystack</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/letta"><b>Letta</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/mem0"><b>Mem0</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/ag2"><b>AG2 (AutoGen)</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/controlflow"><b>Controlflow</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/crawl4ai"><b>Crawl4AI</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/dynamiq"><b>Dynamiq</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/openai-agents"><b>OpenAI Agents</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/firecrawl"><b>Firecrawl</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+</table>++### Vector Databases++<table>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/pinecone"><b>Pinecone</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/chromadb"><b>ChromaDB</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/qdrant"><b>Qdrant</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/milvus"><b>Milvus</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/astradb"><b>Astra DB</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/psycopg"><b>PostgreSQL</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+</table>++### Specialized Tools++<table>+<tr>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/elevenlabs"><b>ElevenLabs</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+<td align="center" width="160"><a href="https://docs.openlit.io/latest/sdk/integrations/assemblyai"><b>AssemblyAI</b></a><br/><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white&style=flat-square" height="18"></td>+</tr>+</table>+## 🛣️ RoadmapWe are dedicated to continuously improving OpenLIT. Here's a look at what's been accomplished and what's on the horizon:diff --git a/docs/latest/sdk/integrations/overview.mdx b/docs/latest/sdk/integrations/overview.mdxindex 04c70d2a..ca4497f2 100644--- a/docs/latest/sdk/integrations/overview.mdx+++ b/docs/latest/sdk/integrations/overview.mdx@@ -19,6 +19,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="GPT4All"@@ -59,6 +63,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Ollama"@@ -74,6 +82,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="DeepSeek"@@ -197,6 +209,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Cohere"@@ -213,6 +229,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="Anthropic"@@ -225,6 +245,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="vLLM"@@ -244,6 +268,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="GitHub Models"@@ -253,6 +281,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Azure OpenAI"@@ -262,6 +294,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Azure AI Inference"@@ -271,6 +307,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Mistral"@@ -311,6 +351,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="HuggingFace"@@ -327,6 +371,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Amazon Bedrock"@@ -346,6 +394,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="Vertex AI"@@ -379,6 +431,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Google AI Studio"@@ -395,6 +451,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="Groq"@@ -407,6 +467,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="NVIDIA NIM"@@ -418,6 +482,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="xAI"@@ -433,6 +501,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="ElevenLabs"@@ -508,6 +580,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="AI21"@@ -522,6 +598,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Together.ai"@@ -569,6 +649,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="Assembly AI"@@ -599,6 +683,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Featherless"@@ -610,6 +698,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Reka AI"@@ -686,6 +778,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="OLA Krutrim"@@ -756,6 +852,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Titan ML"@@ -806,6 +906,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Sarvam AI"@@ -1094,6 +1198,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Prem AI"@@ -2084,6 +2192,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card></CardGroup>@@ -2104,6 +2216,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card></CardGroup>@@ -2124,6 +2240,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Pinecone"@@ -2138,6 +2258,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="Qdrant"@@ -2166,6 +2290,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Milvus"@@ -2180,6 +2308,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="AstraDB"@@ -2192,6 +2324,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card></CardGroup>@@ -2209,6 +2345,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="OpenAI Agents"@@ -2221,6 +2361,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="LiteLLM"@@ -2230,6 +2374,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line<svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 350 350"><g id="svgg"><path id="path0" d="M192.281 116.316 C 191.686 116.936,191.200 117.659,191.200 117.922 C 191.200 118.185,191.050 118.400,190.868 118.400 C 190.685 118.400,190.280 118.895,189.968 119.500 C 189.655 120.105,189.085 120.949,188.700 121.375 C 188.315 121.802,188.000 122.387,188.000 122.675 C 188.000 122.964,187.862 123.200,187.694 123.200 C 187.526 123.200,186.944 123.920,186.400 124.800 C 185.856 125.680,185.303 126.400,185.170 126.400 C 184.948 126.400,184.000 128.199,184.000 128.619 C 184.000 128.718,201.702 128.800,223.337 128.800 L 262.674 128.800 264.698 125.100 C 267.138 120.638,267.800 118.833,267.462 117.560 C 266.847 115.242,269.616 115.409,229.895 115.294 L 193.361 115.188 192.281 116.316 M118.000 182.262 C 117.010 182.827,116.140 183.449,116.067 183.644 C 115.993 183.840,115.712 184.000,115.442 184.000 C 115.172 184.000,114.602 184.315,114.175 184.700 C 113.749 185.085,112.905 185.655,112.300 185.968 C 111.695 186.280,111.200 186.685,111.200 186.868 C 111.200 187.050,111.008 187.200,110.773 187.200 C 110.412 187.200,108.808 188.393,105.095 191.425 C 104.708 191.741,104.251 192.000,104.081 192.000 C 103.910 192.000,102.913 192.810,101.865 193.800 C 100.817 194.790,99.816 195.600,99.641 195.600 C 99.231 195.600,88.400 206.396,88.400 206.804 C 88.400 206.973,87.774 207.807,87.009 208.656 C 86.244 209.505,85.614 210.397,85.609 210.638 C 85.604 210.879,85.240 211.402,84.800 211.800 C 84.360 212.198,84.000 212.766,84.000 213.062 C 84.000 213.358,83.820 213.600,83.600 213.600 C 83.380 213.600,83.196 213.825,83.191 214.100 C 83.186 214.375,82.830 215.050,82.400 215.600 C 81.970 216.150,81.614 216.915,81.609 217.300 C 81.604 217.685,81.420 218.000,81.200 218.000 C 80.980 218.000,80.800 218.439,80.800 218.976 C 80.800 219.513,80.620 220.064,80.400 220.200 C 80.180 220.336,80.000 220.968,80.000 221.604 C 80.000 222.240,79.775 222.904,79.500 223.080 C 78.741 223.565,78.798 234.042,79.562 234.640 C 79.944 234.939,80.043 235.485,79.872 236.340 C 79.680 237.298,79.762 237.600,80.210 237.600 C 80.535 237.600,80.800 237.924,80.800 238.320 C 80.800 238.716,80.951 239.211,81.136 239.420 C 81.321 239.629,81.713 240.430,82.008 241.200 C 82.590 242.719,84.754 246.118,85.277 246.333 C 85.455 246.407,85.600 246.677,85.601 246.933 C 85.601 247.190,86.125 248.012,86.765 248.761 C 87.405 249.509,87.835 250.364,87.721 250.661 C 87.608 250.957,87.728 251.200,87.990 251.200 C 88.251 251.200,89.319 252.100,90.363 253.200 C 91.407 254.300,92.445 255.200,92.671 255.200 C 92.897 255.200,93.693 255.785,94.441 256.500 C 95.188 257.214,95.929 257.799,96.087 257.800 C 96.245 257.800,96.785 258.157,97.287 258.593 C 97.789 259.030,98.329 259.390,98.487 259.393 C 98.645 259.397,99.097 259.670,99.493 260.000 C 99.888 260.330,100.704 260.855,101.306 261.168 C 101.908 261.480,102.400 261.969,102.400 262.255 C 102.400 262.567,102.656 262.677,103.040 262.529 C 103.393 262.394,103.798 262.445,103.940 262.642 C 104.172 262.962,105.408 263.671,108.904 265.489 C 109.512 265.804,109.916 266.212,109.804 266.394 C 109.691 266.576,109.959 266.631,110.399 266.516 C 110.966 266.368,111.200 266.503,111.200 266.980 C 111.200 267.472,111.416 267.585,112.000 267.400 C 112.577 267.217,112.800 267.328,112.800 267.800 C 112.800 268.272,113.023 268.383,113.600 268.200 C 114.171 268.019,114.400 268.128,114.400 268.581 C 114.400 269.057,114.648 269.153,115.396 268.965 C 116.115 268.785,116.464 268.900,116.648 269.381 C 116.788 269.747,117.157 269.949,117.467 269.829 C 117.778 269.710,118.361 269.818,118.763 270.070 C 120.919 271.416,120.812 273.863,120.702 225.745 C 120.635 196.657,120.463 181.427,120.200 181.351 C 119.980 181.288,118.990 181.698,118.000 182.262 M250.486 229.081 C 249.792 229.216,246.239 234.290,235.743 250.130 C 228.137 261.608,221.629 271.225,221.281 271.500 C 220.781 271.894,210.018 272.000,170.524 272.000 C 126.236 272.000,120.400 272.070,120.400 272.600 C 120.400 272.930,120.220 273.200,120.000 273.200 C 119.780 273.200,119.600 273.470,119.600 273.800 C 119.600 274.130,119.401 274.400,119.157 274.400 C 118.914 274.400,118.821 274.677,118.950 275.015 C 119.085 275.365,118.931 275.728,118.593 275.858 C 118.267 275.983,118.000 276.336,118.000 276.643 C 118.000 276.949,117.820 277.200,117.600 277.200 C 117.380 277.200,117.200 277.470,117.200 277.800 C 117.200 278.130,117.020 278.400,116.800 278.400 C 116.580 278.400,116.400 278.760,116.400 279.200 C 116.400 279.640,116.220 280.000,116.000 280.000 C 115.780 280.000,115.600 280.360,115.600 280.800 C 115.600 281.240,115.420 281.600,115.200 281.600 C 114.980 281.600,114.800 281.836,114.800 282.125 C 114.800 282.413,114.440 283.036,114.000 283.508 C 113.560 283.980,113.200 284.644,113.200 284.983 C 113.200 285.322,113.020 285.600,112.800 285.600 C 112.580 285.600,112.400 285.870,112.400 286.200 C 112.400 286.530,112.220 286.800,112.000 286.800 C 111.780 286.800,111.600 287.070,111.600 287.400 C 111.600 287.730,111.401 288.000,111.157 288.000 C 110.914 288.000,110.821 288.277,110.950 288.615 C 111.085 288.965,110.931 289.328,110.593 289.458 C 110.267 289.583,110.000 290.026,110.000 290.443 C 110.000 290.859,109.823 291.200,109.608 291.200 C 109.392 291.200,109.102 291.652,108.963 292.205 C 108.824 292.758,108.495 293.343,108.232 293.505 C 107.969 293.667,107.358 294.655,106.875 295.700 C 106.391 296.745,105.817 297.600,105.598 297.600 C 105.379 297.600,105.200 297.945,105.200 298.367 C 105.200 298.788,105.059 299.193,104.888 299.267 C 104.425 299.464,100.800 306.014,100.800 306.652 C 100.800 307.115,119.097 307.200,218.200 307.200 L 335.600 307.200 335.600 268.411 L 335.600 229.623 334.300 229.253 C 333.018 228.889,252.327 228.723,250.486 229.081 " stroke="none" fill="#367eb6" fill-rule="evenodd"></path><path id="path1" d="M219.600 100.000 C 219.600 100.222,218.533 100.400,217.200 100.400 C 215.867 100.400,214.800 100.578,214.800 100.800 C 214.800 101.020,214.001 101.200,213.024 101.200 C 212.047 101.200,211.136 101.380,211.000 101.600 C 210.864 101.820,210.223 102.000,209.576 102.000 C 208.929 102.000,208.400 102.180,208.400 102.400 C 208.400 102.620,208.040 102.800,207.600 102.800 C 207.160 102.800,206.800 102.980,206.800 103.200 C 206.800 103.420,206.440 103.600,206.000 103.600 C 205.560 103.600,205.200 103.780,205.200 104.000 C 205.200 104.220,204.784 104.400,204.275 104.400 C 203.767 104.400,202.964 104.760,202.492 105.200 C 202.020 105.640,201.356 106.000,201.017 106.000 C 200.678 106.000,200.400 106.180,200.400 106.400 C 200.400 106.620,200.040 106.800,199.600 106.800 C 199.160 106.800,198.800 106.980,198.800 107.200 C 198.800 107.420,198.526 107.600,198.191 107.600 C 197.507 107.600,193.200 111.748,193.200 112.408 C 193.200 112.642,192.842 113.218,192.404 113.688 C 191.967 114.157,191.706 114.640,191.826 114.759 C 191.946 114.879,192.169 114.802,192.322 114.588 C 192.957 113.702,266.791 114.499,267.450 115.400 C 268.973 117.482,268.516 120.124,265.826 124.800 C 264.086 127.824,258.692 137.587,256.102 142.400 C 250.569 152.681,248.788 155.117,245.668 156.670 C 243.419 157.789,165.425 158.015,164.523 156.906 C 164.107 156.393,163.893 156.337,163.742 156.700 C 163.627 156.975,163.188 157.200,162.767 157.200 C 162.345 157.200,162.000 157.380,162.000 157.600 C 162.000 157.820,161.640 158.000,161.200 158.000 C 160.760 158.000,160.400 158.180,160.400 158.400 C 160.400 158.620,159.860 158.800,159.200 158.800 C 158.540 158.800,158.000 158.980,158.000 159.200 C 158.000 159.420,157.640 159.600,157.200 159.600 C 156.760 159.600,156.400 159.780,156.400 160.000 C 156.400 160.220,156.040 160.400,155.600 160.400 C 155.160 160.400,154.800 160.580,154.800 160.800 C 154.800 161.020,154.440 161.200,154.000 161.200 C 153.560 161.200,153.200 161.380,153.200 161.600 C 153.200 161.820,152.840 162.000,152.400 162.000 C 151.960 162.000,151.600 162.180,151.600 162.400 C 151.600 162.620,151.240 162.800,150.800 162.800 C 150.360 162.800,150.000 162.980,150.000 163.200 C 150.000 163.420,149.640 163.600,149.200 163.600 C 148.760 163.600,148.400 163.780,148.400 164.000 C 148.400 164.220,148.040 164.400,147.600 164.400 C 147.160 164.400,146.800 164.580,146.800 164.800 C 146.800 165.020,146.440 165.200,146.000 165.200 C 145.560 165.200,145.200 165.380,145.200 165.600 C 145.200 165.820,144.840 166.000,144.400 166.000 C 143.960 166.000,143.600 166.180,143.600 166.400 C 143.600 166.620,143.240 166.800,142.800 166.800 C 142.360 166.800,141.999 166.935,141.997 167.100 C 141.993 167.459,140.056 168.400,139.320 168.400 C 139.034 168.400,138.800 168.580,138.800 168.800 C 138.800 169.020,138.440 169.200,138.000 169.200 C 137.560 169.200,137.200 169.380,137.200 169.600 C 137.200 169.820,136.964 170.000,136.675 170.000 C 136.387 170.000,135.764 170.360,135.292 170.800 C 134.820 171.240,134.156 171.600,133.817 171.600 C 133.478 171.600,133.200 171.780,133.200 172.000 C 133.200 172.220,132.840 172.400,132.400 172.400 C 131.960 172.400,131.600 172.580,131.600 172.800 C 131.600 173.020,131.240 173.200,130.800 173.200 C 130.360 173.200,130.000 173.380,130.000 173.600 C 130.000 173.820,129.640 174.000,129.200 174.000 C 128.760 174.000,128.400 174.180,128.400 174.400 C 128.400 174.620,128.164 174.800,127.875 174.800 C 127.587 174.800,126.964 175.160,126.492 175.600 C 126.020 176.040,125.356 176.400,125.017 176.400 C 124.678 176.400,124.400 176.580,124.400 176.800 C 124.400 177.020,124.106 177.200,123.747 177.200 C 123.388 177.200,122.803 177.527,122.447 177.928 C 122.091 178.328,121.457 178.783,121.039 178.939 C 120.340 179.199,120.331 179.262,120.939 179.711 C 121.547 180.160,121.609 183.888,121.701 225.600 L 121.800 271.000 170.200 271.113 C 196.820 271.176,219.140 271.131,219.800 271.013 C 221.078 270.785,220.451 271.668,235.902 248.349 C 238.763 244.030,241.454 239.980,241.881 239.349 C 242.308 238.717,243.714 236.580,245.006 234.600 C 246.297 232.620,247.875 230.325,248.511 229.500 L 249.667 228.000 292.631 228.000 L 335.595 228.000 335.697 167.900 C 335.754 134.845,335.743 105.955,335.673 103.700 L 335.547 99.600 277.573 99.600 C 239.191 99.600,219.600 99.735,219.600 100.000 M187.260 121.042 C 186.531 121.866,187.000 122.257,187.781 121.476 C 188.121 121.136,188.400 120.754,188.400 120.629 C 188.400 120.209,187.806 120.424,187.260 121.042 M180.900 130.598 C 180.060 131.552,180.345 132.210,181.200 131.292 C 181.640 130.820,182.000 130.336,182.000 130.217 C 182.000 129.818,181.405 130.024,180.900 130.598 M179.260 133.042 C 178.531 133.866,179.000 134.257,179.781 133.476 C 180.121 133.136,180.400 132.754,180.400 132.629 C 180.400 132.209,179.806 132.424,179.260 133.042 M177.700 135.398 C 176.860 136.352,177.145 137.010,178.000 136.092 C 178.440 135.620,178.800 135.136,178.800 135.017 C 178.800 134.618,178.205 134.824,177.700 135.398 M176.060 137.842 C 175.331 138.666,175.800 139.057,176.581 138.276 C 176.921 137.936,177.200 137.554,177.200 137.429 C 177.200 137.009,176.606 137.224,176.060 137.842 M174.460 140.242 C 173.731 141.066,174.200 141.457,174.981 140.676 C 175.321 140.336,175.600 139.954,175.600 139.829 C 175.600 139.409,175.006 139.624,174.460 140.242 M172.860 142.642 C 172.131 143.466,172.600 143.857,173.381 143.076 C 173.721 142.736,174.000 142.354,174.000 142.229 C 174.000 141.809,173.406 142.024,172.860 142.642 M169.660 147.442 C 168.931 148.266,169.400 148.657,170.181 147.876 C 170.521 147.536,170.800 147.154,170.800 147.029 C 170.800 146.609,170.206 146.824,169.660 147.442 M168.060 149.842 C 167.331 150.666,167.800 151.057,168.581 150.276 C 168.921 149.936,169.200 149.554,169.200 149.429 C 169.200 149.009,168.606 149.224,168.060 149.842 M166.629 152.229 C 166.205 152.538,165.972 152.905,166.110 153.043 C 166.249 153.182,166.662 152.995,167.029 152.629 C 167.891 151.766,167.625 151.500,166.629 152.229 M165.100 154.557 C 164.369 155.112,164.184 155.600,164.704 155.600 C 164.871 155.600,165.232 155.240,165.507 154.800 C 166.089 153.868,166.044 153.840,165.100 154.557 M101.829 192.229 C 101.405 192.538,101.172 192.905,101.310 193.043 C 101.449 193.182,101.862 192.995,102.229 192.629 C 103.091 191.766,102.825 191.500,101.829 192.229 M97.040 196.240 C 96.210 197.023,95.624 197.757,95.739 197.872 C 95.853 197.986,96.607 197.420,97.413 196.613 C 99.323 194.704,99.005 194.386,97.040 196.240 M88.060 205.042 C 87.331 205.866,87.800 206.257,88.581 205.476 C 88.921 205.136,89.200 204.754,89.200 204.629 C 89.200 204.209,88.606 204.424,88.060 205.042 M78.292 223.842 C 78.131 224.002,78.000 224.409,78.000 224.747 C 78.000 225.197,78.118 225.242,78.445 224.915 C 78.690 224.670,78.821 224.263,78.737 224.010 C 78.652 223.757,78.452 223.681,78.292 223.842 M84.400 247.904 C 84.400 248.071,84.764 248.435,85.209 248.713 C 85.959 249.181,85.981 249.159,85.513 248.409 C 85.009 247.603,84.400 247.326,84.400 247.904 M87.600 251.840 C 87.600 252.214,91.309 255.624,91.504 255.430 C 91.687 255.246,88.171 251.600,87.811 251.600 C 87.695 251.600,87.600 251.708,87.600 251.840 M78.000 300.200 C 78.000 300.530,78.161 300.800,78.357 300.800 C 78.554 300.800,78.818 300.530,78.945 300.200 C 79.085 299.835,78.945 299.600,78.587 299.600 C 78.264 299.600,78.000 299.870,78.000 300.200 " stroke="none" fill="#d3d4d4" fill-rule="evenodd"></path><path id="path2" d="M78.995 300.416 C 78.856 300.854,78.575 301.108,78.371 300.982 C 78.167 300.856,78.000 301.113,78.000 301.553 C 78.000 301.993,78.180 302.464,78.400 302.600 C 78.964 302.949,78.898 304.935,78.300 305.579 C 77.900 306.010,77.900 306.061,78.300 305.835 C 78.924 305.483,79.024 311.415,78.400 311.800 C 77.940 312.084,77.847 314.043,78.300 313.915 C 78.465 313.868,79.027 314.066,79.548 314.355 C 80.111 314.666,80.386 314.701,80.225 314.440 C 79.922 313.949,80.501 313.834,80.961 314.294 C 81.424 314.758,90.800 314.855,90.800 314.397 C 90.800 313.802,94.700 313.900,94.902 314.500 C 95.033 314.890,95.216 314.879,95.735 314.451 C 96.167 314.094,96.400 314.059,96.400 314.351 C 96.400 314.919,101.051 314.964,101.400 314.400 C 101.536 314.180,102.087 314.000,102.624 314.000 C 103.161 314.000,103.600 314.180,103.600 314.400 C 103.600 315.009,109.092 314.913,109.314 314.300 C 109.459 313.900,109.665 313.900,110.342 314.300 C 110.808 314.575,112.454 314.800,114.000 314.800 C 115.546 314.800,117.192 314.575,117.658 314.300 C 118.335 313.900,118.541 313.900,118.686 314.300 C 118.878 314.830,122.000 315.019,122.000 314.500 C 122.000 314.335,123.080 314.200,124.400 314.200 C 125.720 314.200,126.800 314.335,126.800 314.500 C 126.800 314.665,127.340 314.800,128.000 314.800 C 128.667 314.800,129.200 314.587,129.200 314.320 C 129.200 313.947,129.307 313.947,129.680 314.320 C 130.288 314.928,134.680 314.959,134.881 314.356 C 134.990 314.031,135.794 314.031,137.891 314.356 C 141.453 314.909,146.000 314.935,146.000 314.403 C 146.000 314.184,146.720 314.034,147.600 314.068 C 148.480 314.103,149.200 314.282,149.200 314.466 C 149.200 314.967,153.110 314.869,153.279 314.363 C 153.384 314.047,154.646 314.043,157.812 314.350 C 160.786 314.639,164.907 314.655,170.600 314.401 C 181.885 313.896,201.751 313.908,223.656 314.432 C 235.664 314.720,241.796 314.731,241.960 314.465 C 242.250 313.995,272.400 314.030,272.400 314.500 C 272.400 314.665,275.100 314.800,278.400 314.800 C 282.133 314.800,284.400 314.649,284.400 314.400 C 284.400 314.180,285.120 314.000,286.000 314.000 C 286.880 314.000,287.600 314.180,287.600 314.400 C 287.600 314.937,301.170 314.917,307.392 314.371 C 310.767 314.075,312.226 314.077,312.325 314.376 C 312.509 314.926,318.800 314.949,318.800 314.400 C 318.800 313.877,320.850 313.887,322.241 314.416 C 323.015 314.710,323.413 314.703,323.605 314.392 C 323.936 313.857,328.800 313.966,328.800 314.508 C 328.800 314.716,329.115 314.755,329.500 314.595 C 330.312 314.258,330.642 314.254,331.988 314.562 C 332.532 314.686,333.567 314.575,334.288 314.314 L 335.600 313.839 335.600 310.473 C 335.600 307.147,335.589 307.111,334.700 307.449 C 332.519 308.279,102.221 308.065,101.327 307.233 C 100.729 306.675,100.378 306.582,100.063 306.897 C 99.355 307.605,99.038 306.156,99.603 304.793 C 99.875 304.137,100.243 303.600,100.421 303.600 C 101.299 303.600,102.429 301.236,101.932 300.440 C 101.157 299.198,79.389 299.176,78.995 300.416 M240.300 314.291 C 239.475 314.378,238.125 314.378,237.300 314.291 C 236.475 314.205,237.150 314.134,238.800 314.134 C 240.450 314.134,241.125 314.205,240.300 314.291 M281.300 314.297 C 279.705 314.373,277.095 314.373,275.500 314.297 C 273.905 314.221,275.210 314.159,278.400 314.159 C 281.590 314.159,282.895 314.221,281.300 314.297 M299.500 314.298 C 297.355 314.370,293.845 314.370,291.700 314.298 C 289.555 314.226,291.310 314.167,295.600 314.167 C 299.890 314.167,301.645 314.226,299.500 314.298 " stroke="none" fill="#949499" fill-rule="evenodd"></path><path id="path3" d="M191.953 116.020 C 190.767 117.296,190.237 118.400,190.813 118.400 C 191.026 118.400,191.200 118.164,191.200 117.875 C 191.200 117.586,191.704 116.867,192.320 116.277 L 193.439 115.204 229.420 115.100 L 265.400 114.996 229.200 114.945 L 193.000 114.895 191.953 116.020 M266.044 115.465 C 267.490 115.851,267.944 118.280,266.995 120.551 C 266.250 122.333,266.510 122.463,267.371 120.739 C 268.511 118.453,267.714 115.129,266.054 115.246 C 265.461 115.288,265.461 115.309,266.044 115.465 M189.771 119.106 C 189.238 119.471,188.720 120.801,189.113 120.797 C 189.271 120.795,189.608 120.345,189.862 119.797 C 190.117 119.249,190.297 118.803,190.262 118.806 C 190.228 118.809,190.007 118.944,189.771 119.106 M188.171 121.506 C 187.638 121.871,187.120 123.201,187.513 123.197 C 187.671 123.195,188.008 122.745,188.262 122.197 C 188.517 121.649,188.697 121.203,188.662 121.206 C 188.628 121.209,188.407 121.344,188.171 121.506 M186.571 123.906 C 186.153 124.192,185.484 125.600,185.767 125.600 C 185.844 125.600,186.203 125.150,186.563 124.600 C 187.258 123.540,187.259 123.435,186.571 123.906 M119.068 180.967 C 118.939 181.302,118.390 181.688,117.846 181.824 C 117.303 181.961,116.764 182.317,116.649 182.617 C 116.517 182.960,117.095 182.796,118.205 182.176 C 119.177 181.634,120.140 181.238,120.346 181.295 C 120.552 181.353,120.783 181.220,120.860 181.000 C 121.092 180.337,119.322 180.304,119.068 180.967 M114.744 183.990 L 113.800 184.781 114.897 184.290 C 115.500 184.021,115.995 183.665,115.997 183.500 C 116.002 183.041,115.771 183.131,114.744 183.990 M112.734 185.069 C 112.368 185.166,111.978 185.481,111.867 185.770 C 111.707 186.186,111.865 186.202,112.630 185.847 C 113.160 185.601,113.595 185.265,113.597 185.100 C 113.599 184.935,113.555 184.821,113.500 184.846 C 113.445 184.872,113.100 184.972,112.734 185.069 M110.400 186.667 C 110.070 186.762,109.454 187.326,109.032 187.920 L 108.264 189.000 109.258 188.100 C 109.804 187.605,110.465 187.200,110.726 187.200 C 110.987 187.200,111.200 187.020,111.200 186.800 C 111.200 186.580,111.155 186.421,111.100 186.446 C 111.045 186.472,110.730 186.571,110.400 186.667 M107.200 189.067 C 106.870 189.162,106.247 189.721,105.815 190.308 L 105.031 191.375 106.303 190.469 C 107.347 189.726,108.406 188.665,107.924 188.846 C 107.856 188.872,107.530 188.971,107.200 189.067 M99.700 194.712 C 99.205 194.791,98.800 195.017,98.800 195.214 C 98.800 195.411,98.217 196.253,97.505 197.086 L 96.210 198.600 98.034 196.957 C 99.038 196.053,100.115 195.223,100.429 195.112 C 101.257 194.819,100.754 194.543,99.700 194.712 M88.600 205.683 C 87.748 206.172,86.834 207.204,86.813 207.700 C 86.779 208.486,87.893 207.820,88.682 206.583 C 89.166 205.822,89.526 205.205,89.482 205.212 C 89.437 205.219,89.040 205.431,88.600 205.683 M85.666 209.589 C 84.932 210.236,84.448 210.954,84.591 211.185 C 84.734 211.417,84.569 211.714,84.225 211.846 C 83.881 211.978,83.600 212.302,83.600 212.567 C 83.600 212.832,83.240 213.436,82.800 213.908 C 82.360 214.380,82.000 215.044,82.000 215.383 C 82.000 215.722,81.820 216.000,81.600 216.000 C 81.380 216.000,81.206 216.225,81.214 216.500 C 81.233 217.141,83.195 214.767,83.198 214.100 C 83.199 213.825,83.380 213.600,83.600 213.600 C 83.820 213.600,84.000 213.358,84.000 213.062 C 84.000 212.766,84.360 212.198,84.800 211.800 C 85.240 211.402,85.600 210.891,85.600 210.664 C 85.600 210.437,85.991 209.835,86.470 209.326 C 87.673 208.045,87.266 208.178,85.666 209.589 M80.100 219.423 C 79.825 219.722,79.600 220.424,79.600 220.983 C 79.600 221.542,79.420 222.000,79.200 222.000 C 78.980 222.000,78.800 222.285,78.800 222.633 C 78.800 223.633,79.787 223.046,79.917 221.969 C 79.981 221.436,80.236 220.595,80.484 220.101 C 81.018 219.034,80.805 218.658,80.100 219.423 M334.200 228.806 L 333.000 229.038 334.200 229.284 C 335.471 229.544,335.772 229.461,335.542 228.912 C 335.464 228.726,334.860 228.679,334.200 228.806 M249.034 229.457 C 248.844 229.951,248.907 230.011,249.291 229.700 C 249.571 229.472,250.160 229.198,250.600 229.089 C 251.231 228.934,251.177 228.883,250.343 228.846 C 249.700 228.818,249.187 229.057,249.034 229.457 M78.800 234.724 C 78.800 234.939,79.085 235.224,79.433 235.357 C 79.823 235.507,80.006 235.418,79.908 235.125 C 79.709 234.527,78.800 234.198,78.800 234.724 M243.373 238.100 C 241.843 240.389,241.643 240.815,242.610 239.725 C 243.501 238.721,244.944 236.400,244.677 236.400 C 244.584 236.400,243.998 237.165,243.373 238.100 M79.900 237.865 C 80.175 237.976,80.400 238.502,80.400 239.033 C 80.400 239.565,80.580 240.000,80.800 240.000 C 81.020 240.000,81.200 240.360,81.200 240.800 C 81.200 241.240,81.380 241.600,81.600 241.600 C 81.820 241.600,82.000 241.941,82.000 242.357 C 82.000 242.774,82.247 243.209,82.548 243.325 C 83.067 243.524,82.441 241.769,81.185 239.505 C 80.973 239.123,80.800 238.538,80.800 238.205 C 80.800 237.872,80.485 237.614,80.100 237.632 C 79.682 237.650,79.601 237.744,79.900 237.865 M238.933 244.700 C 238.556 245.305,238.057 246.070,237.824 246.400 C 237.474 246.895,237.505 246.918,238.000 246.531 C 238.663 246.012,240.171 243.600,239.832 243.600 C 239.714 243.600,239.310 244.095,238.933 244.700 M82.800 244.400 C 82.800 244.620,82.950 244.800,83.132 244.800 C 83.315 244.800,83.719 245.295,84.030 245.900 C 84.534 246.882,85.891 248.400,86.265 248.400 C 86.474 248.400,85.481 246.719,84.897 246.084 C 84.621 245.784,84.210 245.192,83.983 244.769 C 83.549 243.957,82.800 243.723,82.800 244.400 M86.674 249.500 C 87.082 250.647,87.237 250.824,87.619 250.588 C 87.827 250.460,87.773 250.026,87.496 249.581 C 86.889 248.610,86.338 248.556,86.674 249.500 M89.886 253.400 C 91.067 254.610,92.217 255.600,92.441 255.600 C 92.664 255.600,92.755 255.750,92.641 255.933 C 92.528 256.117,92.697 256.267,93.018 256.267 C 93.827 256.267,93.748 255.628,92.900 255.324 C 92.515 255.185,91.360 254.201,90.333 253.136 C 89.306 252.071,88.302 251.200,88.102 251.200 C 87.902 251.200,88.705 252.190,89.886 253.400 M232.953 253.700 C 231.576 256.036,231.486 256.235,232.187 255.400 C 233.000 254.432,233.700 253.200,233.438 253.200 C 233.333 253.200,233.115 253.425,232.953 253.700 M95.470 258.239 C 95.728 258.911,96.935 259.004,96.712 258.335 C 96.626 258.079,96.264 257.827,95.906 257.774 C 95.493 257.714,95.334 257.883,95.470 258.239 M229.200 259.400 C 228.519 260.390,228.052 261.200,228.162 261.200 C 228.272 261.200,228.919 260.390,229.600 259.400 C 230.281 258.410,230.748 257.600,230.638 257.600 C 230.528 257.600,229.881 258.410,229.200 259.400 M98.248 259.819 C 98.105 260.193,98.279 260.400,98.737 260.400 C 99.129 260.400,99.855 260.778,100.351 261.240 C 100.847 261.702,101.349 261.984,101.467 261.867 C 101.809 261.524,101.205 260.800,100.576 260.800 C 100.259 260.800,100.000 260.663,100.000 260.496 C 100.000 259.804,98.480 259.216,98.248 259.819 M224.755 266.054 C 223.130 268.504,221.697 270.667,221.572 270.862 C 221.126 271.552,120.916 271.490,120.961 270.800 C 120.988 270.379,120.683 270.237,119.938 270.324 C 119.354 270.392,118.759 270.257,118.615 270.024 C 118.471 269.791,118.171 269.600,117.948 269.600 C 117.725 269.600,117.813 269.870,118.143 270.200 C 118.473 270.530,119.006 270.800,119.329 270.800 C 119.651 270.800,120.018 271.070,120.145 271.400 C 120.460 272.223,220.243 272.321,221.275 271.500 C 221.621 271.225,223.153 269.110,224.680 266.800 C 227.916 261.904,228.103 261.600,227.878 261.600 C 227.785 261.600,226.380 263.604,224.755 266.054 M103.703 263.133 C 104.310 263.533,104.670 263.997,104.503 264.163 C 104.336 264.330,104.380 264.430,104.600 264.386 C 105.533 264.198,106.429 264.430,106.200 264.800 C 106.060 265.027,106.396 265.200,106.976 265.200 C 107.539 265.200,108.000 265.380,108.000 265.600 C 108.000 265.820,108.371 266.000,108.824 266.000 C 109.277 266.000,109.560 266.142,109.452 266.315 C 109.345 266.488,109.740 266.669,110.329 266.716 C 111.227 266.787,111.110 266.649,109.600 265.860 C 105.243 263.582,104.192 262.982,104.067 262.700 C 103.993 262.535,103.633 262.401,103.267 262.403 C 102.803 262.404,102.936 262.627,103.703 263.133 M115.790 269.448 C 116.147 269.804,116.538 269.996,116.659 269.874 C 117.015 269.518,116.406 268.800,115.748 268.800 C 115.225 268.800,115.231 268.888,115.790 269.448 M109.200 290.600 C 109.200 290.930,109.380 291.200,109.600 291.200 C 109.820 291.200,110.000 290.930,110.000 290.600 C 110.000 290.270,109.820 290.000,109.600 290.000 C 109.380 290.000,109.200 290.270,109.200 290.600 M108.400 292.367 C 108.400 292.788,108.216 293.225,107.990 293.337 C 107.764 293.449,107.792 293.499,108.052 293.449 C 108.640 293.336,109.331 291.600,108.787 291.600 C 108.574 291.600,108.400 291.945,108.400 292.367 M106.000 296.400 C 106.000 296.840,105.790 297.200,105.533 297.200 C 105.277 297.200,105.201 297.335,105.366 297.499 C 105.531 297.664,105.921 297.450,106.233 297.023 C 106.899 296.112,106.959 295.600,106.400 295.600 C 106.180 295.600,106.000 295.960,106.000 296.400 M104.400 298.600 C 104.400 298.930,104.580 299.200,104.800 299.200 C 105.020 299.200,105.200 298.930,105.200 298.600 C 105.200 298.270,105.020 298.000,104.800 298.000 C 104.580 298.000,104.400 298.270,104.400 298.600 M101.600 300.058 C 101.600 300.220,101.780 300.464,102.000 300.600 C 102.650 301.001,102.478 301.414,100.983 303.046 C 99.448 304.722,98.864 306.224,99.500 306.860 C 99.970 307.330,100.769 306.281,102.982 302.285 L 104.486 299.569 103.043 299.666 C 102.249 299.720,101.600 299.896,101.600 300.058 M78.202 303.626 C 78.343 305.277,78.800 305.632,78.800 304.090 C 78.800 303.407,78.642 302.750,78.450 302.631 C 78.257 302.511,78.146 302.960,78.202 303.626 M78.348 306.900 C 78.050 307.466,78.143 311.959,78.447 311.771 C 78.663 311.637,78.801 310.465,78.754 309.164 C 78.680 307.126,78.565 306.485,78.348 306.900 M101.800 307.600 C 102.110 308.102,332.632 308.102,333.800 307.600 C 334.249 307.407,283.435 307.244,218.076 307.228 C 140.489 307.209,101.635 307.334,101.800 307.600 M91.700 314.287 C 92.305 314.378,93.295 314.378,93.900 314.287 C 94.505 314.195,94.010 314.120,92.800 314.120 C 91.590 314.120,91.095 314.195,91.700 314.287 M134.800 314.371 C 134.800 314.630,135.779 314.800,137.267 314.800 C 140.250 314.800,140.191 314.596,137.100 314.221 C 135.557 314.034,134.800 314.084,134.800 314.371 M153.200 314.400 C 153.200 314.620,153.931 314.800,154.824 314.800 C 155.804 314.800,156.349 314.642,156.200 314.400 C 156.064 314.180,155.333 314.000,154.576 314.000 C 153.819 314.000,153.200 314.180,153.200 314.400 M175.800 314.400 C 175.637 314.665,181.937 314.800,194.400 314.800 C 206.863 314.800,213.163 314.665,213.000 314.400 C 212.841 314.143,206.204 314.000,194.400 314.000 C 182.596 314.000,175.959 314.143,175.800 314.400 M237.300 314.291 C 238.125 314.378,239.475 314.378,240.300 314.291 C 241.125 314.205,240.450 314.134,238.800 314.134 C 237.150 314.134,236.475 314.205,237.300 314.291 M242.000 314.431 C 242.000 314.650,248.174 314.800,257.200 314.800 C 265.560 314.800,272.400 314.665,272.400 314.500 C 272.400 314.335,265.560 314.169,257.200 314.131 C 248.123 314.089,242.000 314.210,242.000 314.431 M275.500 314.297 C 277.095 314.373,279.705 314.373,281.300 314.297 C 282.895 314.221,281.590 314.159,278.400 314.159 C 275.210 314.159,273.905 314.221,275.500 314.297 M284.400 314.400 C 284.400 314.620,285.120 314.800,286.000 314.800 C 286.880 314.800,287.600 314.620,287.600 314.400 C 287.600 314.180,286.880 314.000,286.000 314.000 C 285.120 314.000,284.400 314.180,284.400 314.400 M291.700 314.298 C 293.845 314.370,297.355 314.370,299.500 314.298 C 301.645 314.226,299.890 314.167,295.600 314.167 C 291.310 314.167,289.555 314.226,291.700 314.298 M309.400 314.400 C 309.251 314.642,309.796 314.800,310.776 314.800 C 311.669 314.800,312.400 314.620,312.400 314.400 C 312.400 314.180,311.781 314.000,311.024 314.000 C 310.267 314.000,309.536 314.180,309.400 314.400 M318.800 314.400 C 318.800 314.620,319.531 314.800,320.424 314.800 C 321.404 314.800,321.949 314.642,321.800 314.400 C 321.664 314.180,320.933 314.000,320.176 314.000 C 319.419 314.000,318.800 314.180,318.800 314.400 M323.600 314.379 C 323.600 314.631,324.646 314.800,326.200 314.800 C 327.630 314.800,328.800 314.648,328.800 314.463 C 328.800 314.278,327.630 314.088,326.200 314.042 C 324.593 313.990,323.600 314.119,323.600 314.379 " stroke="none" fill="#829dac" fill-rule="evenodd"></path><path id="path4" d="M192.051 114.683 C 191.803 114.949,191.600 115.444,191.600 115.783 C 191.600 116.133,191.254 116.400,190.800 116.400 C 190.267 116.400,190.000 116.667,190.000 117.200 C 190.000 117.640,189.820 118.000,189.600 118.000 C 189.380 118.000,189.200 118.270,189.200 118.600 C 189.200 118.930,189.374 119.200,189.586 119.200 C 190.121 119.200,190.890 117.670,190.595 117.192 C 190.462 116.976,190.620 116.800,190.947 116.800 C 191.274 116.800,191.899 116.346,192.335 115.792 L 193.128 114.784 229.787 114.892 L 266.446 115.000 267.214 116.000 C 267.637 116.550,268.015 117.630,268.055 118.400 L 268.128 119.800 268.287 118.525 C 268.526 116.620,267.466 114.882,265.899 114.611 C 263.035 114.114,192.518 114.183,192.051 114.683 M188.400 120.400 C 188.400 120.840,188.190 121.200,187.933 121.200 C 187.677 121.200,187.601 121.335,187.766 121.499 C 187.931 121.664,188.321 121.450,188.633 121.023 C 189.299 120.112,189.359 119.600,188.800 119.600 C 188.580 119.600,188.400 119.960,188.400 120.400 M266.289 122.700 C 265.514 124.185,264.456 126.164,263.939 127.097 L 263.000 128.793 223.457 128.797 L 183.913 128.800 184.164 127.800 C 184.302 127.250,184.309 126.800,184.179 126.800 C 183.703 126.800,182.800 127.960,182.800 128.571 C 182.800 128.917,182.620 129.200,182.400 129.200 C 182.180 129.200,182.000 129.560,182.000 130.000 C 182.000 130.440,181.850 130.800,181.668 130.800 C 181.485 130.800,181.081 131.295,180.770 131.900 C 180.460 132.505,179.889 133.291,179.503 133.647 C 179.116 134.003,178.800 134.588,178.800 134.947 C 178.800 135.306,178.650 135.600,178.468 135.600 C 178.285 135.600,177.881 136.095,177.570 136.700 C 177.260 137.305,176.689 138.091,176.303 138.447 C 175.916 138.803,175.600 139.348,175.600 139.659 C 175.600 139.969,175.240 140.483,174.800 140.800 C 174.360 141.117,174.000 141.609,174.000 141.892 C 174.000 142.175,173.460 142.972,172.800 143.663 C 172.140 144.354,171.600 145.162,171.600 145.459 C 171.600 145.757,171.420 146.000,171.200 146.000 C 170.980 146.000,170.800 146.320,170.800 146.712 C 170.800 147.103,170.440 147.683,170.000 148.000 C 169.560 148.317,169.200 148.857,169.200 149.200 C 169.200 149.543,168.840 150.083,168.400 150.400 C 167.960 150.717,167.600 151.257,167.600 151.600 C 167.600 151.943,167.240 152.483,166.800 152.800 C 166.360 153.117,166.000 153.617,166.000 153.912 C 166.000 154.215,165.799 154.323,165.538 154.162 C 165.264 153.993,165.185 154.051,165.342 154.306 C 165.488 154.542,165.323 155.019,164.976 155.367 C 164.590 155.753,164.445 156.310,164.601 156.804 C 164.983 158.006,243.244 157.876,245.668 156.670 C 248.788 155.117,250.569 152.681,256.102 142.400 C 258.408 138.115,263.981 128.008,265.808 124.800 C 267.424 121.960,268.269 120.000,267.877 120.000 C 267.779 120.000,267.065 121.215,266.289 122.700 M186.469 122.839 C 185.790 123.925,186.288 124.441,187.033 123.423 C 187.345 122.996,187.600 122.501,187.600 122.324 C 187.600 121.720,186.995 121.996,186.469 122.839 M184.869 125.239 C 184.190 126.325,184.688 126.841,185.433 125.823 C 185.745 125.396,186.000 124.901,186.000 124.724 C 186.000 124.120,185.395 124.396,184.869 125.239 M119.600 179.971 C 119.600 180.175,119.871 180.400,120.202 180.471 C 120.733 180.585,120.804 185.935,120.814 226.129 C 120.822 255.836,120.962 271.613,121.219 271.527 C 121.635 271.388,121.787 180.627,121.373 179.956 C 121.081 179.485,119.600 179.496,119.600 179.971 M117.660 181.042 C 117.362 181.378,117.212 181.745,117.325 181.859 C 117.619 182.153,119.200 181.248,119.200 180.786 C 119.200 180.199,118.268 180.354,117.660 181.042 M115.375 182.700 C 114.949 183.085,114.105 183.655,113.500 183.968 C 112.513 184.477,112.011 185.200,112.644 185.200 C 113.119 185.200,116.800 182.660,116.800 182.333 C 116.800 181.796,116.208 181.948,115.375 182.700 M110.460 185.842 C 110.162 186.178,110.012 186.545,110.125 186.659 C 110.419 186.953,112.000 186.048,112.000 185.586 C 112.000 184.999,111.068 185.154,110.460 185.842 M109.200 187.133 C 109.200 187.390,108.917 187.600,108.571 187.600 C 107.965 187.600,106.800 188.502,106.800 188.971 C 106.800 189.470,107.612 189.152,108.678 188.234 C 109.295 187.703,109.665 187.133,109.500 186.967 C 109.335 186.802,109.200 186.877,109.200 187.133 M103.600 191.200 C 102.610 192.276,101.562 193.166,101.271 193.178 C 100.625 193.205,99.421 194.354,99.722 194.656 C 100.008 194.941,100.773 194.485,102.657 192.909 C 103.506 192.198,104.695 191.240,105.300 190.780 C 105.905 190.319,106.400 189.775,106.400 189.571 C 106.400 188.719,105.287 189.366,103.600 191.200 M97.200 196.824 C 96.650 197.458,95.999 197.981,95.754 197.988 C 95.146 198.004,90.800 202.217,90.800 202.789 C 90.800 203.041,90.592 203.119,90.338 202.962 C 90.052 202.785,89.985 202.852,90.162 203.138 C 90.331 203.412,90.193 203.600,89.824 203.600 C 89.476 203.600,89.200 203.939,89.200 204.367 C 89.200 204.788,88.975 205.224,88.700 205.335 C 88.425 205.446,88.380 205.550,88.600 205.567 C 89.077 205.602,98.635 196.101,98.378 195.847 C 98.280 195.751,97.750 196.190,97.200 196.824 M86.000 208.400 C 86.000 208.933,85.733 209.200,85.200 209.200 C 84.756 209.200,84.400 209.467,84.400 209.800 C 84.400 210.130,84.591 210.400,84.824 210.400 C 85.057 210.400,85.136 210.220,85.000 210.000 C 84.864 209.780,85.006 209.600,85.314 209.600 C 86.016 209.600,87.297 208.230,86.934 207.868 C 86.426 207.360,86.000 207.603,86.000 208.400 M83.788 211.220 C 83.407 211.835,83.928 212.232,84.442 211.718 C 84.729 211.431,84.736 211.207,84.462 211.039 C 84.239 210.900,83.935 210.982,83.788 211.220 M81.200 215.400 C 81.200 215.730,81.380 216.000,81.600 216.000 C 81.820 216.000,82.000 215.730,82.000 215.400 C 82.000 215.070,81.820 214.800,81.600 214.800 C 81.380 214.800,81.200 215.070,81.200 215.400 M78.267 225.067 C 77.676 225.658,77.968 232.787,78.574 232.555 C 79.020 232.384,79.139 231.496,79.109 228.567 C 79.074 225.038,78.923 224.411,78.267 225.067 M248.511 229.500 C 247.875 230.325,246.297 232.620,245.006 234.600 C 243.714 236.580,242.308 238.717,241.881 239.349 C 241.454 239.980,238.763 244.030,235.902 248.349 C 220.340 271.836,221.127 270.734,219.610 271.140 L 218.200 271.517 219.400 271.553 C 221.241 271.607,222.043 270.483,243.832 237.327 L 249.400 228.854 292.276 228.827 C 320.400 228.809,335.238 228.662,335.400 228.400 C 335.564 228.134,321.215 228.000,292.657 228.000 L 249.667 228.000 248.511 229.500 M78.860 235.580 C 79.032 236.096,79.581 236.188,79.630 235.710 C 79.647 235.550,79.444 235.348,79.180 235.260 C 78.916 235.172,78.772 235.316,78.860 235.580 M81.200 242.200 C 81.200 242.530,81.380 242.800,81.600 242.800 C 81.820 242.800,82.000 242.530,82.000 242.200 C 82.000 241.870,81.820 241.600,81.600 241.600 C 81.380 241.600,81.200 241.870,81.200 242.200 M85.333 248.582 C 85.333 248.903,85.483 249.072,85.667 248.959 C 85.850 248.845,86.000 249.033,86.000 249.376 C 86.000 249.719,86.180 250.000,86.400 250.000 C 86.907 250.000,86.904 249.741,86.386 248.774 C 85.897 247.860,85.333 247.758,85.333 248.582 M92.800 256.198 C 94.138 257.978,95.200 258.588,95.200 257.576 C 95.200 257.343,95.040 257.251,94.845 257.372 C 94.650 257.492,94.388 257.196,94.261 256.713 C 94.135 256.230,93.906 255.961,93.753 256.114 C 93.599 256.267,93.187 256.170,92.837 255.897 C 92.261 255.448,92.257 255.476,92.800 256.198 M96.666 258.693 C 96.530 258.913,96.757 259.399,97.170 259.773 C 97.769 260.315,97.982 260.346,98.224 259.926 C 98.392 259.637,98.374 259.541,98.185 259.713 C 97.996 259.884,97.633 259.635,97.378 259.159 C 97.123 258.682,96.803 258.472,96.666 258.693 M98.800 260.656 C 98.800 260.966,100.081 261.970,100.500 261.987 C 100.665 261.994,100.800 261.809,100.800 261.576 C 100.800 261.343,100.639 261.252,100.442 261.374 C 100.245 261.496,99.981 261.326,99.854 260.998 C 99.631 260.415,98.800 260.146,98.800 260.656 M101.456 261.878 C 101.005 262.328,101.181 262.800,101.800 262.800 C 102.130 262.800,102.400 262.631,102.400 262.424 C 102.400 261.919,101.775 261.558,101.456 261.878 M106.800 265.600 C 106.800 265.820,107.070 266.000,107.400 266.000 C 107.730 266.000,108.000 265.820,108.000 265.600 C 108.000 265.380,107.730 265.200,107.400 265.200 C 107.070 265.200,106.800 265.380,106.800 265.600 M110.000 267.200 C 110.000 267.420,110.270 267.600,110.600 267.600 C 110.930 267.600,111.200 267.420,111.200 267.200 C 111.200 266.980,110.930 266.800,110.600 266.800 C 110.270 266.800,110.000 266.980,110.000 267.200 M113.200 268.800 C 113.200 269.020,113.470 269.200,113.800 269.200 C 114.130 269.200,114.400 269.020,114.400 268.800 C 114.400 268.580,114.130 268.400,113.800 268.400 C 113.470 268.400,113.200 268.580,113.200 268.800 M114.800 269.600 C 114.800 269.820,115.070 270.000,115.400 270.000 C 115.730 270.000,116.000 269.820,116.000 269.600 C 116.000 269.380,115.730 269.200,115.400 269.200 C 115.070 269.200,114.800 269.380,114.800 269.600 M119.097 271.300 C 119.315 271.575,119.593 272.070,119.715 272.400 C 119.841 272.742,119.950 272.527,119.968 271.900 C 119.990 271.139,119.800 270.800,119.351 270.800 C 118.888 270.800,118.815 270.943,119.097 271.300 M125.300 271.476 C 125.685 271.576,126.315 271.576,126.700 271.476 C 127.085 271.375,126.770 271.293,126.000 271.293 C 125.230 271.293,124.915 271.375,125.300 271.476 M91.700 314.687 C 92.305 314.778,93.295 314.778,93.900 314.687 C 94.505 314.595,94.010 314.520,92.800 314.520 C 91.590 314.520,91.095 314.595,91.700 314.687 M101.700 314.676 C 102.085 314.776,102.715 314.776,103.100 314.676 C 103.485 314.575,103.170 314.493,102.400 314.493 C 101.630 314.493,101.315 314.575,101.700 314.676 M123.100 314.689 C 123.815 314.778,124.985 314.778,125.700 314.689 C 126.415 314.601,125.830 314.528,124.400 314.528 C 122.970 314.528,122.385 314.601,123.100 314.689 M146.500 314.676 C 146.885 314.776,147.515 314.776,147.900 314.676 C 148.285 314.575,147.970 314.493,147.200 314.493 C 146.430 314.493,146.115 314.575,146.500 314.676 M157.300 314.687 C 157.905 314.778,158.895 314.778,159.500 314.687 C 160.105 314.595,159.610 314.520,158.400 314.520 C 157.190 314.520,156.695 314.595,157.300 314.687 M167.700 314.697 C 169.185 314.774,171.615 314.774,173.100 314.697 C 174.585 314.620,173.370 314.557,170.400 314.557 C 167.430 314.557,166.215 314.620,167.700 314.697 M217.700 314.699 C 220.285 314.768,224.515 314.768,227.100 314.699 C 229.685 314.629,227.570 314.572,222.400 314.572 C 217.230 314.572,215.115 314.629,217.700 314.699 M305.500 314.689 C 306.215 314.778,307.385 314.778,308.100 314.689 C 308.815 314.601,308.230 314.528,306.800 314.528 C 305.370 314.528,304.785 314.601,305.500 314.689 " stroke="none" fill="#89b1cf" fill-rule="evenodd"></path></g></svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="CrewAI"@@ -2242,6 +2390,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="LlamaIndex"@@ -2259,6 +2411,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" /> <img src="https://cdn.simpleicons.org/typescript/ffa500" width="16" height="16" alt="TypeScript SDK" title="TypeScript SDK" />+ </div>+</Card><Cardtitle="Browser Use"@@ -2273,6 +2429,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Pydantic AI"@@ -2310,6 +2470,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line}iconType="duotone">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="DSPy"@@ -2321,6 +2485,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="AutoGen / AG2"@@ -2335,6 +2503,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Haystack"@@ -2347,6 +2519,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="mem0"@@ -2476,6 +2652,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Guardrails AI"@@ -2488,6 +2668,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Phidata"@@ -2499,6 +2683,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="MultiOn"@@ -2510,6 +2698,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Julep AI"@@ -2549,6 +2741,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Letta"@@ -2631,6 +2827,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Crawl4AI"@@ -2638,6 +2838,10 @@ Start integrating and monitoring your applications with OpenLIT in just one lineiconType="duotone"icon="robot">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="FireCrawl"@@ -2645,6 +2849,10 @@ Start integrating and monitoring your applications with OpenLIT in just one lineiconType="duotone"icon="fire">+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="Dynamiq"@@ -2662,6 +2870,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="ControlFlow"@@ -2705,6 +2917,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="SwarmZero"@@ -2753,6 +2969,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card></CardGroup>@@ -2769,6 +2989,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line</svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card><Cardtitle="AMD Radeon"@@ -2778,6 +3002,10 @@ Start integrating and monitoring your applications with OpenLIT in just one line<svg width="50" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 200"><path d="M187.888 178.12H143.52l-13.573-32.735H56.003L43.637 178.12H0L66.667 12.776h47.761zM91.155 52.285L66.912 116.53h50.913zM349.056 12.776h35.88V178.12h-41.219V74.842l-44.608 51.878h-6.301l-44.605-51.878V178.12h-41.219V12.776h35.88l53.093 61.336zM489.375 12.776c60.364 0 91.391 37.573 91.391 82.909 0 47.517-30.058 82.435-96 82.435h-68.369V12.776zm-31.762 135.039h26.906c41.457 0 53.823-28.127 53.823-52.375 0-28.368-15.276-52.363-54.308-52.363h-26.422v104.738z"/><g fill="#00a76d"><path d="M748.028 51.981h-85.259L610.797 0H800v189.21l-51.972-51.975zM662.708 137.296V62.397L609.2 115.901v74.903h74.889l53.505-53.508z"/></g></svg>}>+ <div style={{position: "absolute", top: "12px", right: "12px", display: "flex", gap: "4px"}}>+ <img src="https://cdn.simpleicons.org/python/ffa500" width="16" height="16" alt="Python SDK" title="Python SDK" />+ </div>+</Card></CardGroup>diff --git a/sdk/typescript/src/instrumentation/bedrock/index.ts b/sdk/typescript/src/instrumentation/bedrock/index.tsnew file mode 100644index 00000000..f80c7daa--- /dev/null+++ b/sdk/typescript/src/instrumentation/bedrock/index.ts@@ -0,0 +1,66 @@+import {+ InstrumentationBase,+ InstrumentationModuleDefinition,+ InstrumentationNodeModuleDefinition,+ isWrapped,+} from '@opentelemetry/instrumentation';+import { InstrumentationConfig } from '@opentelemetry/instrumentation';+import { INSTRUMENTATION_PREFIX } from '../../constant';+import BedrockWrapper from './wrapper';++export interface BedrockInstrumentationConfig extends InstrumentationConfig {}++export default class OpenlitBedrockInstrumentation extends InstrumentationBase {+ constructor(config: BedrockInstrumentationConfig = {}) {+ super(`${INSTRUMENTATION_PREFIX}/instrumentation-bedrock`, '1.0.0', config);+ }++ protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[] {+ const module = new InstrumentationNodeModuleDefinition(+ '@aws-sdk/client-bedrock-runtime',+ ['>=3.0.0'],+ (moduleExports) => {+ this._patch(moduleExports);+ return moduleExports;+ },+ (moduleExports) => {+ if (moduleExports !== undefined) {+ this._unpatch(moduleExports);+ }+ }+ );+ return [module];+ }++ public manualPatch(bedrock: any): void {+ this._patch(bedrock);+ }++ protected _patch(moduleExports: any) {+ try {+ const BedrockRuntimeClient = moduleExports.BedrockRuntimeClient;+ if (!BedrockRuntimeClient?.prototype) return;++ if (isWrapped(BedrockRuntimeClient.prototype.send)) {+ this._unwrap(BedrockRuntimeClient.prototype, 'send');+ }++ this._wrap(+ BedrockRuntimeClient.prototype,+ 'send',+ BedrockWrapper._patchSend(this.tracer)+ );+ } catch (e) {+ console.error('Error in Bedrock _patch method:', e);+ }+ }++ protected _unpatch(moduleExports: any) {+ try {+ const BedrockRuntimeClient = moduleExports.BedrockRuntimeClient;+ if (BedrockRuntimeClient?.prototype?.send) {+ this._unwrap(BedrockRuntimeClient.prototype, 'send');+ }+ } catch { /* ignore */ }+ }+}diff --git a/sdk/typescript/src/instrumentation/bedrock/wrapper.ts b/sdk/typescript/src/instrumentation/bedrock/wrapper.tsnew file mode 100644index 00000000..015fc137--- /dev/null+++ b/sdk/typescript/src/instrumentation/bedrock/wrapper.ts@@ -0,0 +1,413 @@+import { SpanKind, Tracer, context, trace } from '@opentelemetry/api';+import OpenlitConfig from '../../config';+import OpenLitHelper from '../../helpers';+import SemanticConvention from '../../semantic-convention';+import BaseWrapper, { BaseSpanAttributes } from '../base-wrapper';++const BEDROCK_SERVER_ADDRESS = 'bedrock-runtime.amazonaws.com';+const BEDROCK_SERVER_PORT = 443;++function mapFinishReason(stopReason: string): string {+ const map: Record<string, string> = {+ end_turn: 'stop',+ max_tokens: 'max_tokens',+ stop_sequence: 'stop',+ tool_use: 'tool_calls',+ content_filtered: 'content_filter',+ guardrail_intervention: 'content_filter',+ };+ return map[stopReason] || stopReason;+}++function applyInferenceConfigAttributes(span: any, inferenceConfig: any) {+ if (inferenceConfig.maxTokens !== undefined)+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS, inferenceConfig.maxTokens);+ if (inferenceConfig.temperature !== undefined)+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE, inferenceConfig.temperature);+ if (inferenceConfig.topP !== undefined)+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_TOP_P, inferenceConfig.topP);+ if (inferenceConfig.topK !== undefined)+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_TOP_K, inferenceConfig.topK);+ if (inferenceConfig.stopSequences !== undefined)+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES, inferenceConfig.stopSequences);+}++class BedrockWrapper extends BaseWrapper {+ static aiSystem = SemanticConvention.GEN_AI_SYSTEM_AWS_BEDROCK;++ static _patchSend(tracer: Tracer): any {+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const command = args[0];+ if (!command) return originalMethod.apply(this, args);++ const commandName = command.constructor?.name || '';++ if (commandName === 'ConverseCommand') {+ return BedrockWrapper._handleConverseCommand(tracer, originalMethod, this, args);+ }+ if (commandName === 'ConverseStreamCommand') {+ return BedrockWrapper._handleConverseStreamCommand(tracer, originalMethod, this, args);+ }+ if (commandName === 'InvokeModelCommand' || commandName === 'InvokeModelWithResponseStreamCommand') {+ return BedrockWrapper._handleInvokeModelCommand(tracer, originalMethod, this, args, commandName);+ }++ return originalMethod.apply(this, args);+ };+ };+ }++ static async _handleConverseCommand(+ tracer: Tracer,+ originalMethod: any,+ instance: any,+ args: any[]+ ): Promise<any> {+ const command = args[0];+ const input = command.input || {};+ const modelId = input.modelId || 'unknown';+ const genAIEndpoint = 'bedrock.converse';++ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });+ return context.with(trace.setSpan(context.active(), span), async () => {+ const startTime = Date.now();+ let metricParams: BaseSpanAttributes | undefined;+ try {+ const response = await originalMethod.apply(instance, args);+ const duration = (Date.now() - startTime) / 1000;++ const usage = response.usage || {};+ const promptTokens = usage.inputTokens || 0;+ const completionTokens = usage.outputTokens || 0;+ const totalTokens = usage.totalTokens || promptTokens + completionTokens;+ const cacheReadTokens = usage.cacheReadInputTokens || 0;+ const cacheWriteTokens = usage.cacheWriteInputTokens || 0;++ const finishReason = mapFinishReason(response.stopReason || 'stop');++ const pricingInfo = await OpenlitConfig.updatePricingJson(OpenlitConfig.pricing_json);+ const cost = OpenLitHelper.getChatModelCost(modelId, pricingInfo, promptTokens, completionTokens);++ BedrockWrapper.setBaseSpanAttributes(span, {+ genAIEndpoint,+ model: modelId,+ cost,+ aiSystem: BedrockWrapper.aiSystem,+ });++ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, false);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, modelId);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, promptTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS, completionTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_TOKEN_USAGE, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [finishReason]);+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_TYPE, SemanticConvention.GEN_AI_OUTPUT_TYPE_TEXT);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_OPERATION_DURATION, duration);+ span.setAttribute(SemanticConvention.SERVER_ADDRESS, BEDROCK_SERVER_ADDRESS);+ span.setAttribute(SemanticConvention.SERVER_PORT, BEDROCK_SERVER_PORT);++ if (cacheReadTokens > 0)+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_PROMPT_TOKENS_DETAILS_CACHE_READ, cacheReadTokens);+ if (cacheWriteTokens > 0)+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_PROMPT_TOKENS_DETAILS_CACHE_WRITE, cacheWriteTokens);++ const requestId = response.$metadata?.requestId;+ if (requestId)+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_ID, requestId);++ applyInferenceConfigAttributes(span, input.inferenceConfig || {});++ if (OpenlitConfig.traceContent) {+ const messages = (input.messages || []).map((m: any) => ({+ role: m.role,+ content: m.content?.map((c: any) => c.text || '').join('') || '',+ }));+ const systemText = input.system?.[0]?.text;+ span.setAttribute(+ SemanticConvention.GEN_AI_INPUT_MESSAGES,+ OpenLitHelper.buildInputMessages(messages, systemText)+ );+ if (systemText) {+ span.setAttribute(+ SemanticConvention.GEN_AI_SYSTEM_INSTRUCTIONS,+ JSON.stringify([{ type: 'text', content: systemText }])+ );+ }+ const outputText =+ response.output?.message?.content?.map((c: any) => c.text || '').join('') || '';+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(outputText, finishReason)+ );+ }++ metricParams = { genAIEndpoint, model: modelId, cost, aiSystem: BedrockWrapper.aiSystem };+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ if (metricParams) BaseWrapper.recordMetrics(span, metricParams);+ }+ });+ }++ static async _handleConverseStreamCommand(+ tracer: Tracer,+ originalMethod: any,+ instance: any,+ args: any[]+ ): Promise<any> {+ const command = args[0];+ const input = command.input || {};+ const modelId = input.modelId || 'unknown';+ const genAIEndpoint = 'bedrock.converse_stream';+ const startTime = Date.now();++ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });++ // Call the original method to get the response object (with .stream async iterable)+ const response = await context.with(trace.setSpan(context.active(), span), () =>+ originalMethod.apply(instance, args)+ );++ // Accumulated state from stream events+ let llmResponse = '';+ let finishReason = 'stop';+ let inputTokens = 0;+ let outputTokens = 0;+ let cacheReadTokens = 0;+ let cacheWriteTokens = 0;+ let firstChunkTime: number | null = null;++ const originalStream: AsyncIterable<any> = response.stream;++ async function* wrappedStream() {+ try {+ for await (const event of originalStream) {+ if (firstChunkTime === null) firstChunkTime = Date.now();++ if (event.contentBlockDelta?.delta?.text)+ llmResponse += event.contentBlockDelta.delta.text;+ if (event.messageStop?.stopReason)+ finishReason = mapFinishReason(event.messageStop.stopReason);+ if (event.metadata?.usage) {+ inputTokens = event.metadata.usage.inputTokens || 0;+ outputTokens = event.metadata.usage.outputTokens || 0;+ cacheReadTokens = event.metadata.usage.cacheReadInputTokens || 0;+ cacheWriteTokens = event.metadata.usage.cacheWriteInputTokens || 0;+ }+ yield event;+ }+ } finally {+ // Record telemetry once the stream is fully consumed+ try {+ const duration = (Date.now() - startTime) / 1000;+ const ttft = firstChunkTime !== null ? (firstChunkTime - startTime) / 1000 : 0;+ const totalTokens = inputTokens + outputTokens;++ const pricingInfo = await OpenlitConfig.updatePricingJson(OpenlitConfig.pricing_json);+ const cost = OpenLitHelper.getChatModelCost(modelId, pricingInfo, inputTokens, outputTokens);++ BedrockWrapper.setBaseSpanAttributes(span, {+ genAIEndpoint,+ model: modelId,+ cost,+ aiSystem: BedrockWrapper.aiSystem,+ });++ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, true);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, modelId);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, inputTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS, outputTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_TOKEN_USAGE, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [finishReason]);+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_TYPE, SemanticConvention.GEN_AI_OUTPUT_TYPE_TEXT);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_OPERATION_DURATION, duration);+ span.setAttribute(SemanticConvention.GEN_AI_SERVER_TTFT, ttft);+ span.setAttribute(SemanticConvention.SERVER_ADDRESS, BEDROCK_SERVER_ADDRESS);+ span.setAttribute(SemanticConvention.SERVER_PORT, BEDROCK_SERVER_PORT);++ if (cacheReadTokens > 0)+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_PROMPT_TOKENS_DETAILS_CACHE_READ, cacheReadTokens);+ if (cacheWriteTokens > 0)+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_PROMPT_TOKENS_DETAILS_CACHE_WRITE, cacheWriteTokens);++ const requestId = response.$metadata?.requestId;+ if (requestId)+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_ID, requestId);++ applyInferenceConfigAttributes(span, input.inferenceConfig || {});++ if (OpenlitConfig.traceContent) {+ const messages = (input.messages || []).map((m: any) => ({+ role: m.role,+ content: m.content?.map((c: any) => c.text || '').join('') || '',+ }));+ const systemText = input.system?.[0]?.text;+ span.setAttribute(+ SemanticConvention.GEN_AI_INPUT_MESSAGES,+ OpenLitHelper.buildInputMessages(messages, systemText)+ );+ if (systemText) {+ span.setAttribute(+ SemanticConvention.GEN_AI_SYSTEM_INSTRUCTIONS,+ JSON.stringify([{ type: 'text', content: systemText }])+ );+ }+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(llmResponse, finishReason)+ );+ }++ const metricParams: BaseSpanAttributes = { genAIEndpoint, model: modelId, cost, aiSystem: BedrockWrapper.aiSystem };+ BaseWrapper.recordMetrics(span, metricParams);+ } catch { /* ignore telemetry errors in finally */ } finally {+ span.end();+ }+ }+ }++ return { ...response, stream: wrappedStream() };+ }++ static async _handleInvokeModelCommand(+ tracer: Tracer,+ originalMethod: any,+ instance: any,+ args: any[],+ commandName: string+ ): Promise<any> {+ const command = args[0];+ const input = command.input || {};+ const modelId = input.modelId || 'unknown';+ const isStream = commandName === 'InvokeModelWithResponseStreamCommand';+ const genAIEndpoint = isStream ? 'bedrock.invoke_model_stream' : 'bedrock.invoke_model';++ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });+ return context.with(trace.setSpan(context.active(), span), async () => {+ const startTime = Date.now();+ let metricParams: BaseSpanAttributes | undefined;+ try {+ const response = await originalMethod.apply(instance, args);+ const duration = (Date.now() - startTime) / 1000;++ // Parse response body+ let parsedBody: any = {};+ let promptTokens = 0;+ let completionTokens = 0;+ let outputText = '';+ let rawFinishReason = 'stop';++ try {+ const bodyBytes = response.body;+ if (bodyBytes) {+ const bodyStr = typeof bodyBytes === 'string'+ ? bodyBytes+ : Buffer.from(bodyBytes).toString('utf-8');+ parsedBody = JSON.parse(bodyStr);+ }+ } catch { /* ignore parse errors */ }++ // Handle different provider response formats+ if (modelId.startsWith('anthropic')) {+ promptTokens = parsedBody.usage?.input_tokens || 0;+ completionTokens = parsedBody.usage?.output_tokens || 0;+ outputText = parsedBody.content?.[0]?.text || '';+ rawFinishReason = parsedBody.stop_reason || 'stop';+ } else if (modelId.startsWith('amazon')) {+ promptTokens = parsedBody.inputTextTokenCount || 0;+ completionTokens = parsedBody.results?.[0]?.tokenCount || 0;+ outputText = parsedBody.results?.[0]?.outputText || '';+ rawFinishReason = parsedBody.results?.[0]?.completionReason || 'stop';+ } else if (modelId.startsWith('meta')) {+ promptTokens = parsedBody.prompt_token_count || 0;+ completionTokens = parsedBody.generation_token_count || 0;+ outputText = parsedBody.generation || '';+ rawFinishReason = parsedBody.stop_reason || 'stop';+ } else if (modelId.startsWith('mistral') || modelId.startsWith('mixtral')) {+ promptTokens = parsedBody.usage?.prompt_tokens || 0;+ completionTokens = parsedBody.usage?.completion_tokens || 0;+ outputText = parsedBody.outputs?.[0]?.text || '';+ rawFinishReason = parsedBody.outputs?.[0]?.stop_reason || 'stop';+ } else if (modelId.startsWith('ai21')) {+ promptTokens = parsedBody.prompt?.tokens?.length || 0;+ completionTokens = parsedBody.completions?.[0]?.data?.tokens?.length || 0;+ outputText = parsedBody.completions?.[0]?.data?.text || '';+ rawFinishReason = parsedBody.completions?.[0]?.finishReason?.reason || 'stop';+ } else {+ outputText = parsedBody.output || parsedBody.generation || parsedBody.text || '';+ }++ const finishReason = mapFinishReason(rawFinishReason);+ const totalTokens = promptTokens + completionTokens;+ const pricingInfo = await OpenlitConfig.updatePricingJson(OpenlitConfig.pricing_json);+ const cost = OpenLitHelper.getChatModelCost(modelId, pricingInfo, promptTokens, completionTokens);++ BedrockWrapper.setBaseSpanAttributes(span, {+ genAIEndpoint,+ model: modelId,+ cost,+ aiSystem: BedrockWrapper.aiSystem,+ });++ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, isStream);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, modelId);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, promptTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS, completionTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_TOKEN_USAGE, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [finishReason]);+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_TYPE, SemanticConvention.GEN_AI_OUTPUT_TYPE_TEXT);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_OPERATION_DURATION, duration);+ span.setAttribute(SemanticConvention.SERVER_ADDRESS, BEDROCK_SERVER_ADDRESS);+ span.setAttribute(SemanticConvention.SERVER_PORT, BEDROCK_SERVER_PORT);++ const requestId = response.$metadata?.requestId;+ if (requestId)+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_ID, requestId);++ if (OpenlitConfig.traceContent) {+ try {+ const reqBody = input.body+ ? JSON.parse(typeof input.body === 'string' ? input.body : Buffer.from(input.body).toString())+ : {};+ const prompt = reqBody.prompt || reqBody.inputText || '';+ if (prompt) {+ span.setAttribute(+ SemanticConvention.GEN_AI_INPUT_MESSAGES,+ OpenLitHelper.buildInputMessages([{ role: 'user', content: prompt }])+ );+ }+ } catch { /* ignore */ }++ if (outputText) {+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(outputText, finishReason)+ );+ }+ }++ metricParams = { genAIEndpoint, model: modelId, cost, aiSystem: BedrockWrapper.aiSystem };+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ if (metricParams) BaseWrapper.recordMetrics(span, metricParams);+ }+ });+ }+}++export default BedrockWrapper;diff --git a/sdk/typescript/src/instrumentation/index.ts b/sdk/typescript/src/instrumentation/index.tsindex e0bcb05d..f5cffacc 100644--- a/sdk/typescript/src/instrumentation/index.ts+++ b/sdk/typescript/src/instrumentation/index.ts@@ -10,6 +10,11 @@ import MistralInstrumentation from './mistral';import GoogleAIInstrumentation from './google-ai';import TogetherInstrumentation from './together';import OllamaInstrumentation from './ollama';+import VercelAIInstrumentation from './vercel-ai';+import LangChainInstrumentation from './langchain';+import PineconeInstrumentation from './pinecone';+import BedrockInstrumentation from './bedrock';+import LlamaIndexInstrumentation from './llamaindex';export default class Instrumentations {static availableInstrumentations: OpenlitInstrumentations = {@@ -21,6 +26,11 @@ export default class Instrumentations {'google-ai': new GoogleAIInstrumentation(),together: new TogetherInstrumentation(),ollama: new OllamaInstrumentation(),+ 'vercel-ai': new VercelAIInstrumentation(),+ langchain: new LangChainInstrumentation(),+ pinecone: new PineconeInstrumentation(),+ bedrock: new BedrockInstrumentation(),+ llamaindex: new LlamaIndexInstrumentation(),};static setup(diff --git a/sdk/typescript/src/instrumentation/langchain/index.ts b/sdk/typescript/src/instrumentation/langchain/index.tsnew file mode 100644index 00000000..e5777a5d--- /dev/null+++ b/sdk/typescript/src/instrumentation/langchain/index.ts@@ -0,0 +1,122 @@+import {+ InstrumentationBase,+ InstrumentationModuleDefinition,+ isWrapped,+} from '@opentelemetry/instrumentation';+import { InstrumentationConfig } from '@opentelemetry/instrumentation';+import { INSTRUMENTATION_PREFIX } from '../../constant';+import LangChainWrapper from './wrapper';++export interface LangChainInstrumentationConfig extends InstrumentationConfig {}++export default class OpenlitLangChainInstrumentation extends InstrumentationBase {+ private _callbackManager: any = null;+ private _ritmHook: any = null;++ constructor(config: LangChainInstrumentationConfig = {}) {+ super(`${INSTRUMENTATION_PREFIX}/instrumentation-langchain`, '1.0.0', config);+ }++ protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[] {+ // We bypass OTel's RequireInTheMiddleSingleton here because it uses a null-whitelist+ // RITM instance, which causes RITM to report `name` as the `fullModuleName` (including+ // the .cjs extension), e.g. '@langchain/core/language_models/chat_models.cjs'.+ // The trie search then fails to match our registered bare name (without .cjs).+ // Instead, we set up a direct require-in-the-middle Hook in enable() with a proper+ // whitelist, which causes RITM to preserve the original specifier as `name`.+ return [];+ }++ /** Override enable() to install a direct RITM Hook rather than going through the singleton. */+ public enable(): void {+ super.enable(); // sets this._enabled = true, initialises tracer+ if (this._ritmHook) return;+ try {+ // Require RITM directly — it is a transitive dep of @opentelemetry/instrumentation.+ // Using a whitelist ['@langchain/core/language_models/chat_models'] causes RITM to+ // preserve the original module specifier as `name` (avoiding the .cjs issue).+ // eslint-disable-next-line @typescript-eslint/no-var-requires+ const { Hook } = require('require-in-the-middle');+ this._ritmHook = new Hook(+ ['@langchain/core/language_models/chat_models'],+ { internals: true },+ (exports: any) => {+ this._patchFromCache();+ return exports;+ }+ );+ } catch { /* require-in-the-middle not available — no-op */ }+ }++ /** Override disable() to remove our direct RITM Hook. */+ public disable(): void {+ super.disable();+ this._ritmHook?.unhook?.();+ this._ritmHook = null;+ this._unpatch();+ }++ /** Called from tests / manual usage — pass the @langchain/core/callbacks/manager exports. */+ public manualPatch(callbacksManagerModule: any): void {+ const CallbackManager = callbacksManagerModule?.CallbackManager;+ if (CallbackManager) {+ this._callbackManager = CallbackManager;+ this._applyPatch(CallbackManager);+ }+ }++ /**+ * Scan require.cache for @langchain/core's dist/callbacks/manager.cjs.+ * It is always loaded as a relative dep before the chat_models hook fires.+ */+ private _patchFromCache(): void {+ try {+ const cache = (require as NodeJS.Require & { cache: Record<string, any> }).cache;+ for (const filepath of Object.keys(cache)) {+ if (+ filepath.includes('@langchain') &&+ filepath.includes('callbacks') &&+ filepath.includes('manager') &&+ !filepath.endsWith('.map')+ ) {+ const mod = cache[filepath];+ const CallbackManager = mod?.exports?.CallbackManager;+ if (CallbackManager && typeof CallbackManager._configureSync === 'function') {+ this._callbackManager = CallbackManager;+ this._applyPatch(CallbackManager);+ return;+ }+ }+ }+ } catch (e) {+ console.error('LangChain: error scanning require.cache for CallbackManager:', e);+ }+ }++ private _applyPatch(CallbackManager: any): void {+ try {+ // Patch _configureSync — the single low-level entry point called by both+ // CallbackManager.configure and getCallbackManagerForConfig (Runnables/chains).+ if (isWrapped(CallbackManager._configureSync)) {+ this._unwrap(CallbackManager, '_configureSync');+ }+ this._wrap(+ CallbackManager,+ '_configureSync',+ LangChainWrapper._patchConfigure(this.tracer)+ );+ } catch (e) {+ console.error('Error in LangChain _patch method:', e);+ }+ }++ private _unpatch(): void {+ if (!this._callbackManager) return;+ try {+ if (isWrapped(this._callbackManager._configureSync)) {+ this._unwrap(this._callbackManager, '_configureSync');+ }+ } catch { /* ignore */ }+ this._callbackManager = null;+ }+}diff --git a/sdk/typescript/src/instrumentation/langchain/wrapper.ts b/sdk/typescript/src/instrumentation/langchain/wrapper.tsnew file mode 100644index 00000000..ae4bcee9--- /dev/null+++ b/sdk/typescript/src/instrumentation/langchain/wrapper.ts@@ -0,0 +1,373 @@+import { SpanKind, Tracer, context, trace } from '@opentelemetry/api';+import OpenlitConfig from '../../config';+import OpenLitHelper from '../../helpers';+import SemanticConvention from '../../semantic-convention';+import BaseWrapper, { BaseSpanAttributes } from '../base-wrapper';++// ----------------------------------------------------------------------------+// Span tracking across async callback events+// ----------------------------------------------------------------------------+interface SpanHolder {+ span: any;+ startTime: number;+ modelName: string;+ parentRunId?: string;+ streamingContent: string[];+ tokenTimestamps: number[];+ firstTokenTime?: number;+ promptTokens: number;+ completionTokens: number;+}++// Singleton handler — injected once into every CallbackManager created+let handlerInstance: OpenLITCallbackHandler | null = null;++class OpenLITCallbackHandler {+ name = 'openlit_callback_handler';+ lc_serializable = false;+ // LangChain checks this to decide if it should be copied to child runs+ awaitHandlers = false;++ private tracer: Tracer;+ private spans = new Map<string, SpanHolder>();++ constructor(tracer: Tracer) {+ this.tracer = tracer;+ }++ // ---- Model name helpers --------------------------------------------------++ private _extractModelName(llm: any): string {+ if (!llm) return 'unknown';+ const id: string[] = llm.id || [];+ const className = id[id.length - 1] || '';++ // Try various well-known invocation_params / kwargs paths+ const kw = llm.kwargs || {};+ const ip = kw.invocation_params || {};++ return (+ ip.model_name || ip.model || ip.model_id ||+ kw.model_name || kw.model || kw.model_id ||+ className || 'unknown'+ );+ }++ private _detectProvider(llm: any): string {+ if (!llm) return SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN;+ const classPath = (llm.id || []).join('.').toLowerCase();+ const providerMap: Record<string, string> = {+ openai: SemanticConvention.GEN_AI_SYSTEM_OPENAI,+ anthropic: SemanticConvention.GEN_AI_SYSTEM_ANTHROPIC,+ bedrock: SemanticConvention.GEN_AI_SYSTEM_AWS_BEDROCK,+ google: SemanticConvention.GEN_AI_SYSTEM_VERTEXAI,+ cohere: SemanticConvention.GEN_AI_SYSTEM_COHERE,+ mistral: SemanticConvention.GEN_AI_SYSTEM_MISTRAL,+ };+ for (const [key, val] of Object.entries(providerMap)) {+ if (classPath.includes(key)) return val;+ }+ return SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN;+ }++ // ---- Parent context -------------------------------------------------------++ private _getParentContext(parentRunId?: string) {+ if (!parentRunId) return undefined;+ const holder = this.spans.get(parentRunId);+ if (!holder) return undefined;+ return trace.setSpan(context.active(), holder.span);+ }++ // ---- LLM callbacks -------------------------------------------------------++ handleChatModelStart(+ llm: any,+ messages: any[][],+ runId: string,+ parentRunId?: string,+ _extraParams?: any,+ _tags?: string[],+ metadata?: any,+ name?: string+ ) {+ try {+ const modelName = this._extractModelName(llm);+ const provider = this._detectProvider(llm);+ const spanName = `chat ${modelName}`;++ const parentCtx = this._getParentContext(parentRunId);+ const span = this.tracer.startSpan(+ spanName,+ { kind: SpanKind.CLIENT },+ parentCtx+ );++ span.setAttribute(SemanticConvention.GEN_AI_PROVIDER_NAME, provider);+ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT);+ span.setAttribute(SemanticConvention.GEN_AI_ENVIRONMENT, OpenlitConfig.environment || '');+ span.setAttribute(SemanticConvention.GEN_AI_APPLICATION_NAME, OpenlitConfig.applicationName || '');+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_MODEL, modelName);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, false);++ // Model parameters from invocation_params+ const ip = llm?.kwargs?.invocation_params || {};+ if (ip.temperature != null) span.setAttribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE, ip.temperature);+ if (ip.max_tokens != null) span.setAttribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS, ip.max_tokens);+ if (ip.top_p != null) span.setAttribute(SemanticConvention.GEN_AI_REQUEST_TOP_P, ip.top_p);++ if (OpenlitConfig.traceContent && messages?.length > 0) {+ const flatMessages = messages.flat().map((m: any) => ({+ role: m._getType?.() || m.type || m.role || 'user',+ content: typeof m.content === 'string' ? m.content : JSON.stringify(m.content),+ }));+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, OpenLitHelper.buildInputMessages(flatMessages));+ }++ this.spans.set(runId, {+ span,+ startTime: Date.now(),+ modelName,+ parentRunId,+ streamingContent: [],+ tokenTimestamps: [],+ promptTokens: 0,+ completionTokens: 0,+ });+ } catch { /* non-blocking */ }+ }++ handleLLMNewToken(token: string, _idx: any, runId: string) {+ try {+ const holder = this.spans.get(runId);+ if (!holder) return;+ const now = Date.now();+ if (!holder.firstTokenTime) holder.firstTokenTime = now;+ holder.tokenTimestamps.push(now);+ if (token) holder.streamingContent.push(token);+ // Mark as streaming+ holder.span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, true);+ } catch { /* non-blocking */ }+ }++ handleLLMEnd(output: any, runId: string) {+ this._finalizeLLMSpan(runId, output, undefined);+ }++ handleLLMError(error: any, runId: string) {+ try {+ const holder = this.spans.get(runId);+ if (!holder) return;+ OpenLitHelper.handleException(holder.span, error);+ holder.span.end();+ this.spans.delete(runId);+ } catch { /* non-blocking */ }+ }++ private async _finalizeLLMSpan(runId: string, output: any, _error: any) {+ try {+ const holder = this.spans.get(runId);+ if (!holder) return;+ const { span, startTime, modelName, streamingContent, tokenTimestamps, firstTokenTime } = holder;+ const endTime = Date.now();+ const isStreaming = streamingContent.length > 0;++ // Extract tokens from output+ let promptTokens = 0;+ let completionTokens = 0;+ let completionContent = '';+ let finishReason = 'stop';+ let responseModel = modelName;++ if (output?.llm_output) {+ const lu = output.llm_output;+ const tu = lu.token_usage || lu.usage || {};+ promptTokens = tu.prompt_tokens || tu.input_tokens || 0;+ completionTokens = tu.completion_tokens || tu.output_tokens || 0;+ responseModel = lu.model_name || lu.model || modelName;+ }++ const generations = output?.generations || [];+ for (const genList of generations) {+ for (const gen of (Array.isArray(genList) ? genList : [genList])) {+ const msg = gen?.message || gen;+ // From usage_metadata (standard LangChain)+ const um = msg?.usage_metadata;+ if (um) {+ if (!promptTokens) promptTokens = um.input_tokens || um.prompt_tokens || 0;+ if (!completionTokens) completionTokens = um.output_tokens || um.completion_tokens || 0;+ }+ // Content+ const content = gen?.text || msg?.content || '';+ if (content && typeof content === 'string' && content.length > completionContent.length) {+ completionContent = content;+ }+ // Finish reason+ const fr = gen?.generationInfo?.finish_reason || msg?.response_metadata?.finish_reason;+ if (fr) finishReason = fr;+ }+ }++ if (isStreaming) {+ completionContent = streamingContent.join('');+ }++ const totalTokens = promptTokens + completionTokens;+ const duration = (endTime - startTime) / 1000;++ const pricingInfo = await OpenlitConfig.updatePricingJson(OpenlitConfig.pricing_json);+ const cost = OpenLitHelper.getChatModelCost(responseModel, pricingInfo, promptTokens, completionTokens);++ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, responseModel);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, promptTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS, completionTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_TOKEN_USAGE, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_COST, cost);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [finishReason]);+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_TYPE, SemanticConvention.GEN_AI_OUTPUT_TYPE_TEXT);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_OPERATION_DURATION, duration);++ if (isStreaming && firstTokenTime) {+ const ttft = (firstTokenTime - startTime) / 1000;+ span.setAttribute(SemanticConvention.GEN_AI_SERVER_TTFT, ttft);+ if (tokenTimestamps.length > 1) {+ const diffs = tokenTimestamps.slice(1).map((t, i) => t - tokenTimestamps[i]);+ const tbt = diffs.reduce((a, b) => a + b, 0) / diffs.length / 1000;+ span.setAttribute(SemanticConvention.GEN_AI_SERVER_TBT, tbt);+ }+ }++ if (OpenlitConfig.traceContent && completionContent) {+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(completionContent, finishReason)+ );+ }++ // base attributes (system, endpoint, etc.)+ BaseWrapper.setBaseSpanAttributes(span, {+ genAIEndpoint: `langchain.chat_model`,+ model: responseModel,+ cost,+ aiSystem: SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,+ });++ const metricParams: BaseSpanAttributes = {+ genAIEndpoint: 'langchain.chat_model',+ model: responseModel,+ cost,+ aiSystem: SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,+ };+ span.setStatus({ code: 1 });+ span.end();+ BaseWrapper.recordMetrics(span, metricParams);+ this.spans.delete(runId);+ } catch { /* non-blocking */ }+ }++ // ---- Chain callbacks -------------------------------------------------------++ handleChainStart(chain: any, inputs: any, runId: string, parentRunId?: string) {+ try {+ const id: string[] = chain?.id || [];+ const name = id[id.length - 1] || 'chain';+ const spanName = `workflow ${name}`;++ const parentCtx = this._getParentContext(parentRunId);+ const span = this.tracer.startSpan(+ spanName,+ { kind: SpanKind.INTERNAL },+ parentCtx+ );++ span.setAttribute(SemanticConvention.GEN_AI_PROVIDER_NAME, SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN);+ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK);+ span.setAttribute(SemanticConvention.GEN_AI_ENVIRONMENT, OpenlitConfig.environment || '');+ span.setAttribute(SemanticConvention.GEN_AI_APPLICATION_NAME, OpenlitConfig.applicationName || '');++ if (OpenlitConfig.traceContent && inputs) {+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, JSON.stringify(inputs).slice(0, 2000));+ }++ this.spans.set(runId, {+ span,+ startTime: Date.now(),+ modelName: name,+ parentRunId,+ streamingContent: [],+ tokenTimestamps: [],+ promptTokens: 0,+ completionTokens: 0,+ });+ } catch { /* non-blocking */ }+ }++ handleChainEnd(outputs: any, runId: string) {+ try {+ const holder = this.spans.get(runId);+ if (!holder) return;+ const duration = (Date.now() - holder.startTime) / 1000;+ holder.span.setAttribute(SemanticConvention.GEN_AI_CLIENT_OPERATION_DURATION, duration);+ if (OpenlitConfig.traceContent && outputs) {+ holder.span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, JSON.stringify(outputs).slice(0, 2000));+ }+ holder.span.setStatus({ code: 1 });+ holder.span.end();+ this.spans.delete(runId);+ } catch { /* non-blocking */ }+ }++ handleChainError(error: any, runId: string) {+ try {+ const holder = this.spans.get(runId);+ if (!holder) return;+ OpenLitHelper.handleException(holder.span, error);+ holder.span.end();+ this.spans.delete(runId);+ } catch { /* non-blocking */ }+ }+}++// ----------------------------------------------------------------------------+// Wrapper factory+// ----------------------------------------------------------------------------++class LangChainWrapper extends BaseWrapper {+ static _patchConfigure(tracer: Tracer): any {+ // Ensure singleton handler+ if (!handlerInstance) {+ handlerInstance = new OpenLITCallbackHandler(tracer);+ }+ const handler = handlerInstance;++ return (originalConfigure: (...args: any[]) => any) => {+ return function (+ this: any,+ inheritableHandlers?: any,+ ...rest: any[]+ ) {+ // inheritableHandlers can be:+ // - undefined : no handlers passed+ // - Array : list of handler objects (chat model calls)+ // - CallbackManager instance: already-built manager (Runnable/chain calls)+ if (Array.isArray(inheritableHandlers) || !inheritableHandlers) {+ const handlers: any[] = inheritableHandlers ? [...inheritableHandlers] : [];+ if (!handlers.some((h: any) => h?.name === 'openlit_callback_handler')) {+ handlers.unshift(handler);+ }+ return originalConfigure.call(this, handlers, ...rest);+ } else {+ // Existing CallbackManager — add our handler directly+ const cbManager = inheritableHandlers;+ if (cbManager?.handlers && !cbManager.handlers.some((h: any) => h?.name === 'openlit_callback_handler')) {+ cbManager.addHandler(handler, true);+ }+ return originalConfigure.call(this, cbManager, ...rest);+ }+ };+ };+ }+}++export default LangChainWrapper;diff --git a/sdk/typescript/src/instrumentation/llamaindex/index.ts b/sdk/typescript/src/instrumentation/llamaindex/index.tsnew file mode 100644index 00000000..1cf7e036--- /dev/null+++ b/sdk/typescript/src/instrumentation/llamaindex/index.ts@@ -0,0 +1,129 @@+import {+ InstrumentationBase,+ InstrumentationModuleDefinition,+ InstrumentationNodeModuleDefinition,+ isWrapped,+} from '@opentelemetry/instrumentation';+import { InstrumentationConfig } from '@opentelemetry/instrumentation';+import { INSTRUMENTATION_PREFIX } from '../../constant';+import LlamaIndexWrapper from './wrapper';++export interface LlamaIndexInstrumentationConfig extends InstrumentationConfig {}++export default class OpenlitLlamaIndexInstrumentation extends InstrumentationBase {+ constructor(config: LlamaIndexInstrumentationConfig = {}) {+ super(`${INSTRUMENTATION_PREFIX}/instrumentation-llamaindex`, '1.0.0', config);+ }++ protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[] {+ const module = new InstrumentationNodeModuleDefinition(+ 'llamaindex',+ ['>=0.3.0'],+ (moduleExports) => {+ this._patch(moduleExports);+ return moduleExports;+ },+ (moduleExports) => {+ if (moduleExports !== undefined) {+ this._unpatch(moduleExports);+ }+ }+ );+ return [module];+ }++ public manualPatch(llamaindex: any): void {+ this._patch(llamaindex);+ }++ protected _patch(moduleExports: any) {+ try {+ // Patch query engines+ const queryEngineClasses = [+ 'RetrieverQueryEngine',+ 'BaseQueryEngine',+ 'QueryEngine',+ ];++ for (const className of queryEngineClasses) {+ const QueryEngineClass = moduleExports[className];+ if (QueryEngineClass?.prototype?.query) {+ if (isWrapped(QueryEngineClass.prototype.query)) {+ this._unwrap(QueryEngineClass.prototype, 'query');+ }+ this._wrap(+ QueryEngineClass.prototype,+ 'query',+ LlamaIndexWrapper._patchQueryEngineQuery(this.tracer)+ );+ break; // Only patch the first one found to avoid duplicates+ }+ }++ // Patch chat engines+ const chatEngineClasses = [+ 'ContextChatEngine',+ 'SimpleChatEngine',+ 'BaseChatEngine',+ ];++ for (const className of chatEngineClasses) {+ const ChatEngineClass = moduleExports[className];+ if (ChatEngineClass?.prototype?.chat) {+ if (isWrapped(ChatEngineClass.prototype.chat)) {+ this._unwrap(ChatEngineClass.prototype, 'chat');+ }+ this._wrap(+ ChatEngineClass.prototype,+ 'chat',+ LlamaIndexWrapper._patchChatEngineChat(this.tracer)+ );+ break; // Only patch the first one found+ }+ }++ // Patch base LLM chat and complete methods for lower-level tracing+ const llmClasses = ['OpenAI', 'Anthropic', 'Ollama', 'LLM', 'BaseLLM'];+ for (const className of llmClasses) {+ const LLMClass = moduleExports[className];+ if (!LLMClass?.prototype) continue;++ if (LLMClass.prototype.chat && !isWrapped(LLMClass.prototype.chat)) {+ this._wrap(+ LLMClass.prototype,+ 'chat',+ LlamaIndexWrapper._patchLLMChat(this.tracer)+ );+ }+ if (LLMClass.prototype.complete && !isWrapped(LLMClass.prototype.complete)) {+ this._wrap(+ LLMClass.prototype,+ 'complete',+ LlamaIndexWrapper._patchLLMComplete(this.tracer)+ );+ }+ }+ } catch (e) {+ console.error('Error in LlamaIndex _patch method:', e);+ }+ }++ protected _unpatch(moduleExports: any) {+ try {+ const allClasses = [+ 'RetrieverQueryEngine', 'BaseQueryEngine', 'QueryEngine',+ 'ContextChatEngine', 'SimpleChatEngine', 'BaseChatEngine',+ 'OpenAI', 'Anthropic', 'Ollama', 'LLM', 'BaseLLM',+ ];++ for (const className of allClasses) {+ const Cls = moduleExports[className];+ if (Cls?.prototype) {+ if (isWrapped(Cls.prototype.query)) this._unwrap(Cls.prototype, 'query');+ if (isWrapped(Cls.prototype.chat)) this._unwrap(Cls.prototype, 'chat');+ if (isWrapped(Cls.prototype.complete)) this._unwrap(Cls.prototype, 'complete');+ }+ }+ } catch { /* ignore */ }+ }+}diff --git a/sdk/typescript/src/instrumentation/llamaindex/wrapper.ts b/sdk/typescript/src/instrumentation/llamaindex/wrapper.tsnew file mode 100644index 00000000..ecef0e72--- /dev/null+++ b/sdk/typescript/src/instrumentation/llamaindex/wrapper.ts@@ -0,0 +1,302 @@+import { SpanKind, Tracer, context, trace } from '@opentelemetry/api';+import OpenlitConfig from '../../config';+import OpenLitHelper from '../../helpers';+import SemanticConvention from '../../semantic-convention';+import BaseWrapper, { BaseSpanAttributes } from '../base-wrapper';++class LlamaIndexWrapper extends BaseWrapper {+ static aiSystem = 'llamaindex';++ // ---- Helpers ---------------------------------------------------------------++ private static _extractServerInfo(instance: any): { address: string; port: number } {+ const baseUrl =+ instance?.session?.openai?.baseURL ||+ instance?._client?.baseURL ||+ instance?.clientOptions?.baseURL ||+ instance?.llm?.session?.openai?.baseURL ||+ instance?._llm?.session?.openai?.baseURL ||+ '';+ if (baseUrl) {+ try {+ const url = new URL(baseUrl);+ const port = url.port ? parseInt(url.port) : (url.protocol === 'https:' ? 443 : 80);+ return { address: url.hostname, port };+ } catch { /* ignore */ }+ }+ return { address: 'api.openai.com', port: 443 };+ }++ // ---- LLM patches -----------------------------------------------------------++ static _patchLLMChat(tracer: Tracer): any {+ const genAIEndpoint = 'llamaindex.llm.chat';+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });+ return context.with(trace.setSpan(context.active(), span), async () => {+ let metricParams: BaseSpanAttributes | undefined;+ const startTime = Date.now();+ try {+ const response = await originalMethod.apply(this, args);+ const duration = (Date.now() - startTime) / 1000;++ const params = args[0] || {};+ const messages = params.messages || [];+ const modelId = this.model || this.modelName || this.metadata?.model || 'unknown';+ const aiSystem = LlamaIndexWrapper.aiSystem;++ const rawUsage = response?.raw?.usage || response?.usage || {};+ const promptTokens = rawUsage.prompt_tokens || rawUsage.input_tokens || 0;+ const completionTokens = rawUsage.completion_tokens || rawUsage.output_tokens || 0;+ const totalTokens = rawUsage.total_tokens || promptTokens + completionTokens;+ const finishReason = response?.raw?.choices?.[0]?.finish_reason || 'stop';++ const pricingInfo = await OpenlitConfig.updatePricingJson(OpenlitConfig.pricing_json);+ const cost = OpenLitHelper.getChatModelCost(modelId, pricingInfo, promptTokens, completionTokens);++ const { address, port } = LlamaIndexWrapper._extractServerInfo(this);++ LlamaIndexWrapper.setBaseSpanAttributes(span, { genAIEndpoint, model: modelId, cost, aiSystem });++ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, false);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, modelId);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, promptTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS, completionTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_TOKEN_USAGE, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [finishReason]);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_OPERATION_DURATION, duration);+ span.setAttribute(SemanticConvention.SERVER_ADDRESS, address);+ span.setAttribute(SemanticConvention.SERVER_PORT, port);++ if (OpenlitConfig.traceContent) {+ const formattedMessages = messages.map((m: any) => ({+ role: m.role || 'user',+ content: typeof m.content === 'string' ? m.content : JSON.stringify(m.content),+ }));+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, OpenLitHelper.buildInputMessages(formattedMessages));++ const outputContent = response?.message?.content || response?.text || '';+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(outputContent, finishReason)+ );+ }++ metricParams = { genAIEndpoint, model: modelId, cost, aiSystem };+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ if (metricParams) BaseWrapper.recordMetrics(span, metricParams);+ }+ });+ };+ };+ }++ static _patchLLMComplete(tracer: Tracer): any {+ const genAIEndpoint = 'llamaindex.llm.complete';+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });+ return context.with(trace.setSpan(context.active(), span), async () => {+ let metricParams: BaseSpanAttributes | undefined;+ const startTime = Date.now();+ try {+ const response = await originalMethod.apply(this, args);+ const duration = (Date.now() - startTime) / 1000;++ const prompt = typeof args[0] === 'string' ? args[0] : args[0]?.prompt || '';+ const modelId = this.model || this.modelName || this.metadata?.model || 'unknown';+ const aiSystem = LlamaIndexWrapper.aiSystem;++ const rawUsage = response?.raw?.usage || response?.usage || {};+ const promptTokens = rawUsage.prompt_tokens || rawUsage.input_tokens || 0;+ const completionTokens = rawUsage.completion_tokens || rawUsage.output_tokens || 0;+ const totalTokens = rawUsage.total_tokens || promptTokens + completionTokens;+ const finishReason = response?.raw?.choices?.[0]?.finish_reason || 'stop';++ const pricingInfo = await OpenlitConfig.updatePricingJson(OpenlitConfig.pricing_json);+ const cost = OpenLitHelper.getChatModelCost(modelId, pricingInfo, promptTokens, completionTokens);++ const { address, port } = LlamaIndexWrapper._extractServerInfo(this);++ LlamaIndexWrapper.setBaseSpanAttributes(span, { genAIEndpoint, model: modelId, cost, aiSystem });++ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, false);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, modelId);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, promptTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS, completionTokens);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_TOKEN_USAGE, totalTokens);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [finishReason]);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_OPERATION_DURATION, duration);+ span.setAttribute(SemanticConvention.SERVER_ADDRESS, address);+ span.setAttribute(SemanticConvention.SERVER_PORT, port);++ if (OpenlitConfig.traceContent) {+ span.setAttribute(+ SemanticConvention.GEN_AI_INPUT_MESSAGES,+ OpenLitHelper.buildInputMessages([{ role: 'user', content: prompt }])+ );+ const outputContent = response?.text || '';+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(outputContent, finishReason)+ );+ }++ metricParams = { genAIEndpoint, model: modelId, cost, aiSystem };+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ if (metricParams) BaseWrapper.recordMetrics(span, metricParams);+ }+ });+ };+ };+ }++ // ---- Query engine patch ----------------------------------------------------++ static _patchQueryEngineQuery(tracer: Tracer): any {+ const genAIEndpoint = 'llamaindex.query_engine.query';+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });+ return context.with(trace.setSpan(context.active(), span), async () => {+ let metricParams: BaseSpanAttributes | undefined;+ const startTime = Date.now();+ try {+ const response = await originalMethod.apply(this, args);+ const duration = (Date.now() - startTime) / 1000;++ const queryStr = typeof args[0] === 'string' ? args[0] : args[0]?.query || '';++ const llm = this.llm || this._llm;+ const modelId = llm?.model || llm?.modelName || llm?.metadata?.model || 'unknown';+ const aiSystem = LlamaIndexWrapper.aiSystem;++ const { address, port } = LlamaIndexWrapper._extractServerInfo(llm || this);++ LlamaIndexWrapper.setBaseSpanAttributes(span, { genAIEndpoint, model: modelId, aiSystem });++ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, false);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_OPERATION_DURATION, duration);+ span.setAttribute(SemanticConvention.SERVER_ADDRESS, address);+ span.setAttribute(SemanticConvention.SERVER_PORT, port);++ const sourceNodes = response.sourceNodes || response.source_nodes || [];+ if (sourceNodes.length > 0) {+ span.setAttribute(SemanticConvention.GEN_AI_RETRIEVAL_SOURCE, JSON.stringify(+ sourceNodes.slice(0, 5).map((n: any) => ({+ id: n.node?.id_ || n.id_ || '',+ score: n.score,+ text: n.node?.text?.slice(0, 200) || '',+ }))+ ));+ }++ if (OpenlitConfig.traceContent) {+ span.setAttribute(+ SemanticConvention.GEN_AI_INPUT_MESSAGES,+ OpenLitHelper.buildInputMessages([{ role: 'user', content: queryStr }])+ );+ const responseText = typeof response.response === 'string'+ ? response.response+ : response.toString?.() || '';+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(responseText, 'stop')+ );+ }++ metricParams = { genAIEndpoint, model: modelId, aiSystem };+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ if (metricParams) BaseWrapper.recordMetrics(span, metricParams);+ }+ });+ };+ };+ }++ // ---- Chat engine patch -----------------------------------------------------++ static _patchChatEngineChat(tracer: Tracer): any {+ const genAIEndpoint = 'llamaindex.chat_engine.chat';+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });+ return context.with(trace.setSpan(context.active(), span), async () => {+ let metricParams: BaseSpanAttributes | undefined;+ const startTime = Date.now();+ try {+ const response = await originalMethod.apply(this, args);+ const duration = (Date.now() - startTime) / 1000;++ const messageInput = args[0];+ const message = typeof messageInput === 'string'+ ? messageInput+ : messageInput?.message || messageInput?.content || '';++ const llm = this.llm || this._llm;+ const modelId = llm?.model || llm?.modelName || llm?.metadata?.model || 'unknown';+ const aiSystem = LlamaIndexWrapper.aiSystem;++ const { address, port } = LlamaIndexWrapper._extractServerInfo(llm || this);++ LlamaIndexWrapper.setBaseSpanAttributes(span, { genAIEndpoint, model: modelId, aiSystem });++ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, false);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_OPERATION_DURATION, duration);+ span.setAttribute(SemanticConvention.SERVER_ADDRESS, address);+ span.setAttribute(SemanticConvention.SERVER_PORT, port);++ if (OpenlitConfig.traceContent) {+ span.setAttribute(+ SemanticConvention.GEN_AI_INPUT_MESSAGES,+ OpenLitHelper.buildInputMessages([{ role: 'user', content: message }])+ );++ const responseContent =+ response?.message?.content ||+ (typeof response?.response === 'string' ? response.response : '') ||+ response?.toString?.() || '';+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(responseContent, 'stop')+ );+ }++ metricParams = { genAIEndpoint, model: modelId, aiSystem };+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ if (metricParams) BaseWrapper.recordMetrics(span, metricParams);+ }+ });+ };+ };+ }+}++export default LlamaIndexWrapper;diff --git a/sdk/typescript/src/instrumentation/openai/index.ts b/sdk/typescript/src/instrumentation/openai/index.tsindex 6d0daffa..05b47d59 100644--- a/sdk/typescript/src/instrumentation/openai/index.ts+++ b/sdk/typescript/src/instrumentation/openai/index.ts@@ -19,7 +19,7 @@ export default class OpenlitOpenAIInstrumentation extends InstrumentationBase {protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[] {const module = new InstrumentationNodeModuleDefinition('openai',- ['>=3.1.0 <5'],+ ['>=3.1.0'],(moduleExports) => {this._patch(moduleExports);return moduleExports;diff --git a/sdk/typescript/src/instrumentation/pinecone/index.ts b/sdk/typescript/src/instrumentation/pinecone/index.tsnew file mode 100644index 00000000..1bd00897--- /dev/null+++ b/sdk/typescript/src/instrumentation/pinecone/index.ts@@ -0,0 +1,86 @@+import {+ InstrumentationBase,+ InstrumentationModuleDefinition,+ InstrumentationNodeModuleDefinition,+ isWrapped,+} from '@opentelemetry/instrumentation';+import { InstrumentationConfig } from '@opentelemetry/instrumentation';+import { INSTRUMENTATION_PREFIX } from '../../constant';+import PineconeWrapper from './wrapper';++export interface PineconeInstrumentationConfig extends InstrumentationConfig {}++export default class OpenlitPineconeInstrumentation extends InstrumentationBase {+ constructor(config: PineconeInstrumentationConfig = {}) {+ super(`${INSTRUMENTATION_PREFIX}/instrumentation-pinecone`, '1.0.0', config);+ }++ protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[] {+ const module = new InstrumentationNodeModuleDefinition(+ '@pinecone-database/pinecone',+ ['>=1.0.0'],+ (moduleExports) => {+ this._patch(moduleExports);+ return moduleExports;+ },+ (moduleExports) => {+ if (moduleExports !== undefined) {+ this._unpatch(moduleExports);+ }+ }+ );+ return [module];+ }++ public manualPatch(pinecone: any): void {+ this._patch(pinecone);+ }++ protected _patch(moduleExports: any) {+ try {+ // Patch Index prototype directly+ const IndexClass = moduleExports.Index;+ if (IndexClass?.prototype) {+ const methods: Array<[string, string]> = [+ ['query', 'query'],+ ['upsert', 'upsert'],+ ['deleteOne', 'one'],+ ['deleteMany', 'many'],+ ['update', 'update'],+ ];++ for (const [method, opSuffix] of methods) {+ if (typeof IndexClass.prototype[method] === 'function') {+ if (isWrapped(IndexClass.prototype[method])) {+ this._unwrap(IndexClass.prototype, method);+ }+ if (method === 'query') {+ this._wrap(IndexClass.prototype, method, PineconeWrapper._patchQuery(this.tracer));+ } else if (method === 'upsert') {+ this._wrap(IndexClass.prototype, method, PineconeWrapper._patchUpsert(this.tracer));+ } else if (method === 'update') {+ this._wrap(IndexClass.prototype, method, PineconeWrapper._patchUpdate(this.tracer));+ } else {+ this._wrap(IndexClass.prototype, method, PineconeWrapper._patchDelete(this.tracer, opSuffix));+ }+ }+ }+ }+ } catch (e) {+ console.error('Error in Pinecone _patch method:', e);+ }+ }++ protected _unpatch(moduleExports: any) {+ try {+ const IndexClass = moduleExports.Index;+ if (IndexClass?.prototype) {+ ['query', 'upsert', 'deleteOne', 'deleteMany', 'update'].forEach((method) => {+ if (typeof IndexClass.prototype[method] === 'function') {+ this._unwrap(IndexClass.prototype, method);+ }+ });+ }+ } catch { /* ignore */ }+ }+}diff --git a/sdk/typescript/src/instrumentation/pinecone/wrapper.ts b/sdk/typescript/src/instrumentation/pinecone/wrapper.tsnew file mode 100644index 00000000..16f882ea--- /dev/null+++ b/sdk/typescript/src/instrumentation/pinecone/wrapper.ts@@ -0,0 +1,221 @@+import { SpanKind, Tracer, context, trace } from '@opentelemetry/api';+import OpenlitConfig from '../../config';+import OpenLitHelper from '../../helpers';+import SemanticConvention from '../../semantic-convention';+import BaseWrapper from '../base-wrapper';++class PineconeWrapper extends BaseWrapper {+ static dbSystem = SemanticConvention.DB_SYSTEM_PINECONE;+ static serverAddress = 'pinecone.io';+ static serverPort = 443;++ // Safely resolve the namespace string from the Index instance.+ // `this.namespace` on a Pinecone Index is a METHOD that creates namespace-scoped+ // sub-indices, not a string property. The actual namespace string may be stored+ // internally in `this.target.namespace` depending on the SDK version.+ static _resolveNamespace(indexInstance: any, paramsNamespace?: string): string {+ if (paramsNamespace && typeof paramsNamespace === 'string') return paramsNamespace;+ const ns = indexInstance?.target?.namespace ?? indexInstance?._namespace ?? '';+ return typeof ns === 'string' && ns ? ns : 'default';+ }++ static _setCommonAttributes(span: any, dbOperation: string, namespace: string) {+ const applicationName = OpenlitConfig.applicationName || '';+ const environment = OpenlitConfig.environment || '';++ span.setAttribute(SemanticConvention.DB_SYSTEM_NAME, PineconeWrapper.dbSystem);+ span.setAttribute(SemanticConvention.DB_OPERATION_NAME, dbOperation);+ span.setAttribute(SemanticConvention.DB_NAMESPACE, namespace);+ span.setAttribute(SemanticConvention.SERVER_ADDRESS, PineconeWrapper.serverAddress);+ span.setAttribute(SemanticConvention.SERVER_PORT, PineconeWrapper.serverPort);+ span.setAttribute(SemanticConvention.GEN_AI_ENVIRONMENT, environment);+ span.setAttribute(SemanticConvention.GEN_AI_APPLICATION_NAME, applicationName);+ }++ static _patchQuery(tracer: Tracer): any {+ const dbOperation = SemanticConvention.DB_OPERATION_QUERY;+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const params = args[0] || {};+ const namespace = PineconeWrapper._resolveNamespace(this, params.namespace);+ const spanName = `${dbOperation} ${namespace}`;+ const span = tracer.startSpan(spanName, { kind: SpanKind.CLIENT });+ const startTime = Date.now();++ return context.with(trace.setSpan(context.active(), span), async () => {+ try {+ const response = await originalMethod.apply(this, args);+ const duration = (Date.now() - startTime) / 1000;++ PineconeWrapper._setCommonAttributes(span, dbOperation, namespace);+ span.setAttribute(SemanticConvention.DB_VECTOR_QUERY_TOP_K, params.topK || 0);+ span.setAttribute(SemanticConvention.DB_CLIENT_OPERATION_DURATION, duration);++ if (params.filter) {+ span.setAttribute(SemanticConvention.DB_FILTER, JSON.stringify(params.filter));+ }++ const matchCount = response?.matches?.length || 0;+ span.setAttribute(SemanticConvention.DB_N_RESULTS, matchCount);++ if (OpenlitConfig.traceContent && params.vector) {+ span.setAttribute(SemanticConvention.DB_QUERY_TEXT, JSON.stringify(params.vector?.slice(0, 10)));+ }++ span.setAttribute(+ SemanticConvention.DB_QUERY_SUMMARY,+ `${dbOperation} ${namespace} top_k=${params.topK || 0} filtered=${params.filter ? 'true' : 'false'}`+ );++ span.setStatus({ code: 1 }); // SpanStatusCode.OK+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ }+ });+ };+ };+ }++ static _patchUpsert(tracer: Tracer): any {+ const dbOperation = SemanticConvention.DB_OPERATION_UPSERT;+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const namespace = PineconeWrapper._resolveNamespace(this);+ const spanName = `${dbOperation} ${namespace}`;+ const span = tracer.startSpan(spanName, { kind: SpanKind.CLIENT });+ const startTime = Date.now();++ return context.with(trace.setSpan(context.active(), span), async () => {+ try {+ const response = await originalMethod.apply(this, args);+ const records = Array.isArray(args[0]) ? args[0] : [];+ const duration = (Date.now() - startTime) / 1000;++ PineconeWrapper._setCommonAttributes(span, dbOperation, namespace);+ span.setAttribute(SemanticConvention.DB_VECTOR_COUNT, records.length);+ span.setAttribute(SemanticConvention.DB_CLIENT_OPERATION_DURATION, duration);+ span.setAttribute(+ SemanticConvention.DB_QUERY_SUMMARY,+ `${dbOperation} ${namespace} vectors_count=${records.length}`+ );++ if (OpenlitConfig.traceContent && records.length > 0) {+ span.setAttribute(SemanticConvention.DB_QUERY_TEXT, JSON.stringify(records.map((r: any) => r.id)));+ }++ span.setStatus({ code: 1 });+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ }+ });+ };+ };+ }++ static _patchDelete(tracer: Tracer, operationName: string): any {+ const dbOperation = SemanticConvention.DB_OPERATION_DELETE;+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const namespace = PineconeWrapper._resolveNamespace(this);+ const spanName = `${dbOperation} ${namespace}`;+ const span = tracer.startSpan(spanName, { kind: SpanKind.CLIENT });+ const startTime = Date.now();++ return context.with(trace.setSpan(context.active(), span), async () => {+ try {+ const response = await originalMethod.apply(this, args);+ const params = args[0] || {};+ const duration = (Date.now() - startTime) / 1000;++ PineconeWrapper._setCommonAttributes(span, `${dbOperation}.${operationName}`, namespace);+ span.setAttribute(SemanticConvention.DB_CLIENT_OPERATION_DURATION, duration);++ // deleteOne passes an id string; deleteMany passes an array of ids+ let ids: string[] = [];+ if (typeof params === 'string') {+ ids = [params];+ span.setAttribute(SemanticConvention.DB_ID_COUNT, 1);+ } else if (Array.isArray(params)) {+ ids = params;+ span.setAttribute(SemanticConvention.DB_ID_COUNT, params.length);+ } else if (params.ids) {+ ids = Array.isArray(params.ids) ? params.ids : [params.ids];+ span.setAttribute(SemanticConvention.DB_ID_COUNT, ids.length);+ }+ if (params.deleteAll) {+ span.setAttribute(SemanticConvention.DB_DELETE_ALL, true);+ }+ if (params.filter) {+ span.setAttribute(SemanticConvention.DB_FILTER, JSON.stringify(params.filter));+ }++ span.setAttribute(+ SemanticConvention.DB_QUERY_SUMMARY,+ `${dbOperation} ${namespace} ids=${JSON.stringify(ids)} delete_all=${params.deleteAll || false}`+ );++ span.setStatus({ code: 1 });+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ }+ });+ };+ };+ }++ static _patchUpdate(tracer: Tracer): any {+ const dbOperation = SemanticConvention.DB_OPERATION_UPDATE;+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const namespace = PineconeWrapper._resolveNamespace(this);+ const spanName = `${dbOperation} ${namespace}`;+ const span = tracer.startSpan(spanName, { kind: SpanKind.CLIENT });+ const startTime = Date.now();++ return context.with(trace.setSpan(context.active(), span), async () => {+ try {+ const response = await originalMethod.apply(this, args);+ const params = args[0] || {};+ const duration = (Date.now() - startTime) / 1000;++ PineconeWrapper._setCommonAttributes(span, dbOperation, namespace);+ span.setAttribute(SemanticConvention.DB_CLIENT_OPERATION_DURATION, duration);++ if (params.id) span.setAttribute(SemanticConvention.DB_UPDATE_ID, params.id);+ if (params.values) span.setAttribute(SemanticConvention.DB_UPDATE_VALUES, String(params.values?.length || 0));+ if (params.metadata) {+ span.setAttribute(SemanticConvention.DB_UPDATE_METADATA, JSON.stringify(params.metadata));+ }++ span.setAttribute(+ SemanticConvention.DB_QUERY_SUMMARY,+ `${dbOperation} ${namespace} id=${params.id || ''} values=${params.values?.length || 0} set_metadata=${params.metadata ? JSON.stringify(params.metadata) : ''}`+ );++ span.setStatus({ code: 1 });+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ }+ });+ };+ };+ }+}++export default PineconeWrapper;diff --git a/sdk/typescript/src/instrumentation/vercel-ai/index.ts b/sdk/typescript/src/instrumentation/vercel-ai/index.tsnew file mode 100644index 00000000..837e32d9--- /dev/null+++ b/sdk/typescript/src/instrumentation/vercel-ai/index.ts@@ -0,0 +1,69 @@+import {+ InstrumentationBase,+ InstrumentationModuleDefinition,+ InstrumentationNodeModuleDefinition,+} from '@opentelemetry/instrumentation';+import { InstrumentationConfig } from '@opentelemetry/instrumentation';+import { INSTRUMENTATION_PREFIX } from '../../constant';+import VercelAIWrapper from './wrapper';++export interface VercelAIInstrumentationConfig extends InstrumentationConfig {}++// Functions to intercept from the `ai` module+const PATCHED_FNS = ['generateText', 'streamText', 'generateObject', 'embed'] as const;++export default class OpenlitVercelAIInstrumentation extends InstrumentationBase {+ constructor(config: VercelAIInstrumentationConfig = {}) {+ super(`${INSTRUMENTATION_PREFIX}/instrumentation-vercel-ai`, '1.0.0', config);+ }++ protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[] {+ const module = new InstrumentationNodeModuleDefinition(+ 'ai',+ ['>=3.0.0 <5'],+ (moduleExports) => this._patch(moduleExports),+ // No-op unpatch: Proxy is discarded when the module is re-required+ () => {}+ );+ return [module];+ }++ public manualPatch(ai: any): any {+ return this._patch(ai);+ }++ protected _patch(moduleExports: any): any {+ try {+ const tracer = this.tracer;++ // The `ai` package exports functions as non-configurable getter properties,+ // so shimmer's Object.defineProperty-based wrapping fails. Instead, return a+ // Proxy that intercepts property access and returns wrapped functions.+ const patchers: Record<string, (t: typeof tracer) => (orig: any) => any> = {+ generateText: VercelAIWrapper._patchGenerateText,+ streamText: VercelAIWrapper._patchStreamText,+ generateObject: VercelAIWrapper._patchGenerateObject,+ embed: VercelAIWrapper._patchEmbed,+ };++ // Pre-build wrapped functions once (avoid re-wrapping on every get)+ const wrapped: Record<string, any> = {};+ for (const name of PATCHED_FNS) {+ const original = moduleExports[name];+ if (typeof original === 'function') {+ wrapped[name] = patchers[name](tracer)(original);+ }+ }++ return new Proxy(moduleExports, {+ get(target, prop: string, receiver) {+ if (prop in wrapped) return wrapped[prop];+ return Reflect.get(target, prop, receiver);+ },+ });+ } catch (e) {+ console.error('Error in VercelAI _patch method:', e);+ return moduleExports;+ }+ }+}diff --git a/sdk/typescript/src/instrumentation/vercel-ai/wrapper.ts b/sdk/typescript/src/instrumentation/vercel-ai/wrapper.tsnew file mode 100644index 00000000..ebcd389a--- /dev/null+++ b/sdk/typescript/src/instrumentation/vercel-ai/wrapper.ts@@ -0,0 +1,277 @@+import { Span, SpanKind, Tracer, context, trace } from '@opentelemetry/api';+import OpenlitConfig from '../../config';+import OpenLitHelper from '../../helpers';+import SemanticConvention from '../../semantic-convention';+import BaseWrapper, { BaseSpanAttributes } from '../base-wrapper';++class VercelAIWrapper extends BaseWrapper {+ static aiSystem = 'vercel_ai';++ static _getProviderFromModel(model: any): string {+ if (!model) return VercelAIWrapper.aiSystem;+ const provider = model.provider || '';+ if (provider.startsWith('openai')) return SemanticConvention.GEN_AI_SYSTEM_OPENAI;+ if (provider.startsWith('anthropic')) return SemanticConvention.GEN_AI_SYSTEM_ANTHROPIC;+ if (provider.startsWith('google')) return SemanticConvention.GEN_AI_SYSTEM_VERTEXAI;+ if (provider.startsWith('mistral')) return SemanticConvention.GEN_AI_SYSTEM_MISTRAL;+ if (provider.startsWith('cohere')) return SemanticConvention.GEN_AI_SYSTEM_COHERE;+ if (provider.startsWith('amazon') || provider.startsWith('aws')) return SemanticConvention.GEN_AI_SYSTEM_AWS_BEDROCK;+ return VercelAIWrapper.aiSystem;+ }++ static _patchGenerateText(tracer: Tracer): any {+ const genAIEndpoint = 'ai.generateText';+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });+ return context.with(trace.setSpan(context.active(), span), async () => {+ let metricParams: BaseSpanAttributes | undefined;+ try {+ const response = await originalMethod.apply(this, args);+ const params = args[0] || {};+ const model = params.model;+ const modelId = model?.modelId || 'unknown';+ const aiSystem = VercelAIWrapper._getProviderFromModel(model);++ const pricingInfo = await OpenlitConfig.updatePricingJson(OpenlitConfig.pricing_json);+ const cost = OpenLitHelper.getChatModelCost(+ modelId,+ pricingInfo,+ response.usage?.promptTokens || 0,+ response.usage?.completionTokens || 0+ );++ VercelAIWrapper.setBaseSpanAttributes(span, { genAIEndpoint, model: modelId, cost, aiSystem });++ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, false);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS, params.maxTokens || -1);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE, params.temperature ?? 1);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_TOP_P, params.topP ?? 1);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, modelId);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, response.usage?.promptTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS, response.usage?.completionTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS, response.usage?.totalTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_TOKEN_USAGE, response.usage?.totalTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [response.finishReason || 'stop']);+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_TYPE, SemanticConvention.GEN_AI_OUTPUT_TYPE_TEXT);++ if (response.toolCalls?.length > 0) {+ const toolNames = response.toolCalls.map((t: any) => t.toolName || '').filter(Boolean);+ const toolArgs = response.toolCalls.map((t: any) => JSON.stringify(t.args || {}));+ if (toolNames.length > 0) span.setAttribute(SemanticConvention.GEN_AI_TOOL_NAME, toolNames.join(', '));+ if (toolArgs.length > 0) span.setAttribute(SemanticConvention.GEN_AI_TOOL_CALL_ARGUMENTS, toolArgs);+ }++ if (OpenlitConfig.traceContent) {+ const messages = params.messages || (params.prompt ? [{ role: 'user', content: params.prompt }] : []);+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, OpenLitHelper.buildInputMessages(messages));+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(response.text || '', response.finishReason || 'stop', response.toolCalls)+ );+ }++ metricParams = { genAIEndpoint, model: modelId, cost, aiSystem };+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ if (metricParams) BaseWrapper.recordMetrics(span, metricParams);+ }+ });+ };+ };+ }++ static _patchStreamText(tracer: Tracer): any {+ const genAIEndpoint = 'ai.streamText';+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });+ const startTime = Date.now();++ try {+ const response = await originalMethod.apply(this, args);+ const params = args[0] || {};+ const model = params.model;+ const modelId = model?.modelId || 'unknown';+ const aiSystem = VercelAIWrapper._getProviderFromModel(model);++ // Set request attributes immediately+ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, true);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS, params.maxTokens || -1);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE, params.temperature ?? 1);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_TOP_P, params.topP ?? 1);++ if (OpenlitConfig.traceContent) {+ const messages = params.messages || (params.prompt ? [{ role: 'user', content: params.prompt }] : []);+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, OpenLitHelper.buildInputMessages(messages));+ }++ // Observe stream completion via usage promise+ Promise.resolve(response.usage)+ .then(async (usage: any) => {+ try {+ const ttft = response.experimental_providerMetadata+ ? undefined+ : (Date.now() - startTime) / 1000;+ const pricingInfo = await OpenlitConfig.updatePricingJson(OpenlitConfig.pricing_json);+ const cost = OpenLitHelper.getChatModelCost(+ modelId,+ pricingInfo,+ usage?.promptTokens || 0,+ usage?.completionTokens || 0+ );++ VercelAIWrapper.setBaseSpanAttributes(span, { genAIEndpoint, model: modelId, cost, aiSystem });++ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, modelId);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, usage?.promptTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS, usage?.completionTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS, usage?.totalTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_TOKEN_USAGE, usage?.totalTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_TYPE, SemanticConvention.GEN_AI_OUTPUT_TYPE_TEXT);+ if (ttft) span.setAttribute(SemanticConvention.GEN_AI_SERVER_TTFT, ttft);++ const finishReason = await Promise.resolve(response.finishReason).catch(() => 'stop');+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [finishReason || 'stop']);++ if (OpenlitConfig.traceContent) {+ const text = await Promise.resolve(response.text).catch(() => '');+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(text || '', finishReason || 'stop')+ );+ }++ BaseWrapper.recordMetrics(span, { genAIEndpoint, model: modelId, cost, aiSystem });+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ } finally {+ span.end();+ }+ })+ .catch((e: any) => {+ OpenLitHelper.handleException(span, e);+ span.end();+ });++ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ span.end();+ throw e;+ }+ };+ };+ }++ static _patchGenerateObject(tracer: Tracer): any {+ const genAIEndpoint = 'ai.generateObject';+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });+ return context.with(trace.setSpan(context.active(), span), async () => {+ let metricParams: BaseSpanAttributes | undefined;+ try {+ const response = await originalMethod.apply(this, args);+ const params = args[0] || {};+ const model = params.model;+ const modelId = model?.modelId || 'unknown';+ const aiSystem = VercelAIWrapper._getProviderFromModel(model);++ const pricingInfo = await OpenlitConfig.updatePricingJson(OpenlitConfig.pricing_json);+ const cost = OpenLitHelper.getChatModelCost(+ modelId,+ pricingInfo,+ response.usage?.promptTokens || 0,+ response.usage?.completionTokens || 0+ );++ VercelAIWrapper.setBaseSpanAttributes(span, { genAIEndpoint, model: modelId, cost, aiSystem });++ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, false);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS, params.maxTokens || -1);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE, params.temperature ?? 1);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, modelId);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, response.usage?.promptTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS, response.usage?.completionTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS, response.usage?.totalTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_TOKEN_USAGE, response.usage?.totalTokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [response.finishReason || 'stop']);+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_TYPE, SemanticConvention.GEN_AI_OUTPUT_TYPE_JSON);++ if (OpenlitConfig.traceContent) {+ const messages = params.messages || (params.prompt ? [{ role: 'user', content: params.prompt }] : []);+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, OpenLitHelper.buildInputMessages(messages));+ span.setAttribute(+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,+ OpenLitHelper.buildOutputMessages(JSON.stringify(response.object || {}), response.finishReason || 'stop')+ );+ }++ metricParams = { genAIEndpoint, model: modelId, cost, aiSystem };+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ if (metricParams) BaseWrapper.recordMetrics(span, metricParams);+ }+ });+ };+ };+ }++ static _patchEmbed(tracer: Tracer): any {+ const genAIEndpoint = 'ai.embed';+ return (originalMethod: (...args: any[]) => any) => {+ return async function (this: any, ...args: any[]) {+ const span = tracer.startSpan(genAIEndpoint, { kind: SpanKind.CLIENT });+ return context.with(trace.setSpan(context.active(), span), async () => {+ let metricParams: BaseSpanAttributes | undefined;+ try {+ const response = await originalMethod.apply(this, args);+ const params = args[0] || {};+ const model = params.model;+ const modelId = model?.modelId || 'unknown';+ const aiSystem = VercelAIWrapper._getProviderFromModel(model);++ const pricingInfo = await OpenlitConfig.updatePricingJson(OpenlitConfig.pricing_json);+ const cost = OpenLitHelper.getEmbedModelCost(modelId, pricingInfo, response.usage?.tokens || 0);++ VercelAIWrapper.setBaseSpanAttributes(span, { genAIEndpoint, model: modelId, cost, aiSystem });++ span.setAttribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING);+ span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, false);+ span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, modelId);+ span.setAttribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, response.usage?.tokens || 0);+ span.setAttribute(SemanticConvention.GEN_AI_CLIENT_TOKEN_USAGE, response.usage?.tokens || 0);++ if (OpenlitConfig.traceContent && params.value !== undefined) {+ const inputStr = typeof params.value === 'string' ? params.value : JSON.stringify(params.value);+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, inputStr);+ }++ metricParams = { genAIEndpoint, model: modelId, cost, aiSystem };+ return response;+ } catch (e: any) {+ OpenLitHelper.handleException(span, e);+ throw e;+ } finally {+ span.end();+ if (metricParams) BaseWrapper.recordMetrics(span, metricParams);+ }+ });+ };+ };+ }+}++export default VercelAIWrapper;diff --git a/sdk/typescript/src/semantic-convention.ts b/sdk/typescript/src/semantic-convention.tsindex 2c82c635..82e3aaef 100644--- a/sdk/typescript/src/semantic-convention.ts+++ b/sdk/typescript/src/semantic-convention.ts@@ -116,32 +116,42 @@ export default class SemanticConvention {static GEN_AI_SYSTEM_AWS_BEDROCK = 'aws.bedrock';static GEN_AI_SYSTEM_VERTEXAI = 'vertex_ai';static GEN_AI_SYSTEM_LANGCHAIN = 'langchain';+ static GEN_AI_SYSTEM_VERCEL_AI = 'vercel_ai';+ static GEN_AI_SYSTEM_LLAMAINDEX = 'llamaindex';// Vector DBstatic DB_REQUESTS = 'db.total.requests';static DB_SYSTEM = 'db.system';+ static DB_SYSTEM_NAME = 'db.system.name';static DB_SYSTEM_CHROMA = 'chroma';static DB_SYSTEM_PINECONE = 'pinecone';static DB_COLLECTION_NAME = 'db.collection.name';static DB_OPERATION = 'db.operation';+ static DB_OPERATION_NAME = 'db.operation.name';static DB_OPERATION_CREATE_INDEX = 'create_index';- static DB_OPERATION_QUERY = 'query';- static DB_OPERATION_DELETE = 'delete';- static DB_OPERATION_UPDATE = 'update';- static DB_OPERATION_UPSERT = 'upsert';+ static DB_OPERATION_QUERY = 'QUERY';+ static DB_OPERATION_DELETE = 'DELETE';+ static DB_OPERATION_UPDATE = 'UPDATE';+ static DB_OPERATION_UPSERT = 'UPSERT';static DB_OPERATION_GET = 'get';static DB_OPERATION_ADD = 'add';static DB_OPERATION_PEEK = 'peek';+ static DB_OPERATION_SEARCH = 'SEARCH';+ static DB_OPERATION_FETCH = 'FETCH';static DB_ID_COUNT = 'db.ids_count';- static DB_VECTOR_COUNT = 'db.vector_count';+ static DB_VECTOR_COUNT = 'db.vector.count';static DB_METADATA_COUNT = 'db.metadatas_count';static DB_DOCUMENTS_COUNT = 'db.documents_count';static DB_QUERY_LIMIT = 'db.limit';+ static DB_VECTOR_QUERY_TOP_K = 'db.vector.query.top_k';static DB_OFFSET = 'db.offset';static DB_WHERE_DOCUMENT = 'db.where_document';static DB_FILTER = 'db.filter';+ static DB_QUERY_TEXT = 'db.query.text';+ static DB_QUERY_SUMMARY = 'db.query.summary';static DB_STATEMENT = 'db.statement';static DB_N_RESULTS = 'db.n_results';+ static DB_RESPONSE_RETURNED_ROWS = 'db.response.returned_rows';static DB_DELETE_ALL = 'db.delete_all';static DB_INDEX_NAME = 'db.create_index.name';static DB_INDEX_DIMENSION = 'db.create_index.dimensions';diff --git a/sdk/typescript/src/types.ts b/sdk/typescript/src/types.tsindex 3937f1a7..a918b354 100644--- a/sdk/typescript/src/types.ts+++ b/sdk/typescript/src/types.ts@@ -3,7 +3,7 @@ import { Resource } from '@opentelemetry/resources';import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';import { metrics } from '@opentelemetry/api';-export type InstrumentationType = 'openai' | 'anthropic' | 'cohere' | 'groq' | 'mistral' | 'google-ai' | 'together' | 'ollama';+export type InstrumentationType = 'openai' | 'anthropic' | 'cohere' | 'groq' | 'mistral' | 'google-ai' | 'together' | 'ollama' | 'vercel-ai' | 'langchain' | 'pinecone' | 'bedrock' | 'llamaindex';export type OpenlitInstrumentations = Partial<Record<InstrumentationType, any>>;diff --git a/sdk/typescript/tsconfig.tsbuildinfo b/sdk/typescript/tsconfig.tsbuildinfoindex 3e5f0cf3..2d140d5d 100644--- a/sdk/typescript/tsconfig.tsbuildinfo+++ b/sdk/typescript/tsconfig.tsbuildinfo@@ -1 +1 @@-{"root":["./src/config.ts","./src/constant.ts","./src/helpers.ts","./src/index.ts","./src/prompt-hub.ts","./src/semantic-convention.ts","./src/tracing.ts","./src/types.ts","./src/evals/all.ts","./src/evals/base.ts","./src/evals/bias_detection.ts","./src/evals/hallucination.ts","./src/evals/index.ts","./src/evals/llm.ts","./src/evals/metrics.ts","./src/evals/toxicity.ts","./src/evals/types.ts","./src/evals/utils.ts","./src/evals/__tests__/base.test.ts","./src/evals/__tests__/core.test.ts","./src/evals/__tests__/evals.ts","./src/evals/__tests__/llm.test.ts","./src/evals/__tests__/metrics.test.ts","./src/evals/__tests__/utils.test.ts","./src/features/base.ts","./src/features/prompt-hub.ts","./src/features/vault.ts","./src/instrumentation/base-wrapper.ts","./src/instrumentation/index.ts","./src/instrumentation/anthropic/index.ts","./src/instrumentation/anthropic/wrapper.ts","./src/instrumentation/cohere/index.ts","./src/instrumentation/cohere/wrapper.ts","./src/instrumentation/ollama/index.ts","./src/instrumentation/ollama/wrapper.ts","./src/instrumentation/openai/index.ts","./src/instrumentation/openai/wrapper.ts"],"version":"5.8.3"}\ No newline at end of file+{"root":["./src/config.ts","./src/constant.ts","./src/helpers.ts","./src/index.ts","./src/prompt-hub.ts","./src/semantic-convention.ts","./src/types.ts","./src/evals/all.ts","./src/evals/base.ts","./src/evals/bias.ts","./src/evals/hallucination.ts","./src/evals/index.ts","./src/evals/metrics.ts","./src/evals/toxicity.ts","./src/evals/types.ts","./src/evals/utils.ts","./src/evals/__tests__/anthropic.test.ts","./src/evals/__tests__/base.test.ts","./src/evals/__tests__/core.test.ts","./src/evals/__tests__/metrics.test.ts","./src/evals/__tests__/openai.test.ts","./src/evals/__tests__/providers.test.ts","./src/evals/__tests__/utils.test.ts","./src/evals/llm/anthropic.ts","./src/evals/llm/openai.ts","./src/evals/llm/providers.ts","./src/features/base.ts","./src/features/prompt-hub.ts","./src/features/vault.ts","./src/guard/all.ts","./src/guard/base.ts","./src/guard/index.ts","./src/guard/prompt-injection.ts","./src/guard/sensitive-topic.ts","./src/guard/topic-restriction.ts","./src/guard/types.ts","./src/guard/utils.ts","./src/guard/__tests__/gaurd.test.ts","./src/guard/__tests__/utils.test.ts","./src/instrumentation/base-wrapper.ts","./src/instrumentation/index.ts","./src/instrumentation/__tests__/anthropic-wrapper.test.ts","./src/instrumentation/__tests__/base-wrapper.test.ts","./src/instrumentation/__tests__/cohere-wrapper.test.ts","./src/instrumentation/__tests__/google-ai-trace-comparison.test.ts","./src/instrumentation/__tests__/groq-trace-comparison.test.ts","./src/instrumentation/__tests__/mistral-trace-comparison.test.ts","./src/instrumentation/__tests__/openai-wrapper.test.ts","./src/instrumentation/__tests__/together-trace-comparison.test.ts","./src/instrumentation/__tests__/trace-comparison-utils.ts","./src/instrumentation/anthropic/index.ts","./src/instrumentation/anthropic/wrapper.ts","./src/instrumentation/bedrock/index.ts","./src/instrumentation/bedrock/wrapper.ts","./src/instrumentation/cohere/index.ts","./src/instrumentation/cohere/wrapper.ts","./src/instrumentation/google-ai/index.ts","./src/instrumentation/google-ai/wrapper.ts","./src/instrumentation/groq/index.ts","./src/instrumentation/groq/wrapper.ts","./src/instrumentation/langchain/index.ts","./src/instrumentation/langchain/wrapper.ts","./src/instrumentation/llamaindex/index.ts","./src/instrumentation/llamaindex/wrapper.ts","./src/instrumentation/mistral/index.ts","./src/instrumentation/mistral/wrapper.ts","./src/instrumentation/ollama/index.ts","./src/instrumentation/ollama/wrapper.ts","./src/instrumentation/openai/index.ts","./src/instrumentation/openai/wrapper.ts","./src/instrumentation/pinecone/index.ts","./src/instrumentation/pinecone/wrapper.ts","./src/instrumentation/together/index.ts","./src/instrumentation/together/wrapper.ts","./src/instrumentation/vercel-ai/index.ts","./src/instrumentation/vercel-ai/wrapper.ts","./src/llm/anthropic.ts","./src/llm/index.ts","./src/llm/openai.ts","./src/llm/providers.ts","./src/otel/metrics.ts","./src/otel/tracing.ts","./src/otel/__tests__/metrics.test.ts"],"version":"5.8.3"}\ No newline at end of file