File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1818except ImportError :
1919 raise DidNotEnable ("LiteLLM not installed" )
2020
21+ _CALL_TYPE_TO_OPERATION = {
22+ "embedding" : "embeddings" ,
23+ "completion" : "chat" ,
24+ }
25+
2126
2227def _get_metadata_dict (kwargs ):
2328 # type: (Dict[str, Any]) -> Dict[str, Any]
@@ -48,8 +53,11 @@ def _input_callback(kwargs):
4853 model = full_model
4954 provider = "unknown"
5055
51- messages = kwargs .get ("messages" , [])
52- operation = "chat" if messages else "embeddings"
56+ call_type = kwargs .get ("call_type" , None )
57+ if call_type not in _CALL_TYPE_TO_OPERATION :
58+ return
59+
60+ operation = _CALL_TYPE_TO_OPERATION [call_type ]
5361
5462 # Start a new span/transaction
5563 span = get_start_span_function ()(
@@ -71,6 +79,7 @@ def _input_callback(kwargs):
7179 set_data_normalized (span , SPANDATA .GEN_AI_OPERATION_NAME , operation )
7280
7381 # Record messages if allowed
82+ messages = kwargs .get ("messages" , [])
7483 if messages and should_send_default_pii () and integration .include_prompts :
7584 set_data_normalized (
7685 span , SPANDATA .GEN_AI_REQUEST_MESSAGES , messages , unpack = False
You can’t perform that action at this time.
0 commit comments