Traces
All Ops
Filter
Trace
Feedback
Status
User
Called
Tokens
Cost
Latency
Trace Size
Create your first trace
Use traces to track all inputs & outputs of functions within your application. Debug, monitor or drill-down into tricky examples.
Learn tracing basics or see traces in action by following our quickstart guide.
# Ensure your dependencies are installed with:
# pip install openai weave
# Find your OpenAI API key at: https://platform.openai.com/api-keys
# Ensure that your OpenAI API key is available at:
# os.environ['OPENAI_API_KEY'] = "<your_openai_api_key>"
import os
import weave
from openai import OpenAI
# Find your wandb API key at: https://wandb.ai/authorize
weave.init('sapienza_ml_2022_23/Homework2_MNLP_HPO') # 🐝
@weave.op # 🐝 Decorator to track requests
def create_completion(message: str) -> str:
client = OpenAI()
response = client.chat.completions.create(
model="gpt-5",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": message}
],
)
return response.choices[0].message.content
message = "Tell me a joke."
create_completion(message)