MCPcopy
hub / github.com/XPixelGroup/DiffBIR / get_eval

Function get_eval

llava/eval/eval_gpt_review_visual.py:11–33  ·  view source on GitHub ↗
(content: str, max_tokens: int)

Source from the content-addressed store, hash-verified

9
10
11def get_eval(content: str, max_tokens: int):
12 while True:
13 try:
14 response = openai.ChatCompletion.create(
15 model='gpt-4-0314',
16 messages=[{
17 'role': 'system',
18 'content': 'You are a helpful and precise assistant for checking the quality of the answer.'
19 }, {
20 'role': 'user',
21 'content': content,
22 }],
23 temperature=0.2, # TODO: figure out which temperature is best for evaluation
24 max_tokens=max_tokens,
25 )
26 break
27 except openai.error.RateLimitError:
28 pass
29 except Exception as e:
30 print(e)
31 time.sleep(NUM_SECONDS_TO_SLEEP)
32
33 return response['choices'][0]['message']['content']
34
35
36def parse_score(review):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected