Skip to content

Commit 2178f1c

Browse files
authored
fix(sdk): allow passing a function to the decorator (#181)
1 parent 956bad4 commit 2178f1c

File tree

4 files changed

+598
-12
lines changed

4 files changed

+598
-12
lines changed

packages/sample-app/src/sample_decorators.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ class SampleOpenAI {
2323
return chatCompletion.choices[0].message.content;
2424
}
2525

26-
@traceloop.workflow({ name: "sample_completion" })
26+
@traceloop.workflow((thisArg) => ({
27+
name: `sample_${(thisArg as SampleOpenAI).model}`,
28+
}))
2729
async completion(jokeSubject: string) {
2830
const completion = await openai.completions.create({
2931
prompt: `Tell me a joke about ${jokeSubject}`,

0 commit comments

Comments
 (0)