|
2 | 2 |
|
3 | 3 | import java.util.List; |
4 | 4 | import java.util.Map; |
5 | | -import javax.annotation.Nullable; |
6 | 5 |
|
7 | 6 | /** This interface represent an individual LLM Obs span. */ |
8 | 7 | public interface LLMObsSpan { |
9 | 8 |
|
10 | 9 | /** |
11 | | - * Annotate spans with inputs, outputs, metadata, metrics, and tags. |
| 10 | + * Annotate spans with inputs and outputs |
12 | 11 | * |
13 | 12 | * @param inputData The input data of the span in the form of a list, for example a list of input |
14 | 13 | * messages |
15 | 14 | * @param outputData The output data of the span in the form of a list, for example a list of |
16 | 15 | * output messages |
17 | | - * @param metadata A map of JSON serializable key-value pairs that contains metadata information |
18 | | - * relevant to the input or output operation described by the span |
19 | | - * @param metrics A map of JSON serializable keys and numeric values that users can add as metrics |
20 | | - * relevant to the operation described by the span (input_tokens, output_tokens, total_tokens, |
21 | | - * etc.). |
22 | | - * @param tags An map of JSON serializable key-value pairs that users can add as tags regarding |
23 | | - * the span’s context (session, environment, system, versioning, etc.). |
24 | 16 | */ |
25 | | - void annotate( |
26 | | - @Nullable List<Map<String, Object>> inputData, |
27 | | - @Nullable List<Map<String, Object>> outputData, |
28 | | - @Nullable Map<String, Object> metadata, |
29 | | - @Nullable Map<String, Number> metrics, |
30 | | - @Nullable Map<String, Object> tags); |
| 17 | + void annotateIO(List<Map<String, Object>> inputData, List<Map<String, Object>> outputData); |
| 18 | + |
31 | 19 |
|
32 | 20 | /** |
33 | | - * Annotate spans with inputs, outputs, metadata, metrics, and tags. |
| 21 | + * Annotate spans with inputs and outputs |
34 | 22 | * |
35 | 23 | * @param inputData The input data of the span in the form of a string |
36 | 24 | * @param outputData The output data of the span in the form of a string |
| 25 | + */ |
| 26 | + void annotateIO(String inputData, String outputData); |
| 27 | + |
| 28 | + /** |
| 29 | + * Annotate spans with metadata |
| 30 | + * |
37 | 31 | * @param metadata A map of JSON serializable key-value pairs that contains metadata information |
38 | 32 | * relevant to the input or output operation described by the span |
| 33 | + */ |
| 34 | + void setMetadata(Map<String, Object> metadata); |
| 35 | + |
| 36 | + /** |
| 37 | + * Annotate spans with metrics |
| 38 | + * |
39 | 39 | * @param metrics A map of JSON serializable keys and numeric values that users can add as metrics |
40 | 40 | * relevant to the operation described by the span (input_tokens, output_tokens, total_tokens, |
41 | 41 | * etc.). |
| 42 | + */ |
| 43 | + void setMetrics(Map<String, Number> metrics); |
| 44 | + |
| 45 | + /** |
| 46 | + * Annotate spans with tags |
| 47 | + * |
42 | 48 | * @param tags An map of JSON serializable key-value pairs that users can add as tags regarding |
43 | 49 | * the span’s context (session, environment, system, versioning, etc.). |
44 | 50 | */ |
45 | | - void annotate( |
46 | | - @Nullable String inputData, |
47 | | - @Nullable String outputData, |
48 | | - @Nullable Map<String, Object> metadata, |
49 | | - @Nullable Map<String, Number> metrics, |
50 | | - @Nullable Map<String, Object> tags); |
| 51 | + void setTags(Map<String, Object> tags); |
| 52 | + |
| 53 | + /** |
| 54 | + * Annotate spans with a single tag key value pair as a tag regarding |
| 55 | + * the span’s context (session, environment, system, versioning, etc.). |
| 56 | + * |
| 57 | + * @param key the key of the tag |
| 58 | + * @param value the value of the tag |
| 59 | + */ |
| 60 | + void setTag(String key, String value); |
51 | 61 | } |
0 commit comments