Skip to content

Commit 76740e9

Browse files
committed
handle default model name and provider
1 parent f5efd26 commit 76740e9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

dd-java-agent/agent-llmobs/src/main/java/datadog/trace/llmobs/LLMObsSystem.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public class LLMObsSystem {
1717

1818
private static final Logger LOGGER = LoggerFactory.getLogger(LLMObsSystem.class);
1919

20+
private static final String CUSTOM_MODEL_VAL = "custom";
21+
2022
public static void start(Instrumentation inst, SharedCommunicationObjects sco) {
2123
Config config = Config.get();
2224
if (!config.isLlmObsEnabled()) {
@@ -57,7 +59,14 @@ public LLMObsSpan startLLMSpan(
5759
new DDLLMObsSpan(
5860
Tags.LLMOBS_LLM_SPAN_KIND, spanName, getMLApp(mlApp), sessionID, serviceName);
5961

62+
if (modelName == null || modelName.isEmpty()) {
63+
modelName = CUSTOM_MODEL_VAL;
64+
}
6065
span.setTag(LLMObsTags.MODEL_NAME, modelName);
66+
67+
if (modelProvider == null || modelProvider.isEmpty()) {
68+
modelProvider = CUSTOM_MODEL_VAL;
69+
}
6170
span.setTag(LLMObsTags.MODEL_PROVIDER, modelProvider);
6271
return span;
6372
}

0 commit comments

Comments
 (0)