# NVIDIA uses OpenAI client to interact with their API
from openai import OpenAI
from honeyhive import HoneyHiveTracer
# place the code below at the beginning of your application execution
HoneyHiveTracer.init(
api_key="MY_HONEYHIVE_API_KEY", # paste your API key here
project="MY_HONEYHIVE_PROJECT_NAME", # paste your project name here
)
client = OpenAI(
base_url="https://integrate.api.nvidia.com/v1",
api_key="MY_NVIDIA_API_KEY",
)
completion = client.chat.completions.create(
model="nvidia/mistral-nemo-minitron-8b-8k-instruct",
messages=[
{
"role": "user",
"content": "Write a limerick about the wonders of GPU computing.",
}
],
stream=True,
)
for chunk in completion:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")