Skip to content

Commit

Permalink
fix(sdk): allow passing a function to the decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
nirga committed Apr 1, 2024
1 parent 956bad4 commit 9c967e3
Show file tree
Hide file tree
Showing 4 changed files with 598 additions and 12 deletions.
4 changes: 3 additions & 1 deletion packages/sample-app/src/sample_decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class SampleOpenAI {
return chatCompletion.choices[0].message.content;
}

@traceloop.workflow({ name: "sample_completion" })
@traceloop.workflow((thisArg) => ({
name: `sample_${(thisArg as SampleOpenAI).model}`,
}))
async completion(jokeSubject: string) {
const completion = await openai.completions.create({
prompt: `Tell me a joke about ${jokeSubject}`,
Expand Down
Loading

0 comments on commit 9c967e3

Please sign in to comment.