-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Bug Report: Traceloop SDK does not always make an API request at the completion of a Colab/Jupyter notebook block #1813
Comments
Hey @michael-hhai! Thanks for this. |
I believe all of them. I think this a regression on #65. |
Interesting, since that fix is still there:
I wonder if explicitly calling |
@michael-hhai can you try maybe running
|
I did: from traceloop.sdk import Traceloop
import os
# This is just for easy illustrative purposes so people don't need to set up any API keys
os.environ['TRACELOOP_API_KEY'] = 'asdasd'
os.environ['TRACELOOP_BASE_URL'] = 'asdasd'
Traceloop.init(disable_batch=True) import http.client as http_client
import logging
http_client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True from openai import OpenAI
api_key = input("Please enter your OpenAI API key: ")
client = OpenAI(api_key=api_key)
completion = client.chat.completions.create(
model='gpt-4o',
messages=[{"role":"user","content":"What's the meaning of life?"}]
)
print(completion.choices[0].message.content)
from traceloop.sdk.tracing.tracing import TracerWrapper
TracerWrapper().flush() And I got:
|
That's basically calling an OpenTelemetry method so it might be something with your backend? Are you using GRPC? |
Yeah, good call. False alarm on that. Calling from traceloop.sdk.tracing.tracing import TracerWrapper
TracerWrapper().flush() does indeed work. Would be curious to know why it doesn't always happen upon exit. |
Which component is this bug for?
Traceloop SDK
📜 Description
If you instantiate the Traceloop SDK in Block A:
and you run the following code in Block B:
then the Traceloop SDK should send an API request at the completion of Block B to record the OpenAI request. With appropriate logging set, you can see that this is not the case.
I see #66, but it seems like this same issue might have reared its head again. I swear this used to work.
👟 Reproduction steps
I have this notebook which reproduces the issue. If you run it, you should see that there is no Traceloop API call in the OpenAI call code block.
👍 Expected behavior
The API call should be triggered at the completion of every code block.
👎 Actual Behavior with Screenshots
The only API calls logged are OpenAI API calls.
🤖 Python Version
No response
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
Are you willing to submit PR?
None
The text was updated successfully, but these errors were encountered: