openlit 1.14.1__tar.gz → 1.15.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. {openlit-1.14.1 → openlit-1.15.0}/PKG-INFO +17 -17
  2. {openlit-1.14.1 → openlit-1.15.0}/README.md +16 -16
  3. {openlit-1.14.1 → openlit-1.15.0}/pyproject.toml +1 -1
  4. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/__init__.py +3 -0
  5. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/bedrock/bedrock.py +2 -2
  6. openlit-1.15.0/src/openlit/instrumentation/elevenlabs/__init__.py +54 -0
  7. openlit-1.15.0/src/openlit/instrumentation/elevenlabs/async_elevenlabs.py +117 -0
  8. openlit-1.15.0/src/openlit/instrumentation/elevenlabs/elevenlabs.py +117 -0
  9. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/langchain/__init__.py +14 -2
  10. openlit-1.15.0/src/openlit/instrumentation/langchain/langchain.py +330 -0
  11. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/openai/async_azure_openai.py +3 -3
  12. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/openai/async_openai.py +5 -5
  13. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/openai/azure_openai.py +3 -3
  14. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/openai/openai.py +5 -5
  15. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/transformers/__init__.py +1 -1
  16. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/transformers/transformers.py +3 -3
  17. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/semcov/__init__.py +6 -3
  18. openlit-1.14.1/src/openlit/instrumentation/langchain/langchain.py +0 -161
  19. {openlit-1.14.1 → openlit-1.15.0}/LICENSE +0 -0
  20. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/__helpers.py +0 -0
  21. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/anthropic/__init__.py +0 -0
  22. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/anthropic/anthropic.py +0 -0
  23. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/anthropic/async_anthropic.py +0 -0
  24. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/bedrock/__init__.py +0 -0
  25. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/chroma/__init__.py +0 -0
  26. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/chroma/chroma.py +0 -0
  27. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/cohere/__init__.py +0 -0
  28. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/cohere/cohere.py +0 -0
  29. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/embedchain/__init__.py +0 -0
  30. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/embedchain/embedchain.py +0 -0
  31. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/gpt4all/__init__.py +0 -0
  32. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/gpt4all/gpt4all.py +0 -0
  33. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/gpu/__init__.py +0 -0
  34. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/groq/__init__.py +0 -0
  35. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/groq/async_groq.py +0 -0
  36. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/groq/groq.py +0 -0
  37. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/haystack/__init__.py +0 -0
  38. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/haystack/haystack.py +0 -0
  39. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/llamaindex/__init__.py +0 -0
  40. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/llamaindex/llamaindex.py +0 -0
  41. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/milvus/__init__.py +0 -0
  42. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/milvus/milvus.py +0 -0
  43. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/mistral/__init__.py +0 -0
  44. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/mistral/async_mistral.py +0 -0
  45. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/mistral/mistral.py +0 -0
  46. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/ollama/__init__.py +0 -0
  47. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/ollama/async_ollama.py +0 -0
  48. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/ollama/ollama.py +0 -0
  49. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/openai/__init__.py +0 -0
  50. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/pinecone/__init__.py +0 -0
  51. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/pinecone/pinecone.py +0 -0
  52. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/qdrant/__init__.py +0 -0
  53. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/qdrant/qdrant.py +0 -0
  54. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/vertexai/__init__.py +0 -0
  55. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/vertexai/async_vertexai.py +0 -0
  56. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/instrumentation/vertexai/vertexai.py +0 -0
  57. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/otel/metrics.py +0 -0
  58. {openlit-1.14.1 → openlit-1.15.0}/src/openlit/otel/tracing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openlit
3
- Version: 1.14.1
3
+ Version: 1.15.0
4
4
  Summary: OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications, facilitating the integration of observability into your GenAI-driven projects
5
5
  Home-page: https://github.com/openlit/openlit/tree/main/openlit/python
6
6
  Keywords: OpenTelemetry,otel,otlp,llm,tracing,openai,anthropic,claude,cohere,llm monitoring,observability,monitoring,gpt,Generative AI,chatGPT
@@ -38,7 +38,7 @@ OpenTelemetry Auto-Instrumentation for GenAI & LLM Applications</h1>
38
38
  [![GitHub Contributors](https://img.shields.io/github/contributors/openlit/openlit)](https://github.com/openlit/openlit/graphs/contributors)
39
39
 
40
40
  [![Slack](https://img.shields.io/badge/Slack-4A154B?logo=slack&logoColor=white)](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ)
41
- [![Discord](https://img.shields.io/badge/Discord-7289DA?logo=discord&logoColor=white)](https://discord.gg/rjvTm6zd)
41
+ [![Discord](https://img.shields.io/badge/Discord-7289DA?logo=discord&logoColor=white)](https://discord.gg/CQnXwNT3)
42
42
  [![X](https://img.shields.io/badge/follow-%40openlit__io-1DA1F2?logo=x&style=social)](https://twitter.com/openlit_io)
43
43
 
44
44
  ![OpenLIT Connections Banner](https://github.com/openlit/.github/blob/main/profile/assets/github-readme-connections-banner.png?raw=true)
@@ -54,20 +54,20 @@ This project adheres to the [Semantic Conventions](https://github.com/open-telem
54
54
 
55
55
  ## Auto Instrumentation Capabilities
56
56
 
57
- | LLMs | Vector DBs | Frameworks |
58
- |-----------------------------------------------------------------|----------------------------------------------|----------------------------------------------|
59
- | [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai) | [✅ ChromaDB](https://docs.openlit.io/latest/integrations/chromadb) | [✅ Langchain](https://docs.openlit.io/latest/integrations/langchain) |
60
- | [✅ Ollama](https://docs.openlit.io/latest/integrations/ollama) | [✅ Pinecone](https://docs.openlit.io/latest/integrations/pinecone) | [✅ LiteLLM](https://docs.openlit.io/latest/integrations/litellm) |
61
- | [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic) | [✅ Qdrant](https://docs.openlit.io/latest/integrations/qdrant) | [✅ LlamaIndex](https://docs.openlit.io/latest/integrations/llama-index) |
62
- | [✅ GPT4All](https://docs.openlit.io/latest/integrations/gpt4all) | [✅ Milvus](https://docs.openlit.io/latest/integrations/milvus) | [✅ Haystack](https://docs.openlit.io/latest/integrations/haystack) |
63
- | [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere) | | [✅ EmbedChain](https://docs.openlit.io/latest/integrations/embedchain) |
64
- | [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral) | |
65
- | [✅ Azure OpenAI](https://docs.openlit.io/latest/integrations/azure-openai) | |
66
- | [✅ HuggingFace Transformers](https://docs.openlit.io/latest/integrations/huggingface) | |
67
- | [✅ Amazon Bedrock](https://docs.openlit.io/latest/integrations/bedrock) | |
68
- | [✅ Vertex AI](https://docs.openlit.io/latest/integrations/vertexai) | |
69
- | [✅ Groq](https://docs.openlit.io/latest/integrations/groq) |
70
-
57
+ | LLMs | Vector DBs | Frameworks | GPUs |
58
+ |-----------------------------------------------------------------|----------------------------------------------|----------------------------------------------|---------------|
59
+ | [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai) | [✅ ChromaDB](https://docs.openlit.io/latest/integrations/chromadb) | [✅ Langchain](https://docs.openlit.io/latest/integrations/langchain) | [✅ NVIDIA GPUs](https://docs.openlit.io/latest/integrations/nvidia-gpu) |
60
+ | [✅ Ollama](https://docs.openlit.io/latest/integrations/ollama) | [✅ Pinecone](https://docs.openlit.io/latest/integrations/pinecone) | [✅ LiteLLM](https://docs.openlit.io/latest/integrations/litellm) | |
61
+ | [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic) | [✅ Qdrant](https://docs.openlit.io/latest/integrations/qdrant) | [✅ LlamaIndex](https://docs.openlit.io/latest/integrations/llama-index) | |
62
+ | [✅ GPT4All](https://docs.openlit.io/latest/integrations/gpt4all) | [✅ Milvus](https://docs.openlit.io/latest/integrations/milvus) | [✅ Haystack](https://docs.openlit.io/latest/integrations/haystack) | |
63
+ | [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere) | | [✅ EmbedChain](https://docs.openlit.io/latest/integrations/embedchain) | |
64
+ | [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral) | | | |
65
+ | [✅ Azure OpenAI](https://docs.openlit.io/latest/integrations/azure-openai) | | | |
66
+ | [✅ HuggingFace Transformers](https://docs.openlit.io/latest/integrations/huggingface) | | | |
67
+ | [✅ Amazon Bedrock](https://docs.openlit.io/latest/integrations/bedrock) | | | |
68
+ | [✅ Vertex AI](https://docs.openlit.io/latest/integrations/vertexai) | | | |
69
+ | [✅ Groq](https://docs.openlit.io/latest/integrations/groq) | | | |
70
+ | [✅ ElevenLabs](https://docs.openlit.io/latest/integrations/elevenlabs) | | | |
71
71
  ## Supported Destinations
72
72
  - [✅ OpenTelemetry Collector](https://docs.openlit.io/latest/connections/otelcol)
73
73
  - [✅ Prometheus + Tempo](https://docs.openlit.io/latest/connections/prometheus-tempo)
@@ -204,7 +204,7 @@ Your input helps us grow and improve, and we're here to support you every step o
204
204
  Connect with the OpenLIT community and maintainers for support, discussions, and updates:
205
205
 
206
206
  - 🌟 If you like it, Leave a star on our [GitHub](https://github.com/openlit/openlit/)
207
- - 🌍 Join our [Slack](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ) or [Discord](https://discord.gg/rjvTm6zd) community for live interactions and questions.
207
+ - 🌍 Join our [Slack](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ) or [Discord](https://discord.gg/CQnXwNT3) community for live interactions and questions.
208
208
  - 🐞 Report bugs on our [GitHub Issues](https://github.com/openlit/openlit/issues) to help us improve OpenLIT.
209
209
  - 𝕏 Follow us on [X](https://x.com/openlit_io) for the latest updates and news.
210
210
 
@@ -11,7 +11,7 @@ OpenTelemetry Auto-Instrumentation for GenAI & LLM Applications</h1>
11
11
  [![GitHub Contributors](https://img.shields.io/github/contributors/openlit/openlit)](https://github.com/openlit/openlit/graphs/contributors)
12
12
 
13
13
  [![Slack](https://img.shields.io/badge/Slack-4A154B?logo=slack&logoColor=white)](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ)
14
- [![Discord](https://img.shields.io/badge/Discord-7289DA?logo=discord&logoColor=white)](https://discord.gg/rjvTm6zd)
14
+ [![Discord](https://img.shields.io/badge/Discord-7289DA?logo=discord&logoColor=white)](https://discord.gg/CQnXwNT3)
15
15
  [![X](https://img.shields.io/badge/follow-%40openlit__io-1DA1F2?logo=x&style=social)](https://twitter.com/openlit_io)
16
16
 
17
17
  ![OpenLIT Connections Banner](https://github.com/openlit/.github/blob/main/profile/assets/github-readme-connections-banner.png?raw=true)
@@ -27,20 +27,20 @@ This project adheres to the [Semantic Conventions](https://github.com/open-telem
27
27
 
28
28
  ## Auto Instrumentation Capabilities
29
29
 
30
- | LLMs | Vector DBs | Frameworks |
31
- |-----------------------------------------------------------------|----------------------------------------------|----------------------------------------------|
32
- | [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai) | [✅ ChromaDB](https://docs.openlit.io/latest/integrations/chromadb) | [✅ Langchain](https://docs.openlit.io/latest/integrations/langchain) |
33
- | [✅ Ollama](https://docs.openlit.io/latest/integrations/ollama) | [✅ Pinecone](https://docs.openlit.io/latest/integrations/pinecone) | [✅ LiteLLM](https://docs.openlit.io/latest/integrations/litellm) |
34
- | [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic) | [✅ Qdrant](https://docs.openlit.io/latest/integrations/qdrant) | [✅ LlamaIndex](https://docs.openlit.io/latest/integrations/llama-index) |
35
- | [✅ GPT4All](https://docs.openlit.io/latest/integrations/gpt4all) | [✅ Milvus](https://docs.openlit.io/latest/integrations/milvus) | [✅ Haystack](https://docs.openlit.io/latest/integrations/haystack) |
36
- | [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere) | | [✅ EmbedChain](https://docs.openlit.io/latest/integrations/embedchain) |
37
- | [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral) | |
38
- | [✅ Azure OpenAI](https://docs.openlit.io/latest/integrations/azure-openai) | |
39
- | [✅ HuggingFace Transformers](https://docs.openlit.io/latest/integrations/huggingface) | |
40
- | [✅ Amazon Bedrock](https://docs.openlit.io/latest/integrations/bedrock) | |
41
- | [✅ Vertex AI](https://docs.openlit.io/latest/integrations/vertexai) | |
42
- | [✅ Groq](https://docs.openlit.io/latest/integrations/groq) |
43
-
30
+ | LLMs | Vector DBs | Frameworks | GPUs |
31
+ |-----------------------------------------------------------------|----------------------------------------------|----------------------------------------------|---------------|
32
+ | [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai) | [✅ ChromaDB](https://docs.openlit.io/latest/integrations/chromadb) | [✅ Langchain](https://docs.openlit.io/latest/integrations/langchain) | [✅ NVIDIA GPUs](https://docs.openlit.io/latest/integrations/nvidia-gpu) |
33
+ | [✅ Ollama](https://docs.openlit.io/latest/integrations/ollama) | [✅ Pinecone](https://docs.openlit.io/latest/integrations/pinecone) | [✅ LiteLLM](https://docs.openlit.io/latest/integrations/litellm) | |
34
+ | [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic) | [✅ Qdrant](https://docs.openlit.io/latest/integrations/qdrant) | [✅ LlamaIndex](https://docs.openlit.io/latest/integrations/llama-index) | |
35
+ | [✅ GPT4All](https://docs.openlit.io/latest/integrations/gpt4all) | [✅ Milvus](https://docs.openlit.io/latest/integrations/milvus) | [✅ Haystack](https://docs.openlit.io/latest/integrations/haystack) | |
36
+ | [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere) | | [✅ EmbedChain](https://docs.openlit.io/latest/integrations/embedchain) | |
37
+ | [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral) | | | |
38
+ | [✅ Azure OpenAI](https://docs.openlit.io/latest/integrations/azure-openai) | | | |
39
+ | [✅ HuggingFace Transformers](https://docs.openlit.io/latest/integrations/huggingface) | | | |
40
+ | [✅ Amazon Bedrock](https://docs.openlit.io/latest/integrations/bedrock) | | | |
41
+ | [✅ Vertex AI](https://docs.openlit.io/latest/integrations/vertexai) | | | |
42
+ | [✅ Groq](https://docs.openlit.io/latest/integrations/groq) | | | |
43
+ | [✅ ElevenLabs](https://docs.openlit.io/latest/integrations/elevenlabs) | | | |
44
44
  ## Supported Destinations
45
45
  - [✅ OpenTelemetry Collector](https://docs.openlit.io/latest/connections/otelcol)
46
46
  - [✅ Prometheus + Tempo](https://docs.openlit.io/latest/connections/prometheus-tempo)
@@ -177,6 +177,6 @@ Your input helps us grow and improve, and we're here to support you every step o
177
177
  Connect with the OpenLIT community and maintainers for support, discussions, and updates:
178
178
 
179
179
  - 🌟 If you like it, Leave a star on our [GitHub](https://github.com/openlit/openlit/)
180
- - 🌍 Join our [Slack](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ) or [Discord](https://discord.gg/rjvTm6zd) community for live interactions and questions.
180
+ - 🌍 Join our [Slack](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ) or [Discord](https://discord.gg/CQnXwNT3) community for live interactions and questions.
181
181
  - 🐞 Report bugs on our [GitHub Issues](https://github.com/openlit/openlit/issues) to help us improve OpenLIT.
182
182
  - 𝕏 Follow us on [X](https://x.com/openlit_io) for the latest updates and news.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openlit"
3
- version = "1.14.1"
3
+ version = "1.15.0"
4
4
  description = "OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications, facilitating the integration of observability into your GenAI-driven projects"
5
5
  authors = ["OpenLIT"]
6
6
  repository = "https://github.com/openlit/openlit/tree/main/openlit/python"
@@ -31,6 +31,7 @@ from openlit.instrumentation.vertexai import VertexAIInstrumentor
31
31
  from openlit.instrumentation.groq import GroqInstrumentor
32
32
  from openlit.instrumentation.ollama import OllamaInstrumentor
33
33
  from openlit.instrumentation.gpt4all import GPT4AllInstrumentor
34
+ from openlit.instrumentation.elevenlabs import ElevenLabsInstrumentor
34
35
  from openlit.instrumentation.langchain import LangChainInstrumentor
35
36
  from openlit.instrumentation.llamaindex import LlamaIndexInstrumentor
36
37
  from openlit.instrumentation.haystack import HaystackInstrumentor
@@ -192,6 +193,7 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
192
193
  "groq": "groq",
193
194
  "ollama": "ollama",
194
195
  "gpt4all": "gpt4all",
196
+ "elevenlabs": "elevenlabs",
195
197
  "langchain": "langchain",
196
198
  "llama_index": "llama_index",
197
199
  "haystack": "haystack",
@@ -267,6 +269,7 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
267
269
  "groq": GroqInstrumentor(),
268
270
  "ollama": OllamaInstrumentor(),
269
271
  "gpt4all": GPT4AllInstrumentor(),
272
+ "elevenlabs": ElevenLabsInstrumentor(),
270
273
  "langchain": LangChainInstrumentor(),
271
274
  "llama_index": LlamaIndexInstrumentor(),
272
275
  "haystack": HaystackInstrumentor(),
@@ -88,9 +88,9 @@ def chat(gen_ai_endpoint, version, environment, application_name, tracer,
88
88
  quality = request_body.get("imageGenerationConfig", {}).get("quality", "standard")
89
89
  n = request_body.get("imageGenerationConfig", {}).get("numberOfImages", 1)
90
90
 
91
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_SIZE,
91
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_SIZE,
92
92
  size)
93
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_QUALITY,
93
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_QUALITY,
94
94
  quality)
95
95
  # Calculate cost of the operation
96
96
  cost = n * get_image_model_cost(model,
@@ -0,0 +1,54 @@
1
+ # pylint: disable=useless-return, bad-staticmethod-argument, disable=duplicate-code
2
+ """Initializer of Auto Instrumentation of ElevenLabs Functions"""
3
+
4
+ from typing import Collection
5
+ import importlib.metadata
6
+ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
7
+ from wrapt import wrap_function_wrapper
8
+
9
+ from openlit.instrumentation.elevenlabs.elevenlabs import (
10
+ generate
11
+ )
12
+ from openlit.instrumentation.elevenlabs.async_elevenlabs import (
13
+ async_generate
14
+ )
15
+
16
+ _instruments = ("elevenlabs >= 1.4.0",)
17
+
18
+ class ElevenLabsInstrumentor(BaseInstrumentor):
19
+ """
20
+ An instrumentor for ElevenLabs's client library.
21
+ """
22
+
23
+ def instrumentation_dependencies(self) -> Collection[str]:
24
+ return _instruments
25
+
26
+ def _instrument(self, **kwargs):
27
+ application_name = kwargs.get("application_name", "default")
28
+ environment = kwargs.get("environment", "default")
29
+ tracer = kwargs.get("tracer")
30
+ metrics = kwargs.get("metrics_dict")
31
+ pricing_info = kwargs.get("pricing_info", {})
32
+ trace_content = kwargs.get("trace_content", False)
33
+ disable_metrics = kwargs.get("disable_metrics")
34
+ version = importlib.metadata.version("elevenlabs")
35
+
36
+ # sync generate
37
+ wrap_function_wrapper(
38
+ "elevenlabs.client",
39
+ "ElevenLabs.generate",
40
+ generate("elevenlabs.generate", version, environment, application_name,
41
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
42
+ )
43
+
44
+ # async generate
45
+ wrap_function_wrapper(
46
+ "elevenlabs.client",
47
+ "AsyncElevenLabs.generate",
48
+ async_generate("elevenlabs.generate", version, environment, application_name,
49
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
50
+ )
51
+
52
+ def _uninstrument(self, **kwargs):
53
+ # Proper uninstrumentation logic to revert patched methods
54
+ pass
@@ -0,0 +1,117 @@
1
+ # pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment
2
+ """
3
+ Module for monitoring Ollama API calls.
4
+ """
5
+
6
+ import logging
7
+ from opentelemetry.trace import SpanKind, Status, StatusCode
8
+ from opentelemetry.sdk.resources import TELEMETRY_SDK_NAME
9
+ from openlit.__helpers import get_audio_model_cost
10
+ from openlit.__helpers import handle_exception
11
+ from openlit.semcov import SemanticConvetion
12
+
13
+ # Initialize logger for logging potential issues and operations
14
+ logger = logging.getLogger(__name__)
15
+
16
+ def async_generate(gen_ai_endpoint, version, environment, application_name,
17
+ tracer, pricing_info, trace_content, metrics, disable_metrics):
18
+ """
19
+ Generates a telemetry wrapper for creating speech audio to collect metrics.
20
+
21
+ Args:
22
+ gen_ai_endpoint: Endpoint identifier for logging and tracing.
23
+ version: Version of the monitoring package.
24
+ environment: Deployment environment (e.g., production, staging).
25
+ application_name: Name of the application using the ElevenLabs API.
26
+ tracer: OpenTelemetry tracer for creating spans.
27
+ pricing_info: Information used for calculating the cost of generating speech audio.
28
+ trace_content: Flag indicating whether to trace the input text and generated audio.
29
+
30
+ Returns:
31
+ A function that wraps the speech audio creation method to add telemetry.
32
+ """
33
+
34
+ async def wrapper(wrapped, instance, args, kwargs):
35
+ """
36
+ Wraps the 'generate' API call to add telemetry.
37
+
38
+ This collects metrics such as execution time, cost, and handles errors
39
+ gracefully, adding details to the trace for observability.
40
+
41
+ Args:
42
+ wrapped: The original 'generate' method to be wrapped.
43
+ instance: The instance of the class where the original method is defined.
44
+ args: Positional arguments for the 'generate' method.
45
+ kwargs: Keyword arguments for the 'generate' method.
46
+
47
+ Returns:
48
+ The response from the original 'generate' method.
49
+ """
50
+
51
+ with tracer.start_as_current_span(gen_ai_endpoint, kind= SpanKind.CLIENT) as span:
52
+ response = await wrapped(*args, **kwargs)
53
+
54
+ try:
55
+ # Calculate cost of the operation
56
+ cost = get_audio_model_cost(kwargs.get("model", "eleven_multilingual_v2"),
57
+ pricing_info, kwargs.get("text", ""))
58
+
59
+ # Set Span attributes
60
+ span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
61
+ span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
62
+ SemanticConvetion.GEN_AI_SYSTEM_ELEVENLABS)
63
+ span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
64
+ SemanticConvetion.GEN_AI_TYPE_AUDIO)
65
+ span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
66
+ gen_ai_endpoint)
67
+ span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
68
+ environment)
69
+ span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
70
+ application_name)
71
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
72
+ kwargs.get("model", "eleven_multilingual_v2"))
73
+ if isinstance(kwargs.get("voice", "Rachel"), str):
74
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_VOICE,
75
+ kwargs.get("voice", "Rachel"))
76
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_RESPONSE_FORMAT,
77
+ kwargs.get("output_format", "mp3"))
78
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_SETTINGS,
79
+ str(kwargs.get("voice_settings", "")))
80
+ span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
81
+ cost)
82
+ if trace_content:
83
+ span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
84
+ str(kwargs.get("text", "")))
85
+
86
+ span.set_status(Status(StatusCode.OK))
87
+
88
+ if disable_metrics is False:
89
+ attributes = {
90
+ TELEMETRY_SDK_NAME:
91
+ "openlit",
92
+ SemanticConvetion.GEN_AI_APPLICATION_NAME:
93
+ application_name,
94
+ SemanticConvetion.GEN_AI_SYSTEM:
95
+ SemanticConvetion.GEN_AI_SYSTEM_ELEVENLABS,
96
+ SemanticConvetion.GEN_AI_ENVIRONMENT:
97
+ environment,
98
+ SemanticConvetion.GEN_AI_TYPE:
99
+ SemanticConvetion.GEN_AI_TYPE_AUDIO,
100
+ SemanticConvetion.GEN_AI_REQUEST_MODEL:
101
+ kwargs.get("model", "eleven_multilingual_v2")
102
+ }
103
+
104
+ metrics["genai_requests"].add(1, attributes)
105
+ metrics["genai_cost"].record(cost, attributes)
106
+
107
+ # Return original response
108
+ return response
109
+
110
+ except Exception as e:
111
+ handle_exception(span, e)
112
+ logger.error("Error in trace creation: %s", e)
113
+
114
+ # Return original response
115
+ return response
116
+
117
+ return wrapper
@@ -0,0 +1,117 @@
1
+ # pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment
2
+ """
3
+ Module for monitoring Ollama API calls.
4
+ """
5
+
6
+ import logging
7
+ from opentelemetry.trace import SpanKind, Status, StatusCode
8
+ from opentelemetry.sdk.resources import TELEMETRY_SDK_NAME
9
+ from openlit.__helpers import get_audio_model_cost
10
+ from openlit.__helpers import handle_exception
11
+ from openlit.semcov import SemanticConvetion
12
+
13
+ # Initialize logger for logging potential issues and operations
14
+ logger = logging.getLogger(__name__)
15
+
16
+ def generate(gen_ai_endpoint, version, environment, application_name,
17
+ tracer, pricing_info, trace_content, metrics, disable_metrics):
18
+ """
19
+ Generates a telemetry wrapper for creating speech audio to collect metrics.
20
+
21
+ Args:
22
+ gen_ai_endpoint: Endpoint identifier for logging and tracing.
23
+ version: Version of the monitoring package.
24
+ environment: Deployment environment (e.g., production, staging).
25
+ application_name: Name of the application using the ElevenLabs API.
26
+ tracer: OpenTelemetry tracer for creating spans.
27
+ pricing_info: Information used for calculating the cost of generating speech audio.
28
+ trace_content: Flag indicating whether to trace the input text and generated audio.
29
+
30
+ Returns:
31
+ A function that wraps the speech audio creation method to add telemetry.
32
+ """
33
+
34
+ def wrapper(wrapped, instance, args, kwargs):
35
+ """
36
+ Wraps the 'generate' API call to add telemetry.
37
+
38
+ This collects metrics such as execution time, cost, and handles errors
39
+ gracefully, adding details to the trace for observability.
40
+
41
+ Args:
42
+ wrapped: The original 'generate' method to be wrapped.
43
+ instance: The instance of the class where the original method is defined.
44
+ args: Positional arguments for the 'generate' method.
45
+ kwargs: Keyword arguments for the 'generate' method.
46
+
47
+ Returns:
48
+ The response from the original 'generate' method.
49
+ """
50
+
51
+ with tracer.start_as_current_span(gen_ai_endpoint, kind= SpanKind.CLIENT) as span:
52
+ response = wrapped(*args, **kwargs)
53
+
54
+ try:
55
+ # Calculate cost of the operation
56
+ cost = get_audio_model_cost(kwargs.get("model", "eleven_multilingual_v2"),
57
+ pricing_info, kwargs.get("text", ""))
58
+
59
+ # Set Span attributes
60
+ span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
61
+ span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
62
+ SemanticConvetion.GEN_AI_SYSTEM_ELEVENLABS)
63
+ span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
64
+ SemanticConvetion.GEN_AI_TYPE_AUDIO)
65
+ span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
66
+ gen_ai_endpoint)
67
+ span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
68
+ environment)
69
+ span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
70
+ application_name)
71
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
72
+ kwargs.get("model", "eleven_multilingual_v2"))
73
+ if isinstance(kwargs.get("voice", "Rachel"), str):
74
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_VOICE,
75
+ kwargs.get("voice", "Rachel"))
76
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_RESPONSE_FORMAT,
77
+ kwargs.get("output_format", "mp3"))
78
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_SETTINGS,
79
+ str(kwargs.get("voice_settings", "")))
80
+ span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
81
+ cost)
82
+ if trace_content:
83
+ span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
84
+ str(kwargs.get("text", "")))
85
+
86
+ span.set_status(Status(StatusCode.OK))
87
+
88
+ if disable_metrics is False:
89
+ attributes = {
90
+ TELEMETRY_SDK_NAME:
91
+ "openlit",
92
+ SemanticConvetion.GEN_AI_APPLICATION_NAME:
93
+ application_name,
94
+ SemanticConvetion.GEN_AI_SYSTEM:
95
+ SemanticConvetion.GEN_AI_SYSTEM_ELEVENLABS,
96
+ SemanticConvetion.GEN_AI_ENVIRONMENT:
97
+ environment,
98
+ SemanticConvetion.GEN_AI_TYPE:
99
+ SemanticConvetion.GEN_AI_TYPE_AUDIO,
100
+ SemanticConvetion.GEN_AI_REQUEST_MODEL:
101
+ kwargs.get("model", "eleven_multilingual_v2")
102
+ }
103
+
104
+ metrics["genai_requests"].add(1, attributes)
105
+ metrics["genai_cost"].record(cost, attributes)
106
+
107
+ # Return original response
108
+ return response
109
+
110
+ except Exception as e:
111
+ handle_exception(span, e)
112
+ logger.error("Error in trace creation: %s", e)
113
+
114
+ # Return original response
115
+ return response
116
+
117
+ return wrapper
@@ -5,9 +5,9 @@ import importlib.metadata
5
5
  from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
6
6
  from wrapt import wrap_function_wrapper
7
7
 
8
- from openlit.instrumentation.langchain.langchain import general_wrap, hub
8
+ from openlit.instrumentation.langchain.langchain import general_wrap, hub, llm, allm
9
9
 
10
- _instruments = ("langchain >= 0.1.1",)
10
+ _instruments = ("langchain >= 0.1.20",)
11
11
 
12
12
  WRAPPED_METHODS = [
13
13
  {
@@ -40,6 +40,18 @@ WRAPPED_METHODS = [
40
40
  "endpoint": "langchain.retrieve.prompt",
41
41
  "wrapper": hub,
42
42
  },
43
+ {
44
+ "package": "langchain_core.language_models.llms",
45
+ "object": "BaseLLM.invoke",
46
+ "endpoint": "langchain.llm",
47
+ "wrapper": llm,
48
+ },
49
+ {
50
+ "package": "langchain_core.language_models.llms",
51
+ "object": "BaseLLM.ainvoke",
52
+ "endpoint": "langchain.llm",
53
+ "wrapper": allm,
54
+ },
43
55
  ]
44
56
 
45
57
  class LangChainInstrumentor(BaseInstrumentor):