Spaces:
Paused
Paused
reverted to original order
Browse files
app.py
CHANGED
|
@@ -280,7 +280,7 @@ def text_to_text_generation(verbose, prompt):
|
|
| 280 |
|
| 281 |
)
|
| 282 |
retrieved_results = semantic_search(prompt)
|
| 283 |
-
prompt = f"You are a helpful kubernetes professional. [INST] Use the following documentation, if it is relevant to answer the question below. [/INST]\nDocumentation: {retrieved_results} </s>\n<s> [INST] Answer the following question: {prompt} [/INST]\nAnswer
|
| 284 |
|
| 285 |
md = (
|
| 286 |
f"### Step 1: Preparing prompt for additional documentation\n"
|
|
@@ -288,7 +288,7 @@ def text_to_text_generation(verbose, prompt):
|
|
| 288 |
f"### Step 2: Retrieving documentation from a book.\n"
|
| 289 |
f"{retrieved_results}\n"
|
| 290 |
f"### Step 3: Creating full prompt given to model\n"
|
| 291 |
-
f"You are a helpful kubernetes professional. [INST] Use the following documentation, if it is relevant to answer the question below. [/INST]\nDocumentation: [RETRIEVED_RESULTS_FROM_BOOK] [INST] Answer the following question: {question} [/INST]\nAnswer:
|
| 292 |
)
|
| 293 |
elif retriever == "google_search":
|
| 294 |
retrieved_results = google_search(prompt)
|
|
@@ -298,7 +298,7 @@ def text_to_text_generation(verbose, prompt):
|
|
| 298 |
print('Google search prompt:')
|
| 299 |
print(
|
| 300 |
(
|
| 301 |
-
f"You are a helpful kubernetes professional. [INST] Use the following documentation, if it is relevant to answer the question below. [/INST]\nDocumentation: [RETRIEVED_RESULTS_FROM_GOOGLE] [INST] Answer the following question: {question} [/INST]\nAnswer
|
| 302 |
)
|
| 303 |
)
|
| 304 |
|
|
@@ -308,7 +308,7 @@ def text_to_text_generation(verbose, prompt):
|
|
| 308 |
f"### Step 2: Retrieving documentation from Google.\n"
|
| 309 |
f"{retrieved_results}\n"
|
| 310 |
f"### Step 3: Creating full prompt given to model\n"
|
| 311 |
-
f"You are a helpful kubernetes professional. [INST] Use the following documentation, if it is relevant to answer the question below. [/INST]\nDocumentation: [RETRIEVED_RESULTS_FROM_GOOGLE] [INST] Answer the following question: {question} [/INST]\nAnswer:
|
| 312 |
)
|
| 313 |
else:
|
| 314 |
prompt = f"[INST] Answer the following question: {prompt} [/INST]\nAnswer: "
|
|
@@ -445,12 +445,12 @@ def text_to_text_generation(verbose, prompt):
|
|
| 445 |
f"{str_to_md(res_normal)}\n\n"
|
| 446 |
f"--------------------------------------------\n"
|
| 447 |
f"# Answer with RAG\n"
|
| 448 |
-
f"## Section 1: Preparing for generation\n\n
|
| 449 |
-
f"## Section 2: Generating answer\n\n
|
| 450 |
f"--------------------------------------------\n"
|
| 451 |
f"# Answer with Google search\n"
|
| 452 |
-
f"## Section 1: Preparing for generation\n\n
|
| 453 |
-
f"## Section 2: Generating answer\n\n
|
| 454 |
)
|
| 455 |
else:
|
| 456 |
return (
|
|
@@ -459,9 +459,9 @@ def text_to_text_generation(verbose, prompt):
|
|
| 459 |
f"--------------------------------------------\n"
|
| 460 |
f"# Classified your prompt as:\n"
|
| 461 |
f"{modes}\n\n"
|
| 462 |
-
f"# Answer with finetuned model\n\n
|
| 463 |
-
f"# Answer with RAG\n\n
|
| 464 |
-
f"# Answer with Google search\n\n
|
| 465 |
)
|
| 466 |
|
| 467 |
|
|
|
|
| 280 |
|
| 281 |
)
|
| 282 |
retrieved_results = semantic_search(prompt)
|
| 283 |
+
prompt = f"You are a helpful kubernetes professional. [INST] Use the following documentation, if it is relevant to answer the question below. [/INST]\nDocumentation: {retrieved_results} </s>\n<s> [INST] Answer the following question: {prompt} [/INST]\nAnswer:\n\n"
|
| 284 |
|
| 285 |
md = (
|
| 286 |
f"### Step 1: Preparing prompt for additional documentation\n"
|
|
|
|
| 288 |
f"### Step 2: Retrieving documentation from a book.\n"
|
| 289 |
f"{retrieved_results}\n"
|
| 290 |
f"### Step 3: Creating full prompt given to model\n"
|
| 291 |
+
f"You are a helpful kubernetes professional. [INST] Use the following documentation, if it is relevant to answer the question below. [/INST]\nDocumentation: [RETRIEVED_RESULTS_FROM_BOOK] [INST] Answer the following question: {question} [/INST]\nAnswer:"
|
| 292 |
)
|
| 293 |
elif retriever == "google_search":
|
| 294 |
retrieved_results = google_search(prompt)
|
|
|
|
| 298 |
print('Google search prompt:')
|
| 299 |
print(
|
| 300 |
(
|
| 301 |
+
f"You are a helpful kubernetes professional. [INST] Use the following documentation, if it is relevant to answer the question below. [/INST]\nDocumentation: [RETRIEVED_RESULTS_FROM_GOOGLE] [INST] Answer the following question: {question} [/INST]\nAnswer:\n\n"
|
| 302 |
)
|
| 303 |
)
|
| 304 |
|
|
|
|
| 308 |
f"### Step 2: Retrieving documentation from Google.\n"
|
| 309 |
f"{retrieved_results}\n"
|
| 310 |
f"### Step 3: Creating full prompt given to model\n"
|
| 311 |
+
f"You are a helpful kubernetes professional. [INST] Use the following documentation, if it is relevant to answer the question below. [/INST]\nDocumentation: [RETRIEVED_RESULTS_FROM_GOOGLE] [INST] Answer the following question: {question} [/INST]\nAnswer:"
|
| 312 |
)
|
| 313 |
else:
|
| 314 |
prompt = f"[INST] Answer the following question: {prompt} [/INST]\nAnswer: "
|
|
|
|
| 445 |
f"{str_to_md(res_normal)}\n\n"
|
| 446 |
f"--------------------------------------------\n"
|
| 447 |
f"# Answer with RAG\n"
|
| 448 |
+
f"## Section 1: Preparing for generation \n\n{res_semantic_search_md} \n\n"
|
| 449 |
+
f"## Section 2: Generating answer \n\n{str_to_md(res_semantic_search.strip())} \n\n"
|
| 450 |
f"--------------------------------------------\n"
|
| 451 |
f"# Answer with Google search\n"
|
| 452 |
+
f"## Section 1: Preparing for generation \n\n{res_google_search_md} \n\n"
|
| 453 |
+
f"## Section 2: Generating answer \n\n{str_to_md(res_google_search.strip())} \n\n"
|
| 454 |
)
|
| 455 |
else:
|
| 456 |
return (
|
|
|
|
| 459 |
f"--------------------------------------------\n"
|
| 460 |
f"# Classified your prompt as:\n"
|
| 461 |
f"{modes}\n\n"
|
| 462 |
+
f"# Answer with finetuned model \n\n{str_to_md(res_normal)} \n\n"
|
| 463 |
+
f"# Answer with RAG \n\n{str_to_md(res_semantic_search.strip())} \n\n"
|
| 464 |
+
f"# Answer with Google search \n\n{str_to_md(res_google_search)} \n\n"
|
| 465 |
)
|
| 466 |
|
| 467 |
|