[MLOB-2035] create generic llmobs decorator #11855
Closed
+55
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please read this doc for more details about the initiative and plan to make span kinds optional.
This PR updates the LLMObs SDK to make span kinds optional. In order to accomplish this, a new generic decorator
@wrap
is added along with a genericLLMObs.trace
inline method. The end goal of this work will be to have these generic methods replace span kind specific decorators and inline methods (e.g.@llm
or@workflow
) for a faster onboarding experience.Using the generic
@wrap
decoratorThe first step in a user's onboarding journey will now involve decorating their functions with
@wrap
. This will capture the work done inside that function as an llmobs span with no span kind defined.Once a user is comfortable with choosing span kinds that match the work done inside a function, they can enrich the decorator by passing in the
kind
argument. This will produce llmobs spans of that kind.Using the generic
LLMObs.trace
inline methodSimilarly to the
@wrap
decorator, users can start off by creating inline spans with no span kind defined.They can then add additional arguments to flesh out their instrumentation.
Checklist
Reviewer Checklist