The analysis object is a specialized array within a SemanticEvent designed for internal bookkeeping. Its primary purpose is to track the costs and resources consumed during the analysis of an event, particularly by AI, machine learning models, or other automated processing systems.
This object allows you to meticulously log details like LLM token usage, processing time, and monetary costs associated with enriching or interpreting an event. By recording this information directly on the event, you create a transparent and auditable trail of your internal analysis-related operational costs.
Note: This object is intended strictly for internal use and is not meant to be populated with data related to customer transactions or commerce.
Analysis Properties
An event can contain an array of analysis objects. Each object in the array has the following structure:
| Property | Description | Provided By |
|---|---|---|
item | The specific analysis or task being performed. | User-Provided |
provider | The service provider used for the analysis (e.g., "OpenAI", "Anthropic", "Google"). | User-Provided |
variant | The specific model or version of the service used (e.g., "gpt-4-turbo", "claude-3-opus"). | User-Provided |
token_in | The number of input tokens consumed by the analysis model. | User-Provided (Optional) |
token_out | The number of output tokens generated by the analysis model. | User-Provided (Optional) |
amount | The monetary cost of performing the analysis. | User-Provided (Optional) |
processing_time | The time taken to complete the analysis, typically in seconds. | User-Provided (Optional) |
currency | The currency of the amount field (defaults to "USD"). | User-Provided (Optional) |
Example
Here is an example of what an analysis array might look like within a SemanticEvent after a customer support ticket has been summarized and classified by two different AI models.
1"analysis": [
2 {
3 "item": "Summarization",
4 "provider": "OpenAI",
5 "variant": "gpt-4-turbo-2024-04-09",
6 "token_in": 1250,
7 "token_out": 300,
8 "amount": 0.0155,
9 "currency": "USD",
10 "processing_time": 2.5
11 },
12 {
13 "item": "Classification",
14 "provider": "Google",
15 "variant": "gemini-1.5-pro-latest",
16 "token_in": 1300,
17 "token_out": 50,
18 "amount": 0.0093,
19 "currency": "USD",
20 "processing_time": 1.8
21 }
22]