openlit 1.5.0__tar.gz → 1.6.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 (47) hide show
  1. {openlit-1.5.0 → openlit-1.6.0}/PKG-INFO +2 -1
  2. {openlit-1.5.0 → openlit-1.6.0}/README.md +1 -0
  3. {openlit-1.5.0 → openlit-1.6.0}/pyproject.toml +1 -1
  4. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/__init__.py +3 -0
  5. openlit-1.6.0/src/openlit/instrumentation/ollama/__init__.py +104 -0
  6. openlit-1.6.0/src/openlit/instrumentation/ollama/async_ollama.py +564 -0
  7. openlit-1.6.0/src/openlit/instrumentation/ollama/ollama.py +564 -0
  8. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/semcov/__init__.py +1 -0
  9. {openlit-1.5.0 → openlit-1.6.0}/LICENSE +0 -0
  10. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/__helpers.py +0 -0
  11. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/anthropic/__init__.py +0 -0
  12. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/anthropic/anthropic.py +0 -0
  13. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/anthropic/async_anthropic.py +0 -0
  14. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/bedrock/__init__.py +0 -0
  15. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/bedrock/bedrock.py +0 -0
  16. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/chroma/__init__.py +0 -0
  17. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/chroma/chroma.py +0 -0
  18. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/cohere/__init__.py +0 -0
  19. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/cohere/cohere.py +0 -0
  20. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/groq/__init__.py +0 -0
  21. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/groq/async_groq.py +0 -0
  22. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/groq/groq.py +0 -0
  23. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/haystack/__init__.py +0 -0
  24. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/haystack/haystack.py +0 -0
  25. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/langchain/__init__.py +0 -0
  26. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/langchain/langchain.py +0 -0
  27. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/llamaindex/__init__.py +0 -0
  28. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/llamaindex/llamaindex.py +0 -0
  29. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/mistral/__init__.py +0 -0
  30. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/mistral/async_mistral.py +0 -0
  31. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/mistral/mistral.py +0 -0
  32. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/openai/__init__.py +0 -0
  33. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/openai/async_azure_openai.py +0 -0
  34. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/openai/async_openai.py +0 -0
  35. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/openai/azure_openai.py +0 -0
  36. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/openai/openai.py +0 -0
  37. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/pinecone/__init__.py +0 -0
  38. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/pinecone/pinecone.py +0 -0
  39. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/qdrant/__init__.py +0 -0
  40. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/qdrant/qdrant.py +0 -0
  41. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/transformers/__init__.py +0 -0
  42. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/transformers/transformers.py +0 -0
  43. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/vertexai/__init__.py +0 -0
  44. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/vertexai/async_vertexai.py +0 -0
  45. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/instrumentation/vertexai/vertexai.py +0 -0
  46. {openlit-1.5.0 → openlit-1.6.0}/src/openlit/otel/metrics.py +0 -0
  47. {openlit-1.5.0 → openlit-1.6.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.5.0
3
+ Version: 1.6.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
@@ -50,6 +50,7 @@ This project adheres to the [Semantic Conventions](https://github.com/open-telem
50
50
 
51
51
  ### LLMs
52
52
  - [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai)
53
+ - [✅ Ollama](https://docs.openlit.io/latest/integrations/ollama)
53
54
  - [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic)
54
55
  - [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere)
55
56
  - [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral)
@@ -25,6 +25,7 @@ This project adheres to the [Semantic Conventions](https://github.com/open-telem
25
25
 
26
26
  ### LLMs
27
27
  - [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai)
28
+ - [✅ Ollama](https://docs.openlit.io/latest/integrations/ollama)
28
29
  - [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic)
29
30
  - [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere)
30
31
  - [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openlit"
3
- version = "1.5.0"
3
+ version = "1.6.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"
@@ -20,6 +20,7 @@ from openlit.instrumentation.mistral import MistralInstrumentor
20
20
  from openlit.instrumentation.bedrock import BedrockInstrumentor
21
21
  from openlit.instrumentation.vertexai import VertexAIInstrumentor
22
22
  from openlit.instrumentation.groq import GroqInstrumentor
23
+ from openlit.instrumentation.ollama import OllamaInstrumentor
23
24
  from openlit.instrumentation.langchain import LangChainInstrumentor
24
25
  from openlit.instrumentation.llamaindex import LlamaIndexInstrumentor
25
26
  from openlit.instrumentation.haystack import HaystackInstrumentor
@@ -154,6 +155,7 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
154
155
  "bedrock": "boto3",
155
156
  "vertexai": "vertexai",
156
157
  "groq": "groq",
158
+ "ollama": "ollama",
157
159
  "langchain": "langchain",
158
160
  "llama_index": "llama_index",
159
161
  "haystack": "haystack",
@@ -206,6 +208,7 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
206
208
  "bedrock": BedrockInstrumentor(),
207
209
  "vertexai": VertexAIInstrumentor(),
208
210
  "groq": GroqInstrumentor(),
211
+ "ollama": OllamaInstrumentor(),
209
212
  "langchain": LangChainInstrumentor(),
210
213
  "llama_index": LlamaIndexInstrumentor(),
211
214
  "haystack": HaystackInstrumentor(),
@@ -0,0 +1,104 @@
1
+ # pylint: disable=useless-return, bad-staticmethod-argument, disable=duplicate-code
2
+ """Initializer of Auto Instrumentation of Ollama 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.ollama.ollama import (
10
+ chat, embeddings, generate
11
+ )
12
+ from openlit.instrumentation.ollama.async_ollama import (
13
+ async_chat, async_embeddings, async_generate
14
+ )
15
+
16
+ _instruments = ("ollama >= 0.2.0",)
17
+
18
+ class OllamaInstrumentor(BaseInstrumentor):
19
+ """
20
+ An instrumentor for Ollama'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_application")
28
+ environment = kwargs.get("environment", "default_environment")
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("ollama")
35
+
36
+ # sync chat
37
+ wrap_function_wrapper(
38
+ "ollama",
39
+ "chat",
40
+ chat("ollama.chat", version, environment, application_name,
41
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
42
+ )
43
+ wrap_function_wrapper(
44
+ "ollama",
45
+ "Client.chat",
46
+ chat("ollama.chat", version, environment, application_name,
47
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
48
+ )
49
+
50
+ # sync embeddings
51
+ wrap_function_wrapper(
52
+ "ollama",
53
+ "embeddings",
54
+ embeddings("ollama.embeddings", version, environment, application_name,
55
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
56
+ )
57
+ wrap_function_wrapper(
58
+ "ollama",
59
+ "Client.embeddings",
60
+ embeddings("ollama.embeddings", version, environment, application_name,
61
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
62
+ )
63
+
64
+ # sync generate
65
+ wrap_function_wrapper(
66
+ "ollama",
67
+ "generate",
68
+ generate("ollama.generate", version, environment, application_name,
69
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
70
+ )
71
+ wrap_function_wrapper(
72
+ "ollama",
73
+ "Client.generate",
74
+ generate("ollama.generate", version, environment, application_name,
75
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
76
+ )
77
+
78
+ # async chat
79
+ wrap_function_wrapper(
80
+ "ollama",
81
+ "AsyncClient.chat",
82
+ async_chat("ollama.chat", version, environment, application_name,
83
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
84
+ )
85
+
86
+ # async embeddings
87
+ wrap_function_wrapper(
88
+ "ollama",
89
+ "AsyncClient.embeddings",
90
+ async_embeddings("ollama.embeddings", version, environment, application_name,
91
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
92
+ )
93
+
94
+ # aync generate
95
+ wrap_function_wrapper(
96
+ "ollama",
97
+ "AsyncClient.generate",
98
+ async_generate("ollama.generate", version, environment, application_name,
99
+ tracer, pricing_info, trace_content, metrics, disable_metrics),
100
+ )
101
+
102
+ def _uninstrument(self, **kwargs):
103
+ # Proper uninstrumentation logic to revert patched methods
104
+ pass