Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
3f57c56d
Commit
3f57c56d
authored
Feb 05, 2025
by
Baber
Browse files
nit
parent
6572da7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
lm_eval/tasks/mathvista/utils.py
lm_eval/tasks/mathvista/utils.py
+6
-2
No files found.
lm_eval/tasks/mathvista/utils.py
View file @
3f57c56d
import
os
import
re
import
re
from
typing
import
Optional
from
typing
import
Optional
...
@@ -7,7 +8,10 @@ import requests
...
@@ -7,7 +8,10 @@ import requests
from
Levenshtein
import
distance
from
Levenshtein
import
distance
API_KEY
=
"API KEY"
API_KEY
=
os
.
getenv
(
"OPENAI_API_KEY"
)
assert
API_KEY
is
not
None
,
(
"Please set the OPENAI_API_KEY environment variable to use the MathVista task."
)
API_URL
=
"https://api.openai.com/v1/chat/completions"
API_URL
=
"https://api.openai.com/v1/chat/completions"
MODEL
=
"gpt-4"
MODEL
=
"gpt-4"
...
@@ -65,7 +69,7 @@ def send_request(prompt: str):
...
@@ -65,7 +69,7 @@ def send_request(prompt: str):
"messages"
:
[
"messages"
:
[
{
"role"
:
"user"
,
"content"
:
prompt
},
{
"role"
:
"user"
,
"content"
:
prompt
},
],
],
"max_tokens"
:
10
24
,
"max_tokens"
:
10
0
,
}
}
response
=
requests
.
post
(
API_URL
,
headers
=
headers
,
json
=
data
)
response
=
requests
.
post
(
API_URL
,
headers
=
headers
,
json
=
data
)
response
.
raise_for_status
()
response
.
raise_for_status
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment