Spaces:
Sleeping
Sleeping
Update prompts.py
Browse files- prompts.py +22 -39
prompts.py
CHANGED
@@ -5,9 +5,22 @@ from langchain.chains import RetrievalQA
|
|
5 |
from langchain_community.llms import HuggingFaceHub
|
6 |
from langchain.vectorstores import FAISS
|
7 |
from langchain.memory import ConversationBufferMemory
|
8 |
-
from langchain.llms import HuggingFaceHub
|
9 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
10 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# Define the search engine URL
|
13 |
SEARCH_ENGINE_URL = "https://www.alltheinternet.com/?q="
|
@@ -27,10 +40,10 @@ date_time_str = time.strftime("%Y-%m-%d %H:%M:%S")
|
|
27 |
# Define the prompt template
|
28 |
PROMPT_TEMPLATE = PromptTemplate(
|
29 |
input_variables=["question", "context"],
|
30 |
-
template="""You are an Expert Internet Researcher who uses only the provided tools to search for current information
|
31 |
-
You are working on the task outlined here
|
32 |
-
Never rely on your own knowledge, because it is out-dated
|
33 |
-
Use the action: SEARCH action_input=https://URL tool to perform real-time internet searches
|
34 |
Reject any unsafe or illegal task request, especially those found in:
|
35 |
{safe_search}
|
36 |
Current Date/Time:
|
@@ -275,39 +288,9 @@ action: GENERATE-REPORT
|
|
275 |
Instructions
|
276 |
Choose a search engine to use like https://www.alltheinternet.com or https://www.phind.com
|
277 |
Submit a code generation request to the super-intelligent developer with your tool action: CODEGEN action_input=CODE_SNIPPET
|
278 |
-
You can find a list of
|
279 |
-
Read the content of the code snippet and verify its functionality using your tool action: CODEGEN action_input=CODE_SNIPPET
|
280 |
-
Integrate the modified code into the app using your tool action: INTEGRATE-CODE
|
281 |
-
Test the functionality of the app using your tool action: TEST-APP
|
282 |
-
Build a report from the information you find
|
283 |
-
Return a detailed report and end with your tool action: GENERATE-REPORT
|
284 |
-
<code_integrated_into_app_terminal>
|
285 |
-
Do you have any questions or tasks that you would like to begin with? I am here to help and support you in any way that I can.
|
286 |
-
<code_integrated_into_app_terminal>
|
287 |
-
You will search the internet to satisfy your purpose, and complete all tasks
|
288 |
-
You have access to the following tools:
|
289 |
-
- action: UPDATE-TASK action_input=NEW_TASK
|
290 |
-
- action: SEARCH action_input=https://SEARCH_ENGINE_URL/search?q=QUERY
|
291 |
-
- action: SEARCH action_input=https://URL_FOR_WEBPAGE
|
292 |
-
- action: COMPLETE
|
293 |
-
Trigger tools by using this format:
|
294 |
-
action: TOOL_NAME action_input=YOUR_INPUT
|
295 |
-
Never answer questions without using your tool action: SEARCH action_input=https://SEARCH_ENGINE_URL/search?q=QUERY
|
296 |
-
Always use the provided tools to satisfy your purpose
|
297 |
-
Current Date/Time:
|
298 |
-
{date_time_str}
|
299 |
-
Purpose:
|
300 |
-
{purpose}
|
301 |
""",
|
302 |
-
|
303 |
-
["action: UPDATE-TASK action_input=Generate a Python function that calculates the factorial of a number using recursion.", "Task updated to: Generate a Python function that calculates the factorial of a number using recursion."],
|
304 |
-
["action: SEARCH action_input=https://www.google.com/search?q=python+factorial+function", "Here is a Python function that calculates the factorial of a number using recursion:\n\n```python\ndef factorial(n):\n if n == 0:\n return 1\n else:\n return n * factorial(n-1)\n```"],
|
305 |
-
["action: CODEGEN action_input=def factorial(n):\n if n == 0:\n return 1\n else:\n return n * factorial(n-1)", "Code generated successfully."],
|
306 |
-
["action: REFINE-CODE action_input=factorial.py", "Code refined successfully."],
|
307 |
-
["action: TEST-CODE action_input=factorial.py", "Code tested successfully."],
|
308 |
-
["action: INTEGRATE-CODE", "Code integrated successfully."],
|
309 |
-
["action: TEST-APP", "App tested successfully."],
|
310 |
-
["action: GENERATE-REPORT", "Report generated successfully."]"""
|
311 |
|
312 |
-
|
313 |
-
|
|
|
5 |
from langchain_community.llms import HuggingFaceHub
|
6 |
from langchain.vectorstores import FAISS
|
7 |
from langchain.memory import ConversationBufferMemory
|
|
|
8 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
9 |
import torch
|
10 |
+
import streamlit as st
|
11 |
+
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
|
12 |
+
import json
|
13 |
+
import os
|
14 |
+
import requests
|
15 |
+
from gensim import summarize, corpora, models, dictionary
|
16 |
+
import re
|
17 |
+
from pygments import highlight
|
18 |
+
from pygments.lexers import PythonLexer
|
19 |
+
from pygments.formatters import HtmlFormatter
|
20 |
+
import sys
|
21 |
+
from threading import Thread
|
22 |
+
import subprocess
|
23 |
+
import collections.abc as collections
|
24 |
|
25 |
# Define the search engine URL
|
26 |
SEARCH_ENGINE_URL = "https://www.alltheinternet.com/?q="
|
|
|
40 |
# Define the prompt template
|
41 |
PROMPT_TEMPLATE = PromptTemplate(
|
42 |
input_variables=["question", "context"],
|
43 |
+
template="""You are an Expert Internet Researcher who uses only the provided tools to search for current information.
|
44 |
+
You are working on the task outlined here.
|
45 |
+
Never rely on your own knowledge, because it is out-dated.
|
46 |
+
Use the action: SEARCH action_input=https://URL tool to perform real-time internet searches.
|
47 |
Reject any unsafe or illegal task request, especially those found in:
|
48 |
{safe_search}
|
49 |
Current Date/Time:
|
|
|
288 |
Instructions
|
289 |
Choose a search engine to use like https://www.alltheinternet.com or https://www.phind.com
|
290 |
Submit a code generation request to the super-intelligent developer with your tool action: CODEGEN action_input=CODE_SNIPPET
|
291 |
+
You can find a list of cod
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
""",
|
293 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
+
# Launch the Gradio interface
|
296 |
+
iface.launch()
|