These courses are available in deeplearningAI platform freely.
Set OPENAI_API_KEY environment variable as well as GITHUB_TOKEN
You can use a .env file for that
Install it with uv package management or with pip
uv pip install python-dotenv openai langchain-community langchain-core langchain-openai docarray bs4
The github models marketplace has changed
import os
from openai import OpenAI
token = os.environ["GITHUB_TOKEN"]
endpoint = "https://models.github.ai/inference"
model_name = "openai/o3-mini"
client = OpenAI(
base_url=endpoint,
api_key=token,
)
response = client.chat.completions.create(
messages=[
{
"role": "developer",
"content": "You are a helpful assistant.",
},
{
"role": "user",
"content": "What is the capital of France?",
}
],
model=model_name
)
print(response.choices[0].message.content)