File size: 571 Bytes
152139e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from openai import OpenAI
from dotenv import load_dotenv
import os

# Load the .env file and get the API key
load_dotenv()
api_key = os.getenv("OPENAI_API_KEY")

# Initialize OpenAI client with OpenAI's official base URL
client = OpenAI(
    api_key=api_key,
    base_url="https://api.openai.com/v1"
)

# Use a simple model like gpt-3.5-turbo
completion = client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[
        {"role": "user", "content": "what is the Jacobian matrix"}
    ]
)

# Print the response
print(completion.choices[0].message.content)