import openai
client = openai.OpenAI(
# Serverless Inference を指すカスタムのベース URL
base_url='https://api.inference.wandb.ai/v1',
# APIキーは https://forge.coreweave.com/settings で作成します
api_key="[YOUR-API-KEY]",
# オプション: 使用量のトラッキングに使用するチームと project
project="[YOUR-TEAM]/[YOUR-PROJECT]",
)
response = client.chat.completions.create(
model="meta-llama/Llama-3.1-8B-Instruct",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Tell me a joke."}
],
)
print(response.choices[0].message.content)