monocle-apptrace 0.0.1__py3-none-any.whl → 0.1.1__py3-none-any.whl

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.

Potentially problematic release.


This version of monocle-apptrace might be problematic. Click here for more details.

Files changed (31) hide show
  1. monocle_apptrace/README.md +52 -28
  2. monocle_apptrace/__init__.py +0 -2
  3. monocle_apptrace/constants.py +22 -0
  4. monocle_apptrace/exporters/file_exporter.py +63 -0
  5. monocle_apptrace/haystack/__init__.py +5 -24
  6. monocle_apptrace/haystack/wrap_node.py +1 -1
  7. monocle_apptrace/haystack/wrap_openai.py +1 -9
  8. monocle_apptrace/haystack/wrap_pipeline.py +22 -9
  9. monocle_apptrace/instrumentor.py +29 -32
  10. monocle_apptrace/langchain/__init__.py +5 -94
  11. monocle_apptrace/llamaindex/__init__.py +7 -63
  12. monocle_apptrace/metamodel/README.md +47 -0
  13. monocle_apptrace/metamodel/entities/README.md +54 -0
  14. monocle_apptrace/metamodel/entities/entity_types.json +157 -0
  15. monocle_apptrace/metamodel/entities/entity_types.py +51 -0
  16. monocle_apptrace/metamodel/maps/haystack_methods.json +25 -0
  17. monocle_apptrace/metamodel/maps/lang_chain_methods.json +106 -0
  18. monocle_apptrace/metamodel/maps/llama_index_methods.json +70 -0
  19. monocle_apptrace/metamodel/spans/README.md +121 -0
  20. monocle_apptrace/metamodel/spans/span_example.json +140 -0
  21. monocle_apptrace/metamodel/spans/span_format.json +55 -0
  22. monocle_apptrace/utils.py +56 -16
  23. monocle_apptrace/wrap_common.py +143 -46
  24. monocle_apptrace/wrapper.py +3 -3
  25. monocle_apptrace-0.1.1.dist-info/METADATA +111 -0
  26. monocle_apptrace-0.1.1.dist-info/RECORD +29 -0
  27. monocle_apptrace-0.0.1.dist-info/METADATA +0 -76
  28. monocle_apptrace-0.0.1.dist-info/RECORD +0 -17
  29. {monocle_apptrace-0.0.1.dist-info → monocle_apptrace-0.1.1.dist-info}/WHEEL +0 -0
  30. {monocle_apptrace-0.0.1.dist-info → monocle_apptrace-0.1.1.dist-info}/licenses/LICENSE +0 -0
  31. {monocle_apptrace-0.0.1.dist-info → monocle_apptrace-0.1.1.dist-info}/licenses/NOTICE +0 -0
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.3
2
+ Name: monocle_apptrace
3
+ Version: 0.1.1
4
+ Summary: package with monocle genAI tracing
5
+ Project-URL: Homepage, https://github.com/monocle2ai/monocle
6
+ Project-URL: Issues, https://github.com/monocle2ai/monocle/issues
7
+ License-File: LICENSE
8
+ License-File: NOTICE
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.8
13
+ Requires-Dist: opentelemetry-api>=1.21.0
14
+ Requires-Dist: opentelemetry-instrumentation
15
+ Requires-Dist: opentelemetry-sdk>=1.21.0
16
+ Requires-Dist: requests
17
+ Requires-Dist: wrapt>=1.14.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: datasets==2.20.0; extra == 'dev'
20
+ Requires-Dist: faiss-cpu==1.8.0; extra == 'dev'
21
+ Requires-Dist: instructorembedding==1.0.1; extra == 'dev'
22
+ Requires-Dist: langchain-chroma==0.1.1; extra == 'dev'
23
+ Requires-Dist: langchain-community==0.2.5; extra == 'dev'
24
+ Requires-Dist: langchain-openai==0.1.8; extra == 'dev'
25
+ Requires-Dist: langchain==0.2.5; extra == 'dev'
26
+ Requires-Dist: llama-index-embeddings-huggingface==0.2.0; extra == 'dev'
27
+ Requires-Dist: llama-index-vector-stores-chroma==0.1.9; extra == 'dev'
28
+ Requires-Dist: llama-index==0.10.30; extra == 'dev'
29
+ Requires-Dist: numpy==1.26.4; extra == 'dev'
30
+ Requires-Dist: parameterized==0.9.0; extra == 'dev'
31
+ Requires-Dist: pytest==8.0.0; extra == 'dev'
32
+ Requires-Dist: sentence-transformers==2.6.1; extra == 'dev'
33
+ Requires-Dist: types-requests==2.31.0.20240106; extra == 'dev'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Monocle for tracing GenAI app code
37
+
38
+ **Monocle** helps developers and platform engineers building or managing GenAI apps monitor these in prod by making it easy to instrument their code to capture traces that are compliant with open-source cloud-native observability ecosystem.
39
+
40
+ **Monocle** is a community-driven OSS framework for tracing GenAI app code governed as a [Linux Foundation AI & Data project](https://lfaidata.foundation/projects/monocle/).
41
+
42
+ ## Why Monocle
43
+
44
+ Monocle is built for:
45
+ - **app developers** to trace their app code in any environment without lots of custom code decoration
46
+ - **platform engineers** to instrument apps in prod through wrapping instead of asking app devs to recode
47
+ - **GenAI component providers** to add observability features to their products
48
+ - **enterprises** to consume traces from GenAI apps in their existing open-source observability stack
49
+
50
+ Benefits:
51
+ - Monocle provides an implementation + package, not just a spec
52
+ - No expertise in OpenTelemetry spec required
53
+ - No bespoke implementation of that spec required
54
+ - No last-mile GenAI domain specific code required to instrument your app
55
+ - Monocle provides consistency
56
+ - Connect traces across app code executions, model inference or data retrievals
57
+ - No cleansing of telemetry data across GenAI component providers required
58
+ - Works the same in personal lab dev or org cloud prod environments
59
+ - Send traces to location that fits your scale, budget and observability stack
60
+ - Monocle is fully open source and community driven
61
+ - No vendor lock-in
62
+ - Implementation is transparent
63
+ - You can freely use or customize it to fit your needs
64
+
65
+ ## What Monocle provides
66
+
67
+ - Easy to [use](#use-monocle) code instrumentation
68
+ - OpenTelemetry compatible format for [spans](src/monocle_apptrace/metamodel/spans/span_format.json).
69
+ - Community-curated and extensible [metamodel](src/monocle_apptrace/metamodel/README.md) for consisent tracing of GenAI components.
70
+ - Export to local and cloud storage
71
+
72
+ ## Use Monocle
73
+
74
+ - Get the Monocle package
75
+
76
+ ```
77
+ pip install monocle_apptrace
78
+ ```
79
+ - Instrument your app code
80
+ - Import the Monocle package
81
+ ```
82
+ from monocle_apptrace.instrumentor import setup_monocle_telemetry
83
+ ```
84
+ - Setup instrumentation in your ```main()``` function
85
+ ```
86
+ setup_monocle_telemetry(workflow_name="your-app-name")
87
+ ```
88
+ - (Optionally) Modify config to alter where traces are sent
89
+
90
+ See [Monocle user guide](Monocle_User_Guide.md) for more details.
91
+
92
+
93
+ ## Roadmap
94
+
95
+ Goal of Monocle is to support tracing for apps written in *any language* with *any LLM orchestration or agentic framework* and built using models, vectors, agents or other components served up by *any cloud or model inference provider*.
96
+
97
+ Current version supports:
98
+ - Language: (🟢) Python , (🔜) [Typescript](https://github.com/monocle2ai/monocle-typescript)
99
+ - LLM-frameworks: (🟢) Langchain, (🟢) Llamaindex, (🟢) Haystack, (🔜) Flask
100
+ - LLM inference providers: (🟢) OpenAI, (🟢) Azure OpenAI, (🟢) Nvidia Triton, (🔜) AWS Bedrock, (🔜) Google Vertex, (🔜) Azure ML, (🔜) Hugging Face
101
+ - Vector stores: (🟢) FAISS, (🔜) OpenSearch, (🔜) Milvus
102
+ - Exporter: (🟢) stdout, (🟢) file, (🔜) Azure Blob Storage, (🔜) AWS S3, (🔜) Google Cloud Storage
103
+
104
+
105
+ ## Get involved
106
+ ### Provide feedback
107
+ - Submit issues and enhancements requests via Github issues
108
+
109
+ ### Contribute
110
+ - Monocle is community based open source project. We welcome your contributions. Please refer to the CONTRIBUTING and CODE_OF_CONDUCT for guidelines. The [contributor's guide](CONTRIBUTING.md) provides technical details of the project.
111
+
@@ -0,0 +1,29 @@
1
+ monocle_apptrace/README.md,sha256=T5NFC01bF8VR0oVnAX_n0bhsEtttwqfTxDNAe5Y_ivE,3765
2
+ monocle_apptrace/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ monocle_apptrace/constants.py,sha256=wjObbmMTFL201x-bf3EOXevYygwkFH_1ng5dDrpE3z0,810
4
+ monocle_apptrace/instrumentor.py,sha256=txKj7tZaXY0gznc8QVOyMI-LA5r7tfSPJkleZPI1fWQ,5051
5
+ monocle_apptrace/utils.py,sha256=l3FAVF0rFbsph1LFdTMcs7K5ASiaovRQBmBeFYEHZmU,3174
6
+ monocle_apptrace/wrap_common.py,sha256=rhiY2PE2WoLYofbby3LioTSjFG8YrMlhUnc82yXRkFk,12612
7
+ monocle_apptrace/wrapper.py,sha256=cNUdfciAXNYAhvtOA2O4ONRvuT2bbHb4ax_7pALijEI,734
8
+ monocle_apptrace/exporters/file_exporter.py,sha256=gN9pJ_X5pcstVVsyivgHsjWhr443eRa6Y6Hx1rGLQAM,2280
9
+ monocle_apptrace/haystack/__init__.py,sha256=95LGUcUZbOcX5h-NwNrquKycp-qhuwCmcMfWAwxGylQ,321
10
+ monocle_apptrace/haystack/wrap_node.py,sha256=IK07Wn3Lk1Os9URsyrmB1HXOH2FNdzK9fNLlR8TZdYc,908
11
+ monocle_apptrace/haystack/wrap_openai.py,sha256=Yp916DhOl0WI6virRi3L43snfsQm7PhI28wlDsg19v8,1536
12
+ monocle_apptrace/haystack/wrap_pipeline.py,sha256=1bufscslUpjbSw_kVl24rngTMsiGV33oCKbTxwtWM6Q,2173
13
+ monocle_apptrace/langchain/__init__.py,sha256=3ABxFk92mmRj67Y3z70leZ4j1ig9Z6OU--rtxzfNIIM,271
14
+ monocle_apptrace/llamaindex/__init__.py,sha256=lr-rdprhXJdSt-Fp1LghW-hMxWgDN6lPFTQgyqnb7N0,573
15
+ monocle_apptrace/metamodel/README.md,sha256=KYuuYqgA9PNbOjG0zYj2nAdvNEpyNN_Bk9M2tNdnZ_s,4598
16
+ monocle_apptrace/metamodel/entities/README.md,sha256=ZE8PYne9F8xN4uu0CB1BOS8iM5QdKdpQjHuqCaw7Vkg,1553
17
+ monocle_apptrace/metamodel/entities/entity_types.json,sha256=-J1ZbzrZny1c9HSQKwRZu2Un3c0JjX9FvsfHwlZvaaw,5435
18
+ monocle_apptrace/metamodel/entities/entity_types.py,sha256=4CzobOm692tou1Tsv8YX_yrOhhnwMBF8hBAt1Czn_8Q,1076
19
+ monocle_apptrace/metamodel/maps/haystack_methods.json,sha256=JmngkaKICAzOyrWNTWEOLYFrp99l5wcERYKE_SQRNxE,698
20
+ monocle_apptrace/metamodel/maps/lang_chain_methods.json,sha256=HaOhhxb3PkI7tXPxXhWR4cnWrnEHU--k5pOY9RS0Uew,3119
21
+ monocle_apptrace/metamodel/maps/llama_index_methods.json,sha256=qpODnBHkaDjPBYZNd7clwmp_2subTu-fmI08Ky5OWdg,2192
22
+ monocle_apptrace/metamodel/spans/README.md,sha256=_uMkLLaWitQ_rPh7oQbW5Oe7uGSv2h_QA6YwxHRJi74,5433
23
+ monocle_apptrace/metamodel/spans/span_example.json,sha256=R4YVyz3rkhVc_FxpeBkY9JfO0GwluFa2A2wn4LkOPbo,4402
24
+ monocle_apptrace/metamodel/spans/span_format.json,sha256=GhfioGgMhG7St0DeYA1fgNtMkbr9wiQ1L2hovekRQ24,1512
25
+ monocle_apptrace-0.1.1.dist-info/METADATA,sha256=2Oz22Sjk1qarR4h_RctVoYnQWq0LSklrXu05_GFJjjE,5215
26
+ monocle_apptrace-0.1.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
27
+ monocle_apptrace-0.1.1.dist-info/licenses/LICENSE,sha256=ay9trLiP5I7ZsFXo6AqtkLYdRqe5S9r-DrPOvsNlZrg,9136
28
+ monocle_apptrace-0.1.1.dist-info/licenses/NOTICE,sha256=9jn4xtwM_uUetJMx5WqGnhrR7MIhpoRlpokjSTlyt8c,112
29
+ monocle_apptrace-0.1.1.dist-info/RECORD,,
@@ -1,76 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: monocle_apptrace
3
- Version: 0.0.1
4
- Summary: package with monocle genAI tracing
5
- Project-URL: Homepage, https://github.com/monocle2ai/monocle
6
- Project-URL: Issues, https://github.com/monocle2ai/monocle/issues
7
- License-File: LICENSE
8
- License-File: NOTICE
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Programming Language :: Python :: 3
12
- Requires-Python: >=3.8
13
- Requires-Dist: opentelemetry-api>=1.21.0
14
- Requires-Dist: opentelemetry-instrumentation
15
- Requires-Dist: opentelemetry-sdk>=1.21.0
16
- Requires-Dist: requests
17
- Requires-Dist: wrapt>=1.14.0
18
- Provides-Extra: dev
19
- Requires-Dist: datasets==2.20.0; extra == 'dev'
20
- Requires-Dist: faiss-cpu==1.8.0; extra == 'dev'
21
- Requires-Dist: instructorembedding==1.0.1; extra == 'dev'
22
- Requires-Dist: langchain-chroma==0.1.1; extra == 'dev'
23
- Requires-Dist: langchain-community==0.2.5; extra == 'dev'
24
- Requires-Dist: langchain-openai==0.1.8; extra == 'dev'
25
- Requires-Dist: langchain==0.2.5; extra == 'dev'
26
- Requires-Dist: llama-index-embeddings-huggingface==0.2.0; extra == 'dev'
27
- Requires-Dist: llama-index-vector-stores-chroma==0.1.9; extra == 'dev'
28
- Requires-Dist: llama-index==0.10.30; extra == 'dev'
29
- Requires-Dist: numpy==1.26.4; extra == 'dev'
30
- Requires-Dist: pytest==8.0.0; extra == 'dev'
31
- Requires-Dist: sentence-transformers==2.6.1; extra == 'dev'
32
- Requires-Dist: types-requests==2.31.0.20240106; extra == 'dev'
33
- Description-Content-Type: text/markdown
34
-
35
- # monocle genAI observability
36
- ### Background
37
- Generative AI (GenAI) is the type of AI used to create content such as conversations, images, or video based on prior learning from existing content. GenAI relies on foundational models, which are exceptionally large ML models trained on vast amounts of generalized and unlabeled data to perform variety of general tasks such as understanding language and generating new text, audio or images from user provided prompts in a human language. Foundational models (FM) work by using learned patterns and relationships from the training data to predict the next item in a sequence given a prompt. It is cheaper and faster for data scientists to use foundational models as starting points rather than building models from scratch to build ML apps.
38
- Large Language Models (LLMs) are a class of foundational models trained on text data used to perform a variety of tasks such as understanding language, reasoning over text, and generating new text based on user prompts in a human language. Examples of LLMs include ChatGPT, Llama, and Claude.
39
- LLM-based AI apps leverage understanding language, reasoning & text generation to augment or automate complex tasks that typically require human intervention such as summarizing legal documents, triaging customer support tickets, or more.
40
- Typically, AI developers build LLM-based AI apps that automate complex workflows by combining multiple LLMs and components such as prompts, vectors, or agents that each solve a discrete task that are connected by chains or pipelines in different ways using LLM (Large Language Model) orchestration frameworks.
41
- When deployed to production, different parts of multi-component distributed LLM-based AI apps run on a combination of different kinds of AI infrastructure such as LLM-as-a-Service, GPU (graphics processing units) clouds, managed services from cloud, or custom-engineered AI stack. Typically, these systems are managed in production by IT DevOps engineers.
42
- AI developers code, monitor, debug and optimize the resources in an LLM-based AI application. IT DevOps engineers monitor, troubleshoot, and optimize the services in the AI infra that the LLM-based AI application runs on.
43
-
44
- ## Introducing “Monocle – An eye for A.I.”
45
- The goal of project Monocle is to help GenAI developer to trace their applications. A typical GenAI application comprises of several technology components like application code/workflow, models, inferences services, vector databases etc. Understanding the dependencies and tracking application quickly becomes a difficult task. Monocle can be integrated into application code with very little to no code changes. Monocle supports tracing all GenAI technology components, application frameworks, LLM hosting services. We do all the hard work of finding what needs to be instrumented and how to instrument it. This enables the enlightened applications to generate detailed traces without any additional efforts from the developers.
46
- The traces are compatible with OpenTelemetry format. They are further enriched to contain lot more attribute relevant to GenAI applications like prompts. The project will have out of box support to store the traces locally and a extensibility for a third party store which can be implemented by end user or a supplied by third party vendors.
47
-
48
- ## Monocle integration
49
- ### genAI Appliation frameworks
50
- - Langchain
51
- - LlamaIndex
52
- - Haystack
53
- ### LLMs
54
- - OpenAI
55
- - Azure OpenAI
56
- - NVIDIA Triton
57
-
58
- ## Getting started
59
- ### Try Monocle with your python genAI application
60
- - Get latest Monocle python brary
61
- ```
62
- pip install monocle_apptrace
63
- ```
64
- - Enable Monocle tracing in your app by adding following
65
- ```
66
- setup_okahu_telemetry(workflow_name="your-app-name")
67
- ```
68
- Please refer to [Monocle user guide](Monocle_User_Guide.md) for more details
69
-
70
- ## Get involved
71
- ### Provide feedback
72
- - Submit issues and enhancements requests via Github issues
73
-
74
- ### Contribute
75
- - Monocle is community based open source project. We welcome your contributions. Please refer to the CONTRIBUTING and CODE_OF_CONDUCT for guidelines. The [contributor's guide](CONTRIBUTING.md) provides technical details of the project.
76
-
@@ -1,17 +0,0 @@
1
- monocle_apptrace/README.md,sha256=C0JfJtNC7LOlr_iHSxOwuZn89vuoZ2RbyeGB7ACu4iY,3094
2
- monocle_apptrace/__init__.py,sha256=daEdpEyAJIa8b2VkCqSKcw8PaExcB6Qro80XNes_sHA,2
3
- monocle_apptrace/instrumentor.py,sha256=T-g0OpR2VYm7lswyiFoBlBeRPKHX6a-mhH8q7rE-o2g,4927
4
- monocle_apptrace/utils.py,sha256=KZwwXK8NTbVjQo4BkFwPdccE6hzvBzawPp6an44Gmz8,1366
5
- monocle_apptrace/wrap_common.py,sha256=Qxwq2drHOovd0CMd7YiQbe_4FqGL07RLfu4Vek1Z-SU,9107
6
- monocle_apptrace/wrapper.py,sha256=95Yg_dwGv5T6qtNv-ozhXRGaDVI0P27exU2901Pw2ps,684
7
- monocle_apptrace/haystack/__init__.py,sha256=GspHWTmqMDxQhpTgl91xighNL8MHaWs6BF0YzzZayuE,714
8
- monocle_apptrace/haystack/wrap_node.py,sha256=96qUlDZtNOVIPrrDZzjJ7ZDCi70mYbd7bIEX41e-RH0,916
9
- monocle_apptrace/haystack/wrap_openai.py,sha256=9ecWsOUXNjTKrQjNZz1GCgkCAN9GChhasMRDmZMuANE,1585
10
- monocle_apptrace/haystack/wrap_pipeline.py,sha256=eVxJ4-yS4gFxInwaWy5oxNcNl44X2M7_dhBpKVFmI6Q,1622
11
- monocle_apptrace/langchain/__init__.py,sha256=PrZl6vxX5WsYfsPFVhumVmUGkwddAgPBFs1hpifbmZw,2519
12
- monocle_apptrace/llamaindex/__init__.py,sha256=iMaboVDeM5yGR01cEqCD8MotCj2FuY4QjSZmFBv4f2o,2094
13
- monocle_apptrace-0.0.1.dist-info/METADATA,sha256=uYd9O71FeKzrkLq6DmJYp9F62QxxZ7UfSAaGa5dPVm8,5645
14
- monocle_apptrace-0.0.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
15
- monocle_apptrace-0.0.1.dist-info/licenses/LICENSE,sha256=ay9trLiP5I7ZsFXo6AqtkLYdRqe5S9r-DrPOvsNlZrg,9136
16
- monocle_apptrace-0.0.1.dist-info/licenses/NOTICE,sha256=9jn4xtwM_uUetJMx5WqGnhrR7MIhpoRlpokjSTlyt8c,112
17
- monocle_apptrace-0.0.1.dist-info/RECORD,,