Skip to content

Instantly share code, notes, and snippets.

@elijahbenizzy
Created August 12, 2024 23:09
Show Gist options
  • Save elijahbenizzy/82b864a627bfe75ddf90870de5734045 to your computer and use it in GitHub Desktop.
Save elijahbenizzy/82b864a627bfe75ddf90870de5734045 to your computer and use it in GitHub Desktop.
import openai
from opentelemetry import trace
tracer = trace.get_tracer("simple_chatbot.example")
with tracer.start_as_current_span("query_llm") as span:
response = openai.ChatCompletion.create(
model="gpt-4",
messages=[
{"role": "user", "content": "TODO"}
]
)
result = response["choices"][0]["message"]["content"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment