mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 02:34:29 +00:00
21 lines
595 B
Python
21 lines
595 B
Python
# mypy: ignore-errors
|
|
import openai
|
|
import uuid
|
|
|
|
client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000")
|
|
example_traceparent = f"00-80e1afed08e019fc1110464cfa66635c-02e80198930058d4-01"
|
|
extra_headers = {"traceparent": example_traceparent}
|
|
_trace_id = example_traceparent.split("-")[1]
|
|
|
|
print("EXTRA HEADERS: ", extra_headers)
|
|
print("Trace ID: ", _trace_id)
|
|
|
|
response = client.chat.completions.create(
|
|
model="llama3",
|
|
messages=[
|
|
{"role": "user", "content": "this is a test request, write a short poem"}
|
|
],
|
|
extra_headers=extra_headers,
|
|
)
|
|
|
|
print(response)
|