Update util.py
Browse files
util.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
#import base64, cv2
|
| 2 |
import pandas as pd
|
| 3 |
-
from
|
|
|
|
| 4 |
|
| 5 |
def get_questions(file_path):
|
| 6 |
df = pd.read_json(file_path, lines=True)
|
|
@@ -60,11 +61,20 @@ def get_final_answer(model, question, answer):
|
|
| 60 |
|
| 61 |
"""
|
| 62 |
|
| 63 |
-
client = OpenAI()
|
| 64 |
|
| 65 |
-
completion = client.chat.completions.create(
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
)
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#import base64, cv2
|
| 2 |
import pandas as pd
|
| 3 |
+
from google import genai
|
| 4 |
+
#from openai import OpenAI
|
| 5 |
|
| 6 |
def get_questions(file_path):
|
| 7 |
df = pd.read_json(file_path, lines=True)
|
|
|
|
| 61 |
|
| 62 |
"""
|
| 63 |
|
| 64 |
+
#client = OpenAI()
|
| 65 |
|
| 66 |
+
#completion = client.chat.completions.create(
|
| 67 |
+
# model=model,
|
| 68 |
+
# messages=[{"role": "user", "content": [{"type": "text", "text": prompt_template}]}]
|
| 69 |
+
#)
|
| 70 |
+
|
| 71 |
+
client = genai.Client(api_key=os.environ["GOOGLE_API_KEY"])
|
| 72 |
|
| 73 |
+
response = client.models.generate_content(
|
| 74 |
+
model=model,
|
| 75 |
+
contents=[prompt_template]
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
#return completion.choices[0].message.content
|
| 79 |
+
|
| 80 |
+
return response.text
|