(content: str, max_tokens: int)
| 9 | |
| 10 | |
| 11 | def 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 | |
| 36 | def parse_score(review): |
no outgoing calls
no test coverage detected