Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
# 4/28/2024
|
2 |
-
|
3 |
# This version added saving chat history to a log file
|
4 |
# Updated the GPT model to gpt-4
|
5 |
# Add timestamp and ip address
|
@@ -29,7 +29,7 @@ import socket;
|
|
29 |
# deprecated
|
30 |
storage_context = StorageContext.from_defaults(persist_dir='./')
|
31 |
# gpt-3.5_turbo is the current default model
|
32 |
-
|
33 |
#service_context = ServiceContext.from_defaults(llm=llm_predictor)
|
34 |
#index = load_index_from_storage(storage_context, service_context=service_context)
|
35 |
index = load_index_from_storage(storage_context)
|
@@ -42,7 +42,7 @@ class Chatbot:
|
|
42 |
#self.history_file = f"./chat_log.json"
|
43 |
|
44 |
def generate_response(self, user_input):
|
45 |
-
query_engine = index.as_query_engine()
|
46 |
response = query_engine.query(user_input)
|
47 |
|
48 |
# generate response
|
|
|
1 |
# 4/28/2024
|
2 |
+
|
3 |
# This version added saving chat history to a log file
|
4 |
# Updated the GPT model to gpt-4
|
5 |
# Add timestamp and ip address
|
|
|
29 |
# deprecated
|
30 |
storage_context = StorageContext.from_defaults(persist_dir='./')
|
31 |
# gpt-3.5_turbo is the current default model
|
32 |
+
llm_predictor = OpenAI(temperature=0.5, model="gpt-4")
|
33 |
#service_context = ServiceContext.from_defaults(llm=llm_predictor)
|
34 |
#index = load_index_from_storage(storage_context, service_context=service_context)
|
35 |
index = load_index_from_storage(storage_context)
|
|
|
42 |
#self.history_file = f"./chat_log.json"
|
43 |
|
44 |
def generate_response(self, user_input):
|
45 |
+
query_engine = index.as_query_engine(llm=llm_predictor)
|
46 |
response = query_engine.query(user_input)
|
47 |
|
48 |
# generate response
|