Skip to content

Commit 2b23b61

Browse files
committed
make API stricter
1 parent 40e1610 commit 2b23b61

File tree

1 file changed

+32
-22
lines changed

1 file changed

+32
-22
lines changed

dd-trace-api/src/main/java/datadog/trace/api/llmobs/LLMObsSpan.java

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,60 @@
22

33
import java.util.List;
44
import java.util.Map;
5-
import javax.annotation.Nullable;
65

76
/** This interface represent an individual LLM Obs span. */
87
public interface LLMObsSpan {
98

109
/**
11-
* Annotate spans with inputs, outputs, metadata, metrics, and tags.
10+
* Annotate spans with inputs and outputs
1211
*
1312
* @param inputData The input data of the span in the form of a list, for example a list of input
1413
* messages
1514
* @param outputData The output data of the span in the form of a list, for example a list of
1615
* 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.).
2416
*/
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+
3119

3220
/**
33-
* Annotate spans with inputs, outputs, metadata, metrics, and tags.
21+
* Annotate spans with inputs and outputs
3422
*
3523
* @param inputData The input data of the span in the form of a string
3624
* @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+
*
3731
* @param metadata A map of JSON serializable key-value pairs that contains metadata information
3832
* 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+
*
3939
* @param metrics A map of JSON serializable keys and numeric values that users can add as metrics
4040
* relevant to the operation described by the span (input_tokens, output_tokens, total_tokens,
4141
* etc.).
42+
*/
43+
void setMetrics(Map<String, Number> metrics);
44+
45+
/**
46+
* Annotate spans with tags
47+
*
4248
* @param tags An map of JSON serializable key-value pairs that users can add as tags regarding
4349
* the span’s context (session, environment, system, versioning, etc.).
4450
*/
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);
5161
}

0 commit comments

Comments
 (0)