Help us improve these docs. Take our quick survey.
W&B Weave と OpenAI 互換 API 経由でオープンソースの基盤モデルにアクセス
import openai client = openai.OpenAI( # カスタムベースURLはW&B Inferenceを指します base_url='https://api.inference.wandb.ai/v1', # https://wandb.ai/settings でAPIキーを作成してください api_key="<your-api-key>", # 省略可能: 使用状況トラッキング用のTeamとプロジェクト 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)
このページは役に立ちましたか?