Spaces:
Running
Running
Update GPT4KG.py
Browse files
GPT4KG.py
CHANGED
@@ -111,7 +111,7 @@ class KnowledgeGraph:
|
|
111 |
except:
|
112 |
pass
|
113 |
messages.append({"role":"user","content":text})
|
114 |
-
output = openai.ChatCompletion.create(model="gpt-
|
115 |
return output
|
116 |
|
117 |
def learn(self,text,show_output=False):
|
@@ -204,7 +204,7 @@ class KnowledgeGraph:
|
|
204 |
system = {"role":"system","content":"You are a helpful chatbot that only outputs YES or NO"}
|
205 |
messages = [system]
|
206 |
messages.append({"role":"user","content":f"Do these two facts in our database express the same thing?: {pair}"})
|
207 |
-
output = openai.ChatCompletion.create(model="gpt-
|
208 |
if "yes" in output.lower():
|
209 |
bad_index = facts.index(pair[1])
|
210 |
redundant = rels[bad_index]
|
|
|
111 |
except:
|
112 |
pass
|
113 |
messages.append({"role":"user","content":text})
|
114 |
+
output = openai.ChatCompletion.create(model="gpt-4o",messages=messages)["choices"][0]["message"].to_dict()["content"]
|
115 |
return output
|
116 |
|
117 |
def learn(self,text,show_output=False):
|
|
|
204 |
system = {"role":"system","content":"You are a helpful chatbot that only outputs YES or NO"}
|
205 |
messages = [system]
|
206 |
messages.append({"role":"user","content":f"Do these two facts in our database express the same thing?: {pair}"})
|
207 |
+
output = openai.ChatCompletion.create(model="gpt-4o",messages=messages)["choices"][0]["message"].to_dict()["content"]
|
208 |
if "yes" in output.lower():
|
209 |
bad_index = facts.index(pair[1])
|
210 |
redundant = rels[bad_index]
|