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