Skip to content

Commit 528c498

Browse files
authored
fix(manual-tracing): add missing llm.request.type attribute (#269)
1 parent 7d827ba commit 528c498

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

packages/traceloop-sdk/src/lib/tracing/manual.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ export function withLLMCall<
163163
F extends ({ span }: { span: LLMSpan }) => ReturnType<F>,
164164
>({ vendor, type }: LLMCallConfig, fn: F, thisArg?: ThisParameterType<F>) {
165165
const span = getTracer().startSpan(`${vendor}.${type}`, {}, context.active());
166+
span.setAttribute(SpanAttributes.LLM_REQUEST_TYPE, type);
166167
trace.setSpan(context.active(), span);
167168

168169
const res = fn.apply(thisArg, [{ span: new LLMSpan(span) }]);

packages/traceloop-sdk/test/decorators.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@ describe("Test SDK Decorators", () => {
415415
workflowSpan.spanContext().spanId,
416416
);
417417

418+
assert.strictEqual(
419+
completionSpan.attributes[`${SpanAttributes.LLM_REQUEST_TYPE}`],
420+
"chat",
421+
);
418422
assert.strictEqual(
419423
completionSpan.attributes[`${SpanAttributes.LLM_REQUEST_MODEL}`],
420424
"gpt-3.5-turbo",

0 commit comments

Comments
 (0)