Hey guys, does the get_spans_dataframe api call store the llm cost of that span? If not, is there a way to extract that? or will that need to be calculated using the tokens and the model being used ourselves?
Yes, the get_spans_dataframe API call includes the LLM cost for each span if cost tracking is enabled and the required span attributes (llm.token_count.prompt, llm.token_count.completion, llm.token_count.total, llm.model_name, and llm.provider) are present. Phoenix computes and stores span-level costs, which are then accessible via the spans DataFrame API and visible in the UI and analytics features. For more, see cost tracking docs and exporting spans.Would you like more detail on how to access or interpret the cost fields in the DataFrame?Sources:
- Cost Tracking: Span-level costs
- exporting spans
馃挕聽Hint: Mention RunLLM in the thread for followups.
Hi Suhrullekha C., unfortunately there isn't an explicit field for the cost of the span when you do get_spans_dataframe. The best work around would be to compute the cost based on the token_count fields.