Skip to content

Commit 6ed7261

Browse files
ishaan-jaffialisaleh
authored andcommitted
feat: Added Missing Attributes For Arize & Phoenix Integration (BerriAI#10043) (BerriAI#10215)
* feat: Added Missing Attributes For Arize & Phoenix Integration * chore: Added noqa for PLR0915 to suppress warning * chore: Moved Contributor Test to Correct Location * chore: Removed Redundant Fallback Co-authored-by: Ali Saleh <[email protected]>
1 parent aba37e9 commit 6ed7261

File tree

4 files changed

+535
-151
lines changed

4 files changed

+535
-151
lines changed

litellm/integrations/_types/open_inference.py

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ class SpanAttributes:
4545
"""
4646
The name of the model being used.
4747
"""
48+
LLM_PROVIDER = "llm.provider"
49+
"""
50+
The provider of the model, such as OpenAI, Azure, Google, etc.
51+
"""
52+
LLM_SYSTEM = "llm.system"
53+
"""
54+
The AI product as identified by the client or server
55+
"""
4856
LLM_PROMPTS = "llm.prompts"
4957
"""
5058
Prompts provided to a completions API.
@@ -65,15 +73,40 @@ class SpanAttributes:
6573
"""
6674
Number of tokens in the prompt.
6775
"""
76+
LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_WRITE = "llm.token_count.prompt_details.cache_write"
77+
"""
78+
Number of tokens in the prompt that were written to cache.
79+
"""
80+
LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_READ = "llm.token_count.prompt_details.cache_read"
81+
"""
82+
Number of tokens in the prompt that were read from cache.
83+
"""
84+
LLM_TOKEN_COUNT_PROMPT_DETAILS_AUDIO = "llm.token_count.prompt_details.audio"
85+
"""
86+
The number of audio input tokens presented in the prompt
87+
"""
6888
LLM_TOKEN_COUNT_COMPLETION = "llm.token_count.completion"
6989
"""
7090
Number of tokens in the completion.
7191
"""
92+
LLM_TOKEN_COUNT_COMPLETION_DETAILS_REASONING = "llm.token_count.completion_details.reasoning"
93+
"""
94+
Number of tokens used for reasoning steps in the completion.
95+
"""
96+
LLM_TOKEN_COUNT_COMPLETION_DETAILS_AUDIO = "llm.token_count.completion_details.audio"
97+
"""
98+
The number of audio input tokens generated by the model
99+
"""
72100
LLM_TOKEN_COUNT_TOTAL = "llm.token_count.total"
73101
"""
74102
Total number of tokens, including both prompt and completion.
75103
"""
76104

105+
LLM_TOOLS = "llm.tools"
106+
"""
107+
List of tools that are advertised to the LLM to be able to call
108+
"""
109+
77110
TOOL_NAME = "tool.name"
78111
"""
79112
Name of the tool being used.
@@ -112,6 +145,19 @@ class SpanAttributes:
112145
The id of the user
113146
"""
114147

148+
PROMPT_VENDOR = "prompt.vendor"
149+
"""
150+
The vendor or origin of the prompt, e.g. a prompt library, a specialized service, etc.
151+
"""
152+
PROMPT_ID = "prompt.id"
153+
"""
154+
A vendor-specific id used to locate the prompt.
155+
"""
156+
PROMPT_URL = "prompt.url"
157+
"""
158+
A vendor-specific url used to locate the prompt.
159+
"""
160+
115161

116162
class MessageAttributes:
117163
"""
@@ -151,6 +197,10 @@ class MessageAttributes:
151197
The JSON string representing the arguments passed to the function
152198
during a function call.
153199
"""
200+
MESSAGE_TOOL_CALL_ID = "message.tool_call_id"
201+
"""
202+
The id of the tool call.
203+
"""
154204

155205

156206
class MessageContentAttributes:
@@ -186,6 +236,25 @@ class ImageAttributes:
186236
"""
187237

188238

239+
class AudioAttributes:
240+
"""
241+
Attributes for audio
242+
"""
243+
244+
AUDIO_URL = "audio.url"
245+
"""
246+
The url to an audio file
247+
"""
248+
AUDIO_MIME_TYPE = "audio.mime_type"
249+
"""
250+
The mime type of the audio file
251+
"""
252+
AUDIO_TRANSCRIPT = "audio.transcript"
253+
"""
254+
The transcript of the audio file
255+
"""
256+
257+
189258
class DocumentAttributes:
190259
"""
191260
Attributes for a document.
@@ -257,6 +326,10 @@ class ToolCallAttributes:
257326
Attributes for a tool call
258327
"""
259328

329+
TOOL_CALL_ID = "tool_call.id"
330+
"""
331+
The id of the tool call.
332+
"""
260333
TOOL_CALL_FUNCTION_NAME = "tool_call.function.name"
261334
"""
262335
The name of function that is being called during a tool call.
@@ -268,6 +341,18 @@ class ToolCallAttributes:
268341
"""
269342

270343

344+
class ToolAttributes:
345+
"""
346+
Attributes for a tools
347+
"""
348+
349+
TOOL_JSON_SCHEMA = "tool.json_schema"
350+
"""
351+
The json schema of a tool input, It is RECOMMENDED that this be in the
352+
OpenAI tool calling format: https://platform.openai.com/docs/assistants/tools
353+
"""
354+
355+
271356
class OpenInferenceSpanKindValues(Enum):
272357
TOOL = "TOOL"
273358
CHAIN = "CHAIN"
@@ -284,3 +369,21 @@ class OpenInferenceSpanKindValues(Enum):
284369
class OpenInferenceMimeTypeValues(Enum):
285370
TEXT = "text/plain"
286371
JSON = "application/json"
372+
373+
374+
class OpenInferenceLLMSystemValues(Enum):
375+
OPENAI = "openai"
376+
ANTHROPIC = "anthropic"
377+
COHERE = "cohere"
378+
MISTRALAI = "mistralai"
379+
VERTEXAI = "vertexai"
380+
381+
382+
class OpenInferenceLLMProviderValues(Enum):
383+
OPENAI = "openai"
384+
ANTHROPIC = "anthropic"
385+
COHERE = "cohere"
386+
MISTRALAI = "mistralai"
387+
GOOGLE = "google"
388+
AZURE = "azure"
389+
AWS = "aws"

0 commit comments

Comments
 (0)