TheHickman commited on
Commit
87b8106
·
verified ·
1 Parent(s): ed15844

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -10,9 +10,9 @@ def explain_text(selected_text):
10
  if not selected_text or not selected_text.strip():
11
  return "__NO_SELECTION__"
12
  try:
13
- response = client.chat.completions.create(
14
- model="gpt-4o",
15
- messages=[
16
  {
17
  "role": "system",
18
  "content": (
@@ -26,10 +26,9 @@ def explain_text(selected_text):
26
  "content": f'Explain this text from a learning resource:\n\n"""\n{selected_text}\n"""',
27
  },
28
  ],
29
- temperature=0.7,
30
- max_tokens=500,
31
  )
32
- return response.choices[0].message.content
33
  except Exception as e:
34
  return f"__ERROR__: {str(e)}"
35
 
 
10
  if not selected_text or not selected_text.strip():
11
  return "__NO_SELECTION__"
12
  try:
13
+ response = client.responses.create(
14
+ model="gpt-4.1-mini",
15
+ input=[
16
  {
17
  "role": "system",
18
  "content": (
 
26
  "content": f'Explain this text from a learning resource:\n\n"""\n{selected_text}\n"""',
27
  },
28
  ],
29
+ max_output_tokens=400,
 
30
  )
31
+ return response.output_text
32
  except Exception as e:
33
  return f"__ERROR__: {str(e)}"
34