Spaces:
Runtime error
Runtime error
Fix bugs (#4)
Browse files* fix relative import
* add embeddings requirement
* update openai embeddings requirements...
- buster/chatbot.py +2 -2
- requirements.txt +6 -0
buster/chatbot.py
CHANGED
|
@@ -31,7 +31,7 @@ def engineer_prompt(question: str, documents: list[str]) -> str:
|
|
| 31 |
return " ".join(documents) + "\nNow answer the following question:\n" + question
|
| 32 |
|
| 33 |
|
| 34 |
-
def
|
| 35 |
# rank the documents, get the highest scoring doc and generate the prompt
|
| 36 |
candidates = rank_documents(df, query=question, top_k=1)
|
| 37 |
documents = candidates.text.to_list()
|
|
@@ -79,4 +79,4 @@ if __name__ == "__main__":
|
|
| 79 |
df = load_embeddings("data/document_embeddings.csv")
|
| 80 |
|
| 81 |
question = "Where should I put my datasets when I am running a job?"
|
| 82 |
-
response =
|
|
|
|
| 31 |
return " ".join(documents) + "\nNow answer the following question:\n" + question
|
| 32 |
|
| 33 |
|
| 34 |
+
def answer_question(question: str, df) -> str:
|
| 35 |
# rank the documents, get the highest scoring doc and generate the prompt
|
| 36 |
candidates = rank_documents(df, query=question, top_k=1)
|
| 37 |
documents = candidates.text.to_list()
|
|
|
|
| 79 |
df = load_embeddings("data/document_embeddings.csv")
|
| 80 |
|
| 81 |
question = "Where should I put my datasets when I am running a job?"
|
| 82 |
+
response = answer_question(question, df)
|
requirements.txt
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
|
|
|
|
|
| 1 |
bs4
|
| 2 |
numpy
|
| 3 |
tiktoken
|
| 4 |
openai
|
| 5 |
pandas
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas
|
| 2 |
+
openai[embeddings]
|
| 3 |
bs4
|
| 4 |
numpy
|
| 5 |
tiktoken
|
| 6 |
openai
|
| 7 |
pandas
|
| 8 |
+
scikit-learn
|
| 9 |
+
tenacity
|
| 10 |
+
matplotlib
|
| 11 |
+
plotly
|