-
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.
metamodel based span/trace format supported for llamaindex, langchain --------- Signed-off-by: sachintendulkar576123 <[email protected]>
- Loading branch information
1 parent
46437ab
commit 850dfef
Showing
17 changed files
with
757 additions
and
367 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
|
||
import os | ||
import logging | ||
from monocle_apptrace.utils import load_wrapper_from_config | ||
from monocle_apptrace.utils import get_wrapper_methods_config | ||
|
||
logger = logging.getLogger(__name__) | ||
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
HAYSTACK_METHODS = load_wrapper_from_config( | ||
os.path.join(parent_dir, 'metamodel', 'maps', 'haystack_methods.json')) | ||
HAYSTACK_METHODS = get_wrapper_methods_config( | ||
wrapper_methods_config_path=os.path.join(parent_dir, 'metamodel', 'maps', 'haystack_methods.json'), | ||
attributes_config_base_path=os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) |
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import os | ||
from monocle_apptrace.utils import load_wrapper_from_config | ||
from monocle_apptrace.utils import get_wrapper_methods_config | ||
|
||
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
LANGCHAIN_METHODS = load_wrapper_from_config( | ||
os.path.join(parent_dir, 'metamodel', 'maps', 'lang_chain_methods.json')) | ||
LANGCHAIN_METHODS = get_wrapper_methods_config( | ||
wrapper_methods_config_path=os.path.join(parent_dir, 'metamodel', 'maps', 'langchain_methods.json'), | ||
attributes_config_base_path=os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) | ||
|
||
|
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 |
---|---|---|
@@ -1,15 +1,16 @@ | ||
|
||
#pylint: disable=protected-access | ||
# pylint: disable=protected-access | ||
import os | ||
from monocle_apptrace.utils import load_wrapper_from_config | ||
from monocle_apptrace.utils import get_wrapper_methods_config | ||
|
||
|
||
def get_llm_span_name_for_openai(instance): | ||
if (hasattr(instance, "_is_azure_client") | ||
and callable(getattr(instance, "_is_azure_client")) | ||
and instance._is_azure_client()): | ||
and callable(getattr(instance, "_is_azure_client")) | ||
and instance._is_azure_client()): | ||
return "llamaindex.azure_openai" | ||
return "llamaindex.openai" | ||
|
||
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
LLAMAINDEX_METHODS = load_wrapper_from_config( | ||
os.path.join(parent_dir, 'metamodel', 'maps', 'llama_index_methods.json')) | ||
LLAMAINDEX_METHODS = get_wrapper_methods_config( | ||
wrapper_methods_config_path=os.path.join(parent_dir, 'metamodel', 'maps', 'llamaindex_methods.json'), | ||
attributes_config_base_path=os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) |
39 changes: 39 additions & 0 deletions
39
src/monocle_apptrace/metamodel/maps/attributes/inference/langchain_entities.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,39 @@ | ||
{ | ||
"type": "inference", | ||
"attributes": [ | ||
[ | ||
{ | ||
"_comment": "provider type ,name , deployment , inference_endpoint", | ||
"attribute": "type", | ||
"accessor": "lambda instance,args:'inference.azure_oai'" | ||
}, | ||
{ | ||
"attribute": "provider_name", | ||
"accessor": "lambda instance,args:args['provider_name']" | ||
}, | ||
{ | ||
"attribute": "deployment", | ||
"accessor": "lambda instance,args: resolve_from_alias(instance.__dict__, ['engine', 'azure_deployment', 'deployment_name', 'deployment_id', 'deployment'])" | ||
}, | ||
{ | ||
"attribute": "inference_endpoint", | ||
"accessor": "lambda instance,args: resolve_from_alias(instance.__dict__, ['azure_endpoint', 'api_base'])" | ||
} | ||
], | ||
[ | ||
{ | ||
"_comment": "LLM Model", | ||
"attribute": "name", | ||
"accessor": "lambda instance,args: resolve_from_alias(instance.__dict__, ['model', 'model_name'])" | ||
}, | ||
{ | ||
"attribute": "type", | ||
"accessor": "lambda instance,args: 'model.llm'" | ||
}, | ||
{ | ||
"attribute": "model_name", | ||
"accessor": "lambda instance,args: resolve_from_alias(instance.__dict__, ['model', 'model_name'])" | ||
} | ||
] | ||
] | ||
} |
39 changes: 39 additions & 0 deletions
39
src/monocle_apptrace/metamodel/maps/attributes/inference/llamaindex_entities.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,39 @@ | ||
{ | ||
"type": "inference", | ||
"attributes": [ | ||
[ | ||
{ | ||
"_comment": "provider type ,name , deployment , inference_endpoint", | ||
"attribute": "type", | ||
"accessor": "lambda instance,args:'inference.azure_oai'" | ||
}, | ||
{ | ||
"attribute": "provider_name", | ||
"accessor": "lambda instance,args:args['provider_name']" | ||
}, | ||
{ | ||
"attribute": "deployment", | ||
"accessor": "lambda instance,args: resolve_from_alias(instance.__dict__, ['engine', 'azure_deployment', 'deployment_name', 'deployment_id', 'deployment'])" | ||
}, | ||
{ | ||
"attribute": "inference_endpoint", | ||
"accessor": "lambda instance,args: resolve_from_alias(instance.__dict__, ['azure_endpoint', 'api_base'])" | ||
} | ||
], | ||
[ | ||
{ | ||
"_comment": "LLM Model", | ||
"attribute": "name", | ||
"accessor": "lambda instance,args: resolve_from_alias(instance.__dict__, ['model', 'model_name'])" | ||
}, | ||
{ | ||
"attribute": "type", | ||
"accessor": "lambda instance,args: 'model.llm'" | ||
}, | ||
{ | ||
"attribute": "model_name", | ||
"accessor": "lambda instance,args: resolve_from_alias(instance.__dict__, ['model', 'model_name'])" | ||
} | ||
] | ||
] | ||
} |
35 changes: 35 additions & 0 deletions
35
src/monocle_apptrace/metamodel/maps/attributes/retrieval/langchain_entities.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,35 @@ | ||
{ | ||
"type": "retrieval", | ||
"attributes": [ | ||
[ | ||
{ | ||
"_comment": "vector store name and type", | ||
"attribute": "name", | ||
"accessor": "lambda instance,args: type(instance.vectorstore).__name__" | ||
}, | ||
{ | ||
"attribute": "type", | ||
"accessor": "lambda instance,args: 'vectorstore.'+type(instance.vectorstore).__name__" | ||
}, | ||
{ | ||
"attribute": "embedding_model_name", | ||
"accessor": "lambda instance,args: instance.vectorstore.embeddings.model" | ||
} | ||
], | ||
[ | ||
{ | ||
"_comment": "embedding model name and type", | ||
"attribute": "name", | ||
"accessor": "lambda instance,args: instance.vectorstore.embeddings.model" | ||
}, | ||
{ | ||
"attribute": "type", | ||
"accessor": "lambda instance ,args: 'model.embedding'" | ||
}, | ||
{ | ||
"attribute": "model_name", | ||
"accessor": "lambda instance,args: instance.vectorstore.embeddings.model" | ||
} | ||
] | ||
] | ||
} |
35 changes: 35 additions & 0 deletions
35
src/monocle_apptrace/metamodel/maps/attributes/retrieval/llamaindex_entities.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,35 @@ | ||
{ | ||
"type": "retrieval", | ||
"attributes": [ | ||
[ | ||
{ | ||
"_comment": "vector store name and type", | ||
"attribute": "name", | ||
"accessor": "lambda instance,args: type(instance._vector_store).__name__" | ||
}, | ||
{ | ||
"attribute": "type", | ||
"accessor": "lambda instance,args: 'vectorstore.'+type(instance._vector_store).__name__" | ||
}, | ||
{ | ||
"attribute": "embedding_model_name", | ||
"accessor": "lambda instance,args: instance._embed_model.model_name" | ||
} | ||
], | ||
[ | ||
{ | ||
"_comment": "embedding model name and type", | ||
"attribute": "name", | ||
"accessor": "lambda instance,args: instance._embed_model.model_name" | ||
}, | ||
{ | ||
"attribute": "type", | ||
"accessor": "lambda instance ,args: 'model.embedding'" | ||
}, | ||
{ | ||
"attribute": "model_name", | ||
"accessor": "lambda instance,args: instance._embed_model.model_name" | ||
} | ||
] | ||
] | ||
} |
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
Oops, something went wrong.