monocle-apptrace 0.1.0__tar.gz → 0.1.1__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.

Potentially problematic release.


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

Files changed (52) hide show
  1. monocle_apptrace-0.1.1/PKG-INFO +111 -0
  2. monocle_apptrace-0.1.1/Pipfile.lock +340 -0
  3. monocle_apptrace-0.1.1/README.md +76 -0
  4. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/pyproject.toml +1 -1
  5. monocle_apptrace-0.1.1/src/monocle_apptrace/README.md +101 -0
  6. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/haystack/__init__.py +1 -1
  7. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/haystack/wrap_pipeline.py +16 -0
  8. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/instrumentor.py +4 -4
  9. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/langchain/__init__.py +1 -1
  10. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/llamaindex/__init__.py +1 -1
  11. monocle_apptrace-0.1.1/src/monocle_apptrace/metamodel/README.md +47 -0
  12. monocle_apptrace-0.1.1/src/monocle_apptrace/metamodel/entities/README.md +54 -0
  13. monocle_apptrace-0.1.1/src/monocle_apptrace/metamodel/entities/entity_types.json +157 -0
  14. monocle_apptrace-0.1.1/src/monocle_apptrace/metamodel/entities/entity_types.py +51 -0
  15. monocle_apptrace-0.1.1/src/monocle_apptrace/metamodel/spans/README.md +121 -0
  16. monocle_apptrace-0.1.1/src/monocle_apptrace/metamodel/spans/span_example.json +140 -0
  17. monocle_apptrace-0.1.1/src/monocle_apptrace/metamodel/spans/span_format.json +55 -0
  18. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/utils.py +20 -0
  19. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/wrap_common.py +50 -7
  20. monocle_apptrace-0.1.0/PKG-INFO +0 -77
  21. monocle_apptrace-0.1.0/Pipfile.lock +0 -46
  22. monocle_apptrace-0.1.0/README.md +0 -42
  23. monocle_apptrace-0.1.0/monocle_trace_file_test_0x8e5ff83c337b2649098910e1db3c8173_2024-08-27.json +0 -24
  24. monocle_apptrace-0.1.0/src/monocle_apptrace/README.md +0 -77
  25. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/.gitignore +0 -0
  26. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/CHANGELOG.md +0 -0
  27. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/CODEOWNERS.md +0 -0
  28. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/CODE_OF_CONDUCT.md +0 -0
  29. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/CONTRIBUTING.md +0 -0
  30. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/COPYRIGHT.template +0 -0
  31. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/LICENSE +0 -0
  32. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/MAINTAINER.md +0 -0
  33. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/Monocle_User_Guide.md +0 -0
  34. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/Monocle_committer_guide.md +0 -0
  35. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/Monocle_contributor_guide.md +0 -0
  36. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/NOTICE +0 -0
  37. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/SECURITY.md +0 -0
  38. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/__init__.py +0 -0
  39. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/constants.py +0 -0
  40. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/exporters/file_exporter.py +0 -0
  41. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/haystack/wrap_node.py +0 -0
  42. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/haystack/wrap_openai.py +0 -0
  43. {monocle_apptrace-0.1.0/src/monocle_apptrace/wrapper_config → monocle_apptrace-0.1.1/src/monocle_apptrace/metamodel/maps}/haystack_methods.json +0 -0
  44. {monocle_apptrace-0.1.0/src/monocle_apptrace/wrapper_config → monocle_apptrace-0.1.1/src/monocle_apptrace/metamodel/maps}/lang_chain_methods.json +0 -0
  45. {monocle_apptrace-0.1.0/src/monocle_apptrace/wrapper_config → monocle_apptrace-0.1.1/src/monocle_apptrace/metamodel/maps}/llama_index_methods.json +0 -0
  46. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/src/monocle_apptrace/wrapper.py +0 -0
  47. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/storage/default__vector_store.json +0 -0
  48. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/storage/docstore.json +0 -0
  49. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/storage/graph_store.json +0 -0
  50. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/storage/image__vector_store.json +0 -0
  51. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/storage/index_store.json +0 -0
  52. {monocle_apptrace-0.1.0 → monocle_apptrace-0.1.1}/tox.ini +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,340 @@
1
+ {
2
+ "_meta": {
3
+ "hash": {
4
+ "sha256": "9983d54227e10d51c4fefdd824534aeacdc6455588151ad04f7853775e91daab"
5
+ },
6
+ "pipfile-spec": 6,
7
+ "requires": {
8
+ "python_version": "3.11"
9
+ },
10
+ "sources": [
11
+ {
12
+ "name": "pypi",
13
+ "url": "https://pypi.org/simple",
14
+ "verify_ssl": true
15
+ }
16
+ ]
17
+ },
18
+ "default": {
19
+ "backports.tarfile": {
20
+ "hashes": [
21
+ "sha256:77e284d754527b01fb1e6fa8a1afe577858ebe4e9dad8919e34c862cb399bc34",
22
+ "sha256:d75e02c268746e1b8144c278978b6e98e85de6ad16f8e4b0844a154557eca991"
23
+ ],
24
+ "markers": "python_version < '3.12'",
25
+ "version": "==1.2.0"
26
+ },
27
+ "build": {
28
+ "hashes": [
29
+ "sha256:526263f4870c26f26c433545579475377b2b7588b6f1eac76a001e873ae3e19d",
30
+ "sha256:75e10f767a433d9a86e50d83f418e83efc18ede923ee5ff7df93b6cb0306c5d4"
31
+ ],
32
+ "index": "pypi",
33
+ "markers": "python_version >= '3.8'",
34
+ "version": "==1.2.1"
35
+ },
36
+ "certifi": {
37
+ "hashes": [
38
+ "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8",
39
+ "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"
40
+ ],
41
+ "markers": "python_version >= '3.6'",
42
+ "version": "==2024.8.30"
43
+ },
44
+ "charset-normalizer": {
45
+ "hashes": [
46
+ "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027",
47
+ "sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087",
48
+ "sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786",
49
+ "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8",
50
+ "sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09",
51
+ "sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185",
52
+ "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574",
53
+ "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e",
54
+ "sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519",
55
+ "sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898",
56
+ "sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269",
57
+ "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3",
58
+ "sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f",
59
+ "sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6",
60
+ "sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8",
61
+ "sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a",
62
+ "sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73",
63
+ "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc",
64
+ "sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714",
65
+ "sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2",
66
+ "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc",
67
+ "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce",
68
+ "sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d",
69
+ "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e",
70
+ "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6",
71
+ "sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269",
72
+ "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96",
73
+ "sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d",
74
+ "sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a",
75
+ "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4",
76
+ "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77",
77
+ "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d",
78
+ "sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0",
79
+ "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed",
80
+ "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068",
81
+ "sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac",
82
+ "sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25",
83
+ "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8",
84
+ "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab",
85
+ "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26",
86
+ "sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2",
87
+ "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db",
88
+ "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f",
89
+ "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5",
90
+ "sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99",
91
+ "sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c",
92
+ "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d",
93
+ "sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811",
94
+ "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa",
95
+ "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a",
96
+ "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03",
97
+ "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b",
98
+ "sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04",
99
+ "sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c",
100
+ "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001",
101
+ "sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458",
102
+ "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389",
103
+ "sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99",
104
+ "sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985",
105
+ "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537",
106
+ "sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238",
107
+ "sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f",
108
+ "sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d",
109
+ "sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796",
110
+ "sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a",
111
+ "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143",
112
+ "sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8",
113
+ "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c",
114
+ "sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5",
115
+ "sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5",
116
+ "sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711",
117
+ "sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4",
118
+ "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6",
119
+ "sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c",
120
+ "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7",
121
+ "sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4",
122
+ "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b",
123
+ "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae",
124
+ "sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12",
125
+ "sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c",
126
+ "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae",
127
+ "sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8",
128
+ "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887",
129
+ "sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b",
130
+ "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4",
131
+ "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f",
132
+ "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5",
133
+ "sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33",
134
+ "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519",
135
+ "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561"
136
+ ],
137
+ "markers": "python_full_version >= '3.7.0'",
138
+ "version": "==3.3.2"
139
+ },
140
+ "docutils": {
141
+ "hashes": [
142
+ "sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f",
143
+ "sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2"
144
+ ],
145
+ "markers": "python_version >= '3.9'",
146
+ "version": "==0.21.2"
147
+ },
148
+ "idna": {
149
+ "hashes": [
150
+ "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac",
151
+ "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"
152
+ ],
153
+ "markers": "python_version >= '3.6'",
154
+ "version": "==3.8"
155
+ },
156
+ "importlib-metadata": {
157
+ "hashes": [
158
+ "sha256:66f342cc6ac9818fc6ff340576acd24d65ba0b3efabb2b4ac08b598965a4a2f1",
159
+ "sha256:9a547d3bc3608b025f93d403fdd1aae741c24fbb8314df4b155675742ce303c5"
160
+ ],
161
+ "markers": "python_version >= '3.8'",
162
+ "version": "==8.4.0"
163
+ },
164
+ "jaraco.classes": {
165
+ "hashes": [
166
+ "sha256:47a024b51d0239c0dd8c8540c6c7f484be3b8fcf0b2d85c13825780d3b3f3acd",
167
+ "sha256:f662826b6bed8cace05e7ff873ce0f9283b5c924470fe664fff1c2f00f581790"
168
+ ],
169
+ "markers": "python_version >= '3.8'",
170
+ "version": "==3.4.0"
171
+ },
172
+ "jaraco.context": {
173
+ "hashes": [
174
+ "sha256:9bae4ea555cf0b14938dc0aee7c9f32ed303aa20a3b73e7dc80111628792d1b3",
175
+ "sha256:f797fc481b490edb305122c9181830a3a5b76d84ef6d1aef2fb9b47ab956f9e4"
176
+ ],
177
+ "markers": "python_version >= '3.8'",
178
+ "version": "==6.0.1"
179
+ },
180
+ "jaraco.functools": {
181
+ "hashes": [
182
+ "sha256:3460c74cd0d32bf82b9576bbb3527c4364d5b27a21f5158a62aed6c4b42e23f5",
183
+ "sha256:c9d16a3ed4ccb5a889ad8e0b7a343401ee5b2a71cee6ed192d3f68bc351e94e3"
184
+ ],
185
+ "markers": "python_version >= '3.8'",
186
+ "version": "==4.0.2"
187
+ },
188
+ "keyring": {
189
+ "hashes": [
190
+ "sha256:8d85a1ea5d6db8515b59e1c5d1d1678b03cf7fc8b8dcfb1651e8c4a524eb42ef",
191
+ "sha256:8d963da00ccdf06e356acd9bf3b743208878751032d8599c6cc89eb51310ffae"
192
+ ],
193
+ "markers": "python_version >= '3.8'",
194
+ "version": "==25.3.0"
195
+ },
196
+ "markdown-it-py": {
197
+ "hashes": [
198
+ "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1",
199
+ "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"
200
+ ],
201
+ "markers": "python_version >= '3.8'",
202
+ "version": "==3.0.0"
203
+ },
204
+ "mdurl": {
205
+ "hashes": [
206
+ "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8",
207
+ "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"
208
+ ],
209
+ "markers": "python_version >= '3.7'",
210
+ "version": "==0.1.2"
211
+ },
212
+ "more-itertools": {
213
+ "hashes": [
214
+ "sha256:0f7d9f83a0a8dcfa8a2694a770590d98a67ea943e3d9f5298309a484758c4e27",
215
+ "sha256:fe0e63c4ab068eac62410ab05cccca2dc71ec44ba8ef29916a0090df061cf923"
216
+ ],
217
+ "markers": "python_version >= '3.8'",
218
+ "version": "==10.4.0"
219
+ },
220
+ "nh3": {
221
+ "hashes": [
222
+ "sha256:0411beb0589eacb6734f28d5497ca2ed379eafab8ad8c84b31bb5c34072b7164",
223
+ "sha256:14c5a72e9fe82aea5fe3072116ad4661af5cf8e8ff8fc5ad3450f123e4925e86",
224
+ "sha256:19aaba96e0f795bd0a6c56291495ff59364f4300d4a39b29a0abc9cb3774a84b",
225
+ "sha256:34c03fa78e328c691f982b7c03d4423bdfd7da69cd707fe572f544cf74ac23ad",
226
+ "sha256:36c95d4b70530b320b365659bb5034341316e6a9b30f0b25fa9c9eff4c27a204",
227
+ "sha256:3a157ab149e591bb638a55c8c6bcb8cdb559c8b12c13a8affaba6cedfe51713a",
228
+ "sha256:42c64511469005058cd17cc1537578eac40ae9f7200bedcfd1fc1a05f4f8c200",
229
+ "sha256:5f36b271dae35c465ef5e9090e1fdaba4a60a56f0bb0ba03e0932a66f28b9189",
230
+ "sha256:6955369e4d9f48f41e3f238a9e60f9410645db7e07435e62c6a9ea6135a4907f",
231
+ "sha256:7b7c2a3c9eb1a827d42539aa64091640bd275b81e097cd1d8d82ef91ffa2e811",
232
+ "sha256:8ce0f819d2f1933953fca255db2471ad58184a60508f03e6285e5114b6254844",
233
+ "sha256:94a166927e53972a9698af9542ace4e38b9de50c34352b962f4d9a7d4c927af4",
234
+ "sha256:a7f1b5b2c15866f2db413a3649a8fe4fd7b428ae58be2c0f6bca5eefd53ca2be",
235
+ "sha256:c8b3a1cebcba9b3669ed1a84cc65bf005728d2f0bc1ed2a6594a992e817f3a50",
236
+ "sha256:de3ceed6e661954871d6cd78b410213bdcb136f79aafe22aa7182e028b8c7307",
237
+ "sha256:f0eca9ca8628dbb4e916ae2491d72957fdd35f7a5d326b7032a345f111ac07fe"
238
+ ],
239
+ "version": "==0.2.18"
240
+ },
241
+ "packaging": {
242
+ "hashes": [
243
+ "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002",
244
+ "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"
245
+ ],
246
+ "markers": "python_version >= '3.8'",
247
+ "version": "==24.1"
248
+ },
249
+ "pkginfo": {
250
+ "hashes": [
251
+ "sha256:5df73835398d10db79f8eecd5cd86b1f6d29317589ea70796994d49399af6297",
252
+ "sha256:889a6da2ed7ffc58ab5b900d888ddce90bce912f2d2de1dc1c26f4cb9fe65097"
253
+ ],
254
+ "markers": "python_version >= '3.6'",
255
+ "version": "==1.10.0"
256
+ },
257
+ "pygments": {
258
+ "hashes": [
259
+ "sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199",
260
+ "sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a"
261
+ ],
262
+ "markers": "python_version >= '3.8'",
263
+ "version": "==2.18.0"
264
+ },
265
+ "pyproject-hooks": {
266
+ "hashes": [
267
+ "sha256:4b37730834edbd6bd37f26ece6b44802fb1c1ee2ece0e54ddff8bfc06db86965",
268
+ "sha256:7ceeefe9aec63a1064c18d939bdc3adf2d8aa1988a510afec15151578b232aa2"
269
+ ],
270
+ "markers": "python_version >= '3.7'",
271
+ "version": "==1.1.0"
272
+ },
273
+ "readme-renderer": {
274
+ "hashes": [
275
+ "sha256:2fbca89b81a08526aadf1357a8c2ae889ec05fb03f5da67f9769c9a592166151",
276
+ "sha256:8712034eabbfa6805cacf1402b4eeb2a73028f72d1166d6f5cb7f9c047c5d1e1"
277
+ ],
278
+ "markers": "python_version >= '3.9'",
279
+ "version": "==44.0"
280
+ },
281
+ "requests": {
282
+ "hashes": [
283
+ "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760",
284
+ "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"
285
+ ],
286
+ "markers": "python_version >= '3.8'",
287
+ "version": "==2.32.3"
288
+ },
289
+ "requests-toolbelt": {
290
+ "hashes": [
291
+ "sha256:7681a0a3d047012b5bdc0ee37d7f8f07ebe76ab08caeccfc3921ce23c88d5bc6",
292
+ "sha256:cccfdd665f0a24fcf4726e690f65639d272bb0637b9b92dfd91a5568ccf6bd06"
293
+ ],
294
+ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
295
+ "version": "==1.0.0"
296
+ },
297
+ "rfc3986": {
298
+ "hashes": [
299
+ "sha256:50b1502b60e289cb37883f3dfd34532b8873c7de9f49bb546641ce9cbd256ebd",
300
+ "sha256:97aacf9dbd4bfd829baad6e6309fa6573aaf1be3f6fa735c8ab05e46cecb261c"
301
+ ],
302
+ "markers": "python_version >= '3.7'",
303
+ "version": "==2.0.0"
304
+ },
305
+ "rich": {
306
+ "hashes": [
307
+ "sha256:2e85306a063b9492dffc86278197a60cbece75bcb766022f3436f567cae11bdc",
308
+ "sha256:a5ac1f1cd448ade0d59cc3356f7db7a7ccda2c8cbae9c7a90c28ff463d3e91f4"
309
+ ],
310
+ "markers": "python_full_version >= '3.7.0'",
311
+ "version": "==13.8.0"
312
+ },
313
+ "twine": {
314
+ "hashes": [
315
+ "sha256:215dbe7b4b94c2c50a7315c0275d2258399280fbb7d04182c7e55e24b5f93997",
316
+ "sha256:9aa0825139c02b3434d913545c7b847a21c835e11597f5255842d457da2322db"
317
+ ],
318
+ "index": "pypi",
319
+ "markers": "python_version >= '3.8'",
320
+ "version": "==5.1.1"
321
+ },
322
+ "urllib3": {
323
+ "hashes": [
324
+ "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472",
325
+ "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"
326
+ ],
327
+ "markers": "python_version >= '3.8'",
328
+ "version": "==2.2.2"
329
+ },
330
+ "zipp": {
331
+ "hashes": [
332
+ "sha256:9960cd8967c8f85a56f920d5d507274e74f9ff813a0ab8889a5b5be2daf44064",
333
+ "sha256:c22b14cc4763c5a5b04134207736c107db42e9d3ef2d9779d465f5f1bcba572b"
334
+ ],
335
+ "markers": "python_version >= '3.8'",
336
+ "version": "==3.20.1"
337
+ }
338
+ },
339
+ "develop": {}
340
+ }
@@ -0,0 +1,76 @@
1
+ # Monocle for tracing GenAI app code
2
+
3
+ **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.
4
+
5
+ **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/).
6
+
7
+ ## Why Monocle
8
+
9
+ Monocle is built for:
10
+ - **app developers** to trace their app code in any environment without lots of custom code decoration
11
+ - **platform engineers** to instrument apps in prod through wrapping instead of asking app devs to recode
12
+ - **GenAI component providers** to add observability features to their products
13
+ - **enterprises** to consume traces from GenAI apps in their existing open-source observability stack
14
+
15
+ Benefits:
16
+ - Monocle provides an implementation + package, not just a spec
17
+ - No expertise in OpenTelemetry spec required
18
+ - No bespoke implementation of that spec required
19
+ - No last-mile GenAI domain specific code required to instrument your app
20
+ - Monocle provides consistency
21
+ - Connect traces across app code executions, model inference or data retrievals
22
+ - No cleansing of telemetry data across GenAI component providers required
23
+ - Works the same in personal lab dev or org cloud prod environments
24
+ - Send traces to location that fits your scale, budget and observability stack
25
+ - Monocle is fully open source and community driven
26
+ - No vendor lock-in
27
+ - Implementation is transparent
28
+ - You can freely use or customize it to fit your needs
29
+
30
+ ## What Monocle provides
31
+
32
+ - Easy to [use](#use-monocle) code instrumentation
33
+ - OpenTelemetry compatible format for [spans](src/monocle_apptrace/metamodel/spans/span_format.json).
34
+ - Community-curated and extensible [metamodel](src/monocle_apptrace/metamodel/README.md) for consisent tracing of GenAI components.
35
+ - Export to local and cloud storage
36
+
37
+ ## Use Monocle
38
+
39
+ - Get the Monocle package
40
+
41
+ ```
42
+ pip install monocle_apptrace
43
+ ```
44
+ - Instrument your app code
45
+ - Import the Monocle package
46
+ ```
47
+ from monocle_apptrace.instrumentor import setup_monocle_telemetry
48
+ ```
49
+ - Setup instrumentation in your ```main()``` function
50
+ ```
51
+ setup_monocle_telemetry(workflow_name="your-app-name")
52
+ ```
53
+ - (Optionally) Modify config to alter where traces are sent
54
+
55
+ See [Monocle user guide](Monocle_User_Guide.md) for more details.
56
+
57
+
58
+ ## Roadmap
59
+
60
+ 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*.
61
+
62
+ Current version supports:
63
+ - Language: (🟢) Python , (🔜) [Typescript](https://github.com/monocle2ai/monocle-typescript)
64
+ - LLM-frameworks: (🟢) Langchain, (🟢) Llamaindex, (🟢) Haystack, (🔜) Flask
65
+ - LLM inference providers: (🟢) OpenAI, (🟢) Azure OpenAI, (🟢) Nvidia Triton, (🔜) AWS Bedrock, (🔜) Google Vertex, (🔜) Azure ML, (🔜) Hugging Face
66
+ - Vector stores: (🟢) FAISS, (🔜) OpenSearch, (🔜) Milvus
67
+ - Exporter: (🟢) stdout, (🟢) file, (🔜) Azure Blob Storage, (🔜) AWS S3, (🔜) Google Cloud Storage
68
+
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
+
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "monocle_apptrace"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  authors = []
9
9
  description = "package with monocle genAI tracing"
10
10
  readme = "README.md"
@@ -0,0 +1,101 @@
1
+ ## Monocle Concepts
2
+
3
+ ### Traces
4
+ Traces are the full view of a single end-to-end application execution.
5
+
6
+ Examples of traces include one response to end user’s question by a chatbot app. Traces consists of various metadata about the application run including status, start time, duration, input/outputs etc. It also includes a list of individual steps aka “spans with details about that step.It’s typically the workflow code components of an application that generate the traces for application runs.
7
+
8
+ Traces are collections of spans.
9
+
10
+ ### Spans
11
+ Spans are the individual steps executed by the application to perform a GenAI related task.
12
+
13
+ Examples of spans include app retrieving vectors from DB, app querying LLM for inference etc. The span includes the type of operation, start time, duration and metadata relevant to that step eg Model name, parameters and model endpoint/server for an inference request.
14
+
15
+ ## Contribute to Monocle
16
+
17
+ Monocle includes:
18
+ - Methods for instrumentation of app code
19
+ - Base code for wrapping methods of interest in included in current folder
20
+ - Framework specific code is organized in a folder with the framework name
21
+ - Metamodel for how attributes and events for GenAI components are represented in OpenTelemety format
22
+ - See [metamodel](./metamodel/README.md) for supported GenAI entities, how functions operating on those entities map to spans and format of spans
23
+ - Exporters to send trace data to various locations. See [exporters](./exporters)
24
+
25
+ See [Monocle committer guide](/Monocle_committer_guide.md).
26
+
27
+ ## Get Monocle
28
+
29
+ Option 1 - Download released packages from Pypi
30
+ ```
31
+ python3 -m pip install pipenv
32
+ pip install monocle-apptrace
33
+ ```
34
+
35
+ Option 2 - Build and install locally from source
36
+ ```
37
+ pip install .
38
+ pip install -e ".[dev]"
39
+
40
+ python3 -m pip install pipenv
41
+ pipenv install build
42
+ ```
43
+
44
+ ## Examples of app instrumentation with Monocle
45
+
46
+ ### apps written using LLM orchestration frameworks
47
+
48
+ ```python
49
+ from langchain.chains import LLMChain
50
+ from langchain_openai import OpenAI
51
+ from langchain.prompts import PromptTemplate
52
+
53
+ # Import the monocle_apptrace instrumentation method
54
+ from monocle_apptrace.instrumentor import setup_monocle_telemetry
55
+ from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter
56
+
57
+ # Call the setup Monocle telemetry method
58
+ setup_monocle_telemetry(workflow_name = "simple_math_app",
59
+ span_processors=[BatchSpanProcessor(ConsoleSpanExporter())])
60
+
61
+ llm = OpenAI()
62
+ prompt = PromptTemplate.from_template("1 + {number} = ")
63
+
64
+ chain = LLMChain(llm=llm, prompt=prompt)
65
+ chain.invoke({"number":2})
66
+
67
+ # Trace is generated when invoke() method is called
68
+
69
+ ```
70
+
71
+ ### apps with custom methods
72
+
73
+ ```python
74
+
75
+ # Import the monocle_apptrace instrumentation method
76
+ from monocle_apptrace.wrapper import WrapperMethod,task_wrapper,atask_wrapper
77
+ from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter
78
+
79
+ # Extend the default wrapped methods list as follows
80
+ app_name = "simple_math_app"
81
+ setup_monocle_telemetry(
82
+ workflow_name=app_name,
83
+ span_processors=[BatchSpanProcessor(ConsoleSpanExporter())],
84
+ wrapper_methods=[
85
+ WrapperMethod(
86
+ package="langchain.schema.runnable",
87
+ object_name="RunnableParallel",
88
+ method="invoke",
89
+ span_name="langchain.workflow",
90
+ wrapper=task_wrapper),
91
+ WrapperMethod(
92
+ package="langchain.schema.runnable",
93
+ object_name="RunnableParallel",
94
+ method="ainvoke",
95
+ span_name="langchain.workflow",
96
+ wrapper=atask_wrapper)
97
+ ])
98
+
99
+ # Trace is generated when the invoke() method is called in langchain.schema.runnable package
100
+
101
+ ```
@@ -6,4 +6,4 @@ from monocle_apptrace.utils import load_wrapper_from_config
6
6
  logger = logging.getLogger(__name__)
7
7
  parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
8
8
  HAYSTACK_METHODS = load_wrapper_from_config(
9
- os.path.join(parent_dir, 'wrapper_config', 'haystack_methods.json'))
9
+ os.path.join(parent_dir, 'metamodel', 'maps', 'haystack_methods.json'))