Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,21 @@ public LLMObsSpan startWorkflowSpan(
Tags.LLMOBS_WORKFLOW_SPAN_KIND, spanName, getMLApp(mlApp), sessionId, serviceName);
}

@Override
public LLMObsSpan startEmbeddingSpan(
String spanName, @Nullable String mlApp, @Nullable String sessionId) {
return new DDLLMObsSpan(
Tags.LLMOBS_EMBEDDING_SPAN_KIND, spanName, getMLApp(mlApp), sessionId, serviceName);
}

public LLMObsSpan startRetrievalSpan(
String spanName,
@javax.annotation.Nullable String mlApp,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this javax's Nullable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe the original jetbrain's import of nullable is wrong :/

@javax.annotation.Nullable String sessionId) {
return new DDLLMObsSpan(
Tags.LLMOBS_RETRIEVAL_SPAN_KIND, spanName, getMLApp(mlApp), sessionId, serviceName);
}

private String getMLApp(String mlApp) {
if (mlApp == null || mlApp.isEmpty()) {
return defaultMLApp;
Expand Down
16 changes: 16 additions & 0 deletions dd-trace-api/src/main/java/datadog/trace/api/llmobs/LLMObs.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ public static LLMObsSpan startWorkflowSpan(
return SPAN_FACTORY.startWorkflowSpan(spanName, mlApp, sessionId);
}

public LLMObsSpan startEmbeddingSpan(
String spanName, @Nullable String mlApp, @Nullable String sessionId) {
return SPAN_FACTORY.startEmbeddingSpan(spanName, mlApp, sessionId);
}

public LLMObsSpan startRetrievalSpan(
String spanName, @Nullable String mlApp, @Nullable String sessionId) {
return SPAN_FACTORY.startRetrievalSpan(spanName, mlApp, sessionId);
}

public static void SubmitEvaluation(
LLMObsSpan llmObsSpan, String label, String categoricalValue, Map<String, Object> tags) {
EVAL_PROCESSOR.SubmitEvaluation(llmObsSpan, label, categoricalValue, tags);
Expand Down Expand Up @@ -90,6 +100,12 @@ LLMObsSpan startLLMSpan(

LLMObsSpan startWorkflowSpan(
String spanName, @Nullable String mlApp, @Nullable String sessionId);

LLMObsSpan startEmbeddingSpan(
String spanName, @Nullable String mlApp, @Nullable String sessionId);

LLMObsSpan startRetrievalSpan(
String spanName, @Nullable String mlApp, @Nullable String sessionId);
}

public interface LLMObsEvalProcessor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,14 @@ public LLMObsSpan startWorkflowSpan(
String spanName, @Nullable String mlApp, @Nullable String sessionId) {
return NoOpLLMObsSpan.INSTANCE;
}

public LLMObsSpan startEmbeddingSpan(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be modelName and modelProvider param for this one, where modelProvider defaults to custom if a value is not provided

String spanName, @Nullable String mlApp, @Nullable String sessionId) {
return NoOpLLMObsSpan.INSTANCE;
}

public LLMObsSpan startRetrievalSpan(
String spanName, @Nullable String mlApp, @Nullable String sessionId) {
return NoOpLLMObsSpan.INSTANCE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,6 @@ public class Tags {
public static final String LLMOBS_TASK_SPAN_KIND = "task";
public static final String LLMOBS_AGENT_SPAN_KIND = "agent";
public static final String LLMOBS_TOOL_SPAN_KIND = "tool";
public static final String LLMOBS_EMBEDDING_SPAN_KIND = "embedding";
public static final String LLMOBS_RETRIEVAL_SPAN_KIND = "retrieval";
}