-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
628 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Monocle metamodel | ||
|
||
## Overview | ||
Monocle metamodel is the way to manage standardization across all supported GenAI component stack. It includes the list of components that Monocle can identify and extract metadata. This help understanding and analyzing the traces from applications that include multiple components and can evolve over time. This is one of core value that Monocle provides to it's user community. | ||
|
||
## Meta model | ||
The Monocle metamodel comprises of three things, | ||
- Entity types, definitions of technology types and supported vendor implementations. | ||
- A JSON format that overlays on top of Open Telemetry tracing format that includes the common attributes for each entity type. | ||
- Map of component menthods to trace with instrumentation methods provided by Monocle. | ||
|
||
### Entity type | ||
The entity type defines the type of GenAI component that Monocle understand. The monocle instrumentation can extract the relevenat information for this entity. There are a fixed set of [entity types](./entity_types.py) that are defined by Monocle out of the box, eg workflow, model etc. As the GenAI landscape evolves, the Monocle community will introduce a new entity type if the current entities won't represent a new technology component. | ||
Each entity types has number of supported technology components that Monocle handles out of the box, eg. LlamaIndex is a supported workflow. Monocle community will continue to expand the breadth of the project by adding more components. | ||
|
||
### Span types | ||
The GenAI application have specific [types of spans](./spans/README.md#span-types-and-events) where diffrent entities integrate. Monocle metamodel defines these types and specifies format for tracing data and metadata generated in such spans. | ||
|
||
### Consistent trace format | ||
Monocle generates [traces](../../../Monocle_User_Guide.md#traces) which comprises of [spans](../../../Monocle_User_Guide.md#spans). Note that Monocle trace is [OpenTelemetry format](https://opentelemetry.io/docs/concepts/signals/traces/) compatible. Each span is essentially a step in the execution that interacts with one of more GenAI technology components. The please refer to the [full spec of the json format](./span_format.json) and a detailed [example](./span_example.json). | ||
The ```attribute``` section of the span includes a list of such entities that are used in that span. | ||
The runtime data and metadata collected during the execution of that span are included in the ```events``` section of the trace (as per the Otel spec). Each entry in the event corrosponds to the entity involved in that trace execution if it has produced any runtime outputs. | ||
Please see the [span format](./spans/README.md) for details. | ||
|
||
### Instrumentation method map | ||
The map dectates what Monocle tracing method is relevant for the a given GenAI tech component method/API. It also specifies the name for that span to set in the trace output. | ||
```python | ||
{ | ||
"package": "llama_index.core.base.base_query_engine", | ||
"object": "BaseQueryEngine", | ||
"method": "query", | ||
"span_name": "llamaindex.query", | ||
"wrapper_package": "wrap_common", | ||
"wrapper_method": "task_wrapper" | ||
} | ||
``` | ||
|
||
## Extending the meta model | ||
Monocle is highly extensible. This section describe when one would need to extend the meta model. Please refer to Monocle [User guide](../../../Monocle_User_Guide.md) and [Contributor guide](../../../Monocle_contributor_guide.md) for detailed steps. | ||
### Trace a new method/API | ||
If you have overloaded an existing functionality in one of the supported components by creating a new function. Monocle doesn't know that this function should be traced, say because it's calling an LLM. You could define a new mapping so Monocle instrumentation can trace this function the say way it handles other LLM invocation functions. | ||
|
||
### Adding a new component provider | ||
Let's say there's a new database that supports vector search capability which is not supported by the Monocle. In this case, first you'll need to add that database under the ``MonocleEntity.VectorDB`` list. Then you'll need to extend the method map and test if the existing Monocle tracing functions has logic to effectively trace the new component. If not, then you might need to implement new method to cover the gap and update the mapping table according. | ||
|
||
### Support new type of entity | ||
If there's new component that can't be mapped to any of the existing entity types, then it'll require extending the metamodel and implement new instrumetation to support it. We recommend you initiate a discussion with Monocle community to add the support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Monocle Entities | ||
The entity type defines the type of GenAI component that Monocle understand. The monocle instrumentation can extract the relevenat information for this entity. There are a fixed set of [entity types](./entity_types.py) that are defined by Monocle out of the box, eg workflow, model etc. As the GenAI landscape evolves, the Monocle community will introduce a new entity type if the current entities won't represent a new technology component. | ||
|
||
## Entity Types | ||
Following attributes are supported for all entities | ||
| Name | Description | Required | | ||
| - | - | - | | ||
| name | Entity name generated by Monocle | Required | | ||
| type | Monocle Entity type | True | | ||
|
||
### MonocleEntity.Workflow | ||
Workflow ie the core application code. Supported types are - | ||
- generic | ||
- langchain | ||
- llama_index | ||
- haystack | ||
|
||
### MonocleEntity.Model | ||
GenAI models. Supported types are - | ||
- generic | ||
- llm | ||
- embedding | ||
Following attributes are supported for all model type entities | ||
| Name | Description | Required | | ||
| - | - | - | | ||
| model_name | Name of model | True | | ||
|
||
|
||
### MonocleEntity.AppHosting | ||
Application host services where the workflow code is run. Supported types are - | ||
- generic | ||
- aws_lambda | ||
- aws_sagemaker | ||
- azure_func | ||
- github_codespace | ||
- azure_mlw | ||
|
||
### MonocleEntity.Inference | ||
The model hosting infrastructure services. Supported types are - | ||
- generic | ||
- nvidia_triton | ||
- openai | ||
- azure_oai | ||
- aws_sagemaker | ||
- aws_bedrock | ||
- hugging_face | ||
|
||
### MonocleEntity.VectorStore | ||
Vector search data stores. Supported types are - | ||
- generic | ||
- chroma | ||
- aws_es | ||
- milvus | ||
- pinecone |
157 changes: 157 additions & 0 deletions
157
src/monocle_apptrace/metamodel/entities/entity_types.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
{ | ||
"description": "Monocle entities represents kinds GenAI technology components and their implementations supported by Monocle", | ||
"monocle_entities": [ | ||
{ | ||
"attributes" : [ | ||
{ | ||
"attribute_name": "name", | ||
"attribute_description": "Monocle entity name", | ||
"required": true | ||
}, | ||
{ | ||
"attribute_name": "type", | ||
"attribute_description": "Monocle entity type", | ||
"required": true | ||
} | ||
], | ||
"entities": [ | ||
{ | ||
"name": "workflow", | ||
"attributes" : [], | ||
"types": [ | ||
{ | ||
"type": "llama_index", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "langchain", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "haystack", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "generic", | ||
"attributes" : [] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "model", | ||
"attributes" : [ | ||
{ | ||
"attribute_name": "model_name", | ||
"attribute_description": "Model name", | ||
"required": true | ||
} | ||
], | ||
"types": [ | ||
{ | ||
"type": "llm", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "embedding", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "generic", | ||
"attributes" : [] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "vector_store", | ||
"attributes" : [], | ||
"types": [ | ||
{ | ||
"type": "chroma", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "aws_es", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "milvus", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "pinecone", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "generic", | ||
"attributes" : [] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "app_hosting", | ||
"attributes" : [], | ||
"types": [ | ||
{ | ||
"type": "aws_lambda", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "aws_sagemaker", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "azure_func", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "azure_mlw", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "github_codespace", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "generic", | ||
"attributes" : [] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "inference", | ||
"attributes" : [], | ||
"types": [ | ||
{ | ||
"type": "aws_sagemaker", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "aws_bedrock", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "azure_oai", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "openai", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "nvidia_triton", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "hugging_face", | ||
"attributes" : [] | ||
}, | ||
{ | ||
"type": "generic", | ||
"attributes" : [] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Monocle meta model: | ||
# Monocle Entities --> Entity Type --> Entity | ||
|
||
import enum | ||
|
||
class MonocleEntity(enum): | ||
# Supported Workflow/language frameworks | ||
class Workflow(enum): | ||
generic = 0 | ||
langchain = 1 | ||
llama_index = 2 | ||
haystack = 3 | ||
|
||
# Supported model types | ||
class Model(enum): | ||
generic = 0 | ||
llm = 1 | ||
embedding = 2 | ||
|
||
# Support Vector databases | ||
class VectorStore(enum): | ||
generic = 0 | ||
chroma = 1 | ||
aws_es = 2 | ||
Milvus = 3 | ||
Pinecone = 4 | ||
|
||
# Support application hosting frameworks | ||
class AppHosting(enum): | ||
generic = 0 | ||
aws_lambda = 1 | ||
aws_sagemaker = 2 | ||
azure_func = 3 | ||
github_codespace = 4 | ||
azure_mlw = 5 | ||
|
||
# Supported inference infra/services | ||
class Inference(enum): | ||
generic = 0 | ||
nvidia_triton = 1 | ||
openai = 2 | ||
azure_oai = 3 | ||
aws_sagemaker = 4 | ||
aws_bedrock = 5 | ||
hugging_face = 6 | ||
|
||
class SpanType(enum): | ||
internal = 0 | ||
retrieval = 2 | ||
inference = 3 | ||
workflow = 4 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.