Spaces:
Running
Running
Commit
·
ec9fbf7
1
Parent(s):
6582396
feat: move to gpt4o
Browse files
public-prediction/get_gpt_answer.py
CHANGED
@@ -5,7 +5,7 @@ from langchain_core.messages import HumanMessage, SystemMessage
|
|
5 |
class GetGPTAnswer:
|
6 |
def __init__(self):
|
7 |
self.llm_gpt35 = ChatOpenAI(model="gpt-3.5-turbo")
|
8 |
-
self.
|
9 |
|
10 |
def generate_gpt35_answer(self, question: str):
|
11 |
messages = [
|
@@ -17,12 +17,12 @@ class GetGPTAnswer:
|
|
17 |
gpt35_answer = self.llm_gpt35.invoke(messages)
|
18 |
return gpt35_answer.content
|
19 |
|
20 |
-
def
|
21 |
messages = [
|
22 |
SystemMessage(
|
23 |
content="Please answer the following question based solely on your internal knowledge, without external references. Assume you are the human."),
|
24 |
HumanMessage(question)
|
25 |
]
|
26 |
|
27 |
-
gpt4_answer = self.
|
28 |
return gpt4_answer.content
|
|
|
5 |
class GetGPTAnswer:
|
6 |
def __init__(self):
|
7 |
self.llm_gpt35 = ChatOpenAI(model="gpt-3.5-turbo")
|
8 |
+
self.llm_gpt4o = ChatOpenAI(model="gpt-4o")
|
9 |
|
10 |
def generate_gpt35_answer(self, question: str):
|
11 |
messages = [
|
|
|
17 |
gpt35_answer = self.llm_gpt35.invoke(messages)
|
18 |
return gpt35_answer.content
|
19 |
|
20 |
+
def generate_gpt4o_answer(self, question: str):
|
21 |
messages = [
|
22 |
SystemMessage(
|
23 |
content="Please answer the following question based solely on your internal knowledge, without external references. Assume you are the human."),
|
24 |
HumanMessage(question)
|
25 |
]
|
26 |
|
27 |
+
gpt4_answer = self.llm_gpt4o.invoke(messages)
|
28 |
return gpt4_answer.content
|
public-prediction/kafka_consumer.py
CHANGED
@@ -11,7 +11,7 @@ from google.protobuf.json_format import MessageToDict
|
|
11 |
|
12 |
def get_gpt_responses(data: dict[str, any], gpt_helper: GetGPTAnswer):
|
13 |
data["gpt35_answer"] = gpt_helper.generate_gpt35_answer(data["question"])
|
14 |
-
data["
|
15 |
return data
|
16 |
|
17 |
|
|
|
11 |
|
12 |
def get_gpt_responses(data: dict[str, any], gpt_helper: GetGPTAnswer):
|
13 |
data["gpt35_answer"] = gpt_helper.generate_gpt35_answer(data["question"])
|
14 |
+
data["gpt4o_answer"] = gpt_helper.generate_gpt4o_answer(data["question"])
|
15 |
return data
|
16 |
|
17 |
|