ai_meeting_note / inference_client.py
wellflat's picture
Upload folder using huggingface_hub
a630030 verified
Raw
History Blame Contribute Delete
550 Bytes
#!/usr/bin/env python
import os
from dotenv import load_dotenv
from huggingface_hub import InferenceClient
load_dotenv()
def chat(prompt: str) -> None:
client = InferenceClient(
base_url="https://router.huggingface.co/v1",
api_key=os.environ["HF_TOKEN"],
)
completion = client.chat.completions.create(
model="openai/gpt-oss-120b",
messages=[{"role":"user", "content": prompt}]
)
print(completion.choices[0].message)
if __name__ == "__main__":
chat("日本の首都はどこですか?")