Reverted to use Davinci
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from llama_index import Document, SimpleDirectoryReader, GPTListIndex, GPTSimpleVectorIndex, LLMPredictor, PromptHelper, ServiceContext
|
2 |
from llama_index import download_loader
|
3 |
-
from langchain
|
4 |
from pathlib import Path
|
5 |
import gradio as gr
|
6 |
import sys
|
@@ -10,9 +10,6 @@ dataFiles = ["RetroApril","RetroMarch", "Snowflake", "Datadog", "Databricks", "S
|
|
10 |
|
11 |
cache = {}
|
12 |
|
13 |
-
prompt_helper = PromptHelper(4096, 256, 20)
|
14 |
-
llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo"))
|
15 |
-
service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, prompt_helper=prompt_helper)
|
16 |
|
17 |
def indexFile(filePath):
|
18 |
PandasCSVReader = download_loader("PandasCSVReader")
|
@@ -37,7 +34,7 @@ def chatbot(indexName, input_text):
|
|
37 |
Chatbot function that takes in a prompt and returns a response
|
38 |
"""
|
39 |
index = cache[indexName]
|
40 |
-
response = index.query(input_text, response_mode="compact"
|
41 |
return response.response
|
42 |
|
43 |
|
|
|
1 |
from llama_index import Document, SimpleDirectoryReader, GPTListIndex, GPTSimpleVectorIndex, LLMPredictor, PromptHelper, ServiceContext
|
2 |
from llama_index import download_loader
|
3 |
+
from langchain import OpenAI
|
4 |
from pathlib import Path
|
5 |
import gradio as gr
|
6 |
import sys
|
|
|
10 |
|
11 |
cache = {}
|
12 |
|
|
|
|
|
|
|
13 |
|
14 |
def indexFile(filePath):
|
15 |
PandasCSVReader = download_loader("PandasCSVReader")
|
|
|
34 |
Chatbot function that takes in a prompt and returns a response
|
35 |
"""
|
36 |
index = cache[indexName]
|
37 |
+
response = index.query(input_text, response_mode="compact")
|
38 |
return response.response
|
39 |
|
40 |
|