Spaces:
Running
Running
Commit
·
57db935
1
Parent(s):
4e584a6
feat: remove gpt35 answering
Browse files
public-prediction/get_gpt_answer.py
CHANGED
@@ -4,19 +4,8 @@ from langchain_core.messages import HumanMessage, SystemMessage
|
|
4 |
|
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 = [
|
12 |
-
SystemMessage(
|
13 |
-
content="Please answer the following question based solely on your internal knowledge, without external references. Assume you are the human."),
|
14 |
-
HumanMessage(question)
|
15 |
-
]
|
16 |
-
|
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(
|
|
|
4 |
|
5 |
class GetGPTAnswer:
|
6 |
def __init__(self):
|
|
|
7 |
self.llm_gpt4o = ChatOpenAI(model="gpt-4o")
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
def generate_gpt4o_answer(self, question: str):
|
10 |
messages = [
|
11 |
SystemMessage(
|
public-prediction/kafka_consumer.py
CHANGED
@@ -10,7 +10,6 @@ from google.protobuf.json_format import MessageToDict
|
|
10 |
|
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 |
|
@@ -79,7 +78,8 @@ def consume_messages():
|
|
79 |
print("Continuing...")
|
80 |
continue
|
81 |
|
82 |
-
print(
|
|
|
83 |
|
84 |
full_results = []
|
85 |
for i in range(0, len(full_batch), BATCH_SIZE):
|
|
|
10 |
|
11 |
|
12 |
def get_gpt_responses(data: dict[str, any], gpt_helper: GetGPTAnswer):
|
|
|
13 |
data["gpt4o_answer"] = gpt_helper.generate_gpt4o_answer(data["question"])
|
14 |
return data
|
15 |
|
|
|
78 |
print("Continuing...")
|
79 |
continue
|
80 |
|
81 |
+
print("Parsing successful. Processing job_app_id {0}".format(
|
82 |
+
incoming_message['job_application_id']))
|
83 |
|
84 |
full_results = []
|
85 |
for i in range(0, len(full_batch), BATCH_SIZE):
|