Skip to content

Commit

Permalink
[fix] allow setting openai base url
Browse files Browse the repository at this point in the history
  • Loading branch information
bojieli committed Sep 11, 2024
1 parent 6aafd92 commit 1ad6321
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/views/ai/summarize_course.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@


def get_chatgpt_completion(system_prompt, user_prompt):
client = OpenAI(
api_key=app.config['OPENAI_API_KEY'],
)
if 'OPENAI_BASE_URL' in app.config:
client = OpenAI(
base_url=app.config['OPENAI_BASE_URL'],
api_key=app.config['OPENAI_API_KEY'],
)
else:
client = OpenAI(
api_key=app.config['OPENAI_API_KEY'],
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
Expand Down

0 comments on commit 1ad6321

Please sign in to comment.