weave
weave copied to clipboard
Expose low level span creation apis, make openai patching more robust
I just copied open telemetries trace API. Also made the AsyncOpenAI patch return a similar object to what the core lib does to avoid users getting suprised by not being able to access attributes like response
on the object. Some tests should be written here and I likely broke some. Would love to hear thoughts on the new api methods.
with weave.start_as_current_span("something", input_data) as span:
...
span.finish(output_data)
span = weave.start_span("something", input_data)
if success:
span.finish(output_data)
else:
e = new ValueError("Damn")
span.fail(d)
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=88a0eaf224afb22ca22a7db9f0a624af41101cf6