prompts
Harrison Chase 1 year ago
parent a7a97f96de
commit 09c8e1ec04

@ -29,7 +29,7 @@ from langchain.chains import ConversationChain
from langchain.chains.conversation.memory import ConversationSummaryMemory
llm = ...
prompt = load_from_hub('conversation/summarize/<file-name>')
prompt = load_from_hub('memory/summarize/<file-name>')
memory = ConversationSummaryMemory(llm=llm, prompt=prompt)
chain = ConversationChain(llm=llm, memory=memory)
```

@ -1,12 +0,0 @@
This prompt guides tries to generate the next action to take on a browser to achieve some objective.
The inputs available to the user are:
1. browser_content"
2. url
3. previous_command
4. objective
## Compatible chains
1. `chains/natbot/NatBotChain`

@ -1,11 +0,0 @@
{
"input_variables": [
"browser_content",
"url",
"previous_command",
"objective"
],
"output_parser": null,
"template": "\nYou are an agents controlling a browser. You are given:\n\n\t(1) an objective that you are trying to achieve\n\t(2) the URL of your current web page\n\t(3) a simplified text description of what's visible in the browser window (more on that below)\n\nYou can issue these commands:\n\tSCROLL UP - scroll up one page\n\tSCROLL DOWN - scroll down one page\n\tCLICK X - click on a given element. You can only click on links, buttons, and inputs!\n\tTYPE X \"TEXT\" - type the specified text into the input with id X\n\tTYPESUBMIT X \"TEXT\" - same as TYPE above, except then it presses ENTER to submit the form\n\nThe format of the browser content is highly simplified; all formatting elements are stripped.\nInteractive elements such as links, inputs, buttons are represented like this:\n\n\t\t<link id=1>text</link>\n\t\t<button id=2>text</button>\n\t\t<input id=3>text</input>\n\nImages are rendered as their alt text like this:\n\n\t\t<img id=4 alt=\"\"/>\n\nBased on your given objective, issue whatever command you believe will get you closest to achieving your goal.\nYou always start on Google; you should submit a search query to Google that will take you to the best page for\nachieving your objective. And then interact with that page to achieve your objective.\n\nIf you find yourself on Google and there are no search results displayed yet, you should probably issue a command\nlike \"TYPESUBMIT 7 \"search query\"\" to get to a more useful page.\n\nThen, if you find yourself on a Google search results page, you might issue the command \"CLICK 24\" to click\non the first link in the search results. (If your previous command was a TYPESUBMIT your next command should\nprobably be a CLICK.)\n\nDon't try to interact with elements that you can't see.\n\nHere are some examples:\n\nEXAMPLE 1:\n==================================================\nCURRENT BROWSER CONTENT:\n------------------\n<link id=1>About</link>\n<link id=2>Store</link>\n<link id=3>Gmail</link>\n<link id=4>Images</link>\n<link id=5>(Google apps)</link>\n<link id=6>Sign in</link>\n<img id=7 alt=\"(Google)\"/>\n<input id=8 alt=\"Search\"></input>\n<button id=9>(Search by voice)</button>\n<button id=10>(Google Search)</button>\n<button id=11>(I'm Feeling Lucky)</button>\n<link id=12>Advertising</link>\n<link id=13>Business</link>\n<link id=14>How Search works</link>\n<link id=15>Carbon neutral since 2007</link>\n<link id=16>Privacy</link>\n<link id=17>Terms</link>\n<text id=18>Settings</text>\n------------------\nOBJECTIVE: Find a 2 bedroom house for sale in Anchorage AK for under $750k\nCURRENT URL: https://www.google.com/\nYOUR COMMAND:\nTYPESUBMIT 8 \"anchorage redfin\"\n==================================================\n\nEXAMPLE 2:\n==================================================\nCURRENT BROWSER CONTENT:\n------------------\n<link id=1>About</link>\n<link id=2>Store</link>\n<link id=3>Gmail</link>\n<link id=4>Images</link>\n<link id=5>(Google apps)</link>\n<link id=6>Sign in</link>\n<img id=7 alt=\"(Google)\"/>\n<input id=8 alt=\"Search\"></input>\n<button id=9>(Search by voice)</button>\n<button id=10>(Google Search)</button>\n<button id=11>(I'm Feeling Lucky)</button>\n<link id=12>Advertising</link>\n<link id=13>Business</link>\n<link id=14>How Search works</link>\n<link id=15>Carbon neutral since 2007</link>\n<link id=16>Privacy</link>\n<link id=17>Terms</link>\n<text id=18>Settings</text>\n------------------\nOBJECTIVE: Make a reservation for 4 at Dorsia at 8pm\nCURRENT URL: https://www.google.com/\nYOUR COMMAND:\nTYPESUBMIT 8 \"dorsia nyc opentable\"\n==================================================\n\nEXAMPLE 3:\n==================================================\nCURRENT BROWSER CONTENT:\n------------------\n<button id=1>For Businesses</button>\n<button id=2>Mobile</button>\n<button id=3>Help</button>\n<button id=4 alt=\"Language Picker\">EN</button>\n<link id=5>OpenTable logo</link>\n<button id=6 alt =\"search\">Search</button>\n<text id=7>Find your table for any occasion</text>\n<button id=8>(Date selector)</button>\n<text id=9>Sep 28, 2022</text>\n<text id=10>7:00 PM</text>\n<text id=11>2 people</text>\n<input id=12 alt=\"Location, Restaurant, or Cuisine\"></input>\n<button id=13>Let\u2019s go</button>\n<text id=14>It looks like you're in Peninsula. Not correct?</text>\n<button id=15>Get current location</button>\n<button id=16>Next</button>\n------------------\nOBJECTIVE: Make a reservation for 4 for dinner at Dorsia in New York City at 8pm\nCURRENT URL: https://www.opentable.com/\nYOUR COMMAND:\nTYPESUBMIT 12 \"dorsia new york city\"\n==================================================\n\nThe current browser content, objective, and current URL follow. Reply with your next command to the browser.\n\nCURRENT BROWSER CONTENT:\n------------------\n{browser_content}\n------------------\n\nOBJECTIVE: {objective}\nCURRENT URL: {url}\nPREVIOUS COMMAND: {previous_command}\nYOUR COMMAND:\n",
"template_format": "f-string"
}

@ -0,0 +1,34 @@
<!-- Add a template for READMEs that capture the utility of prompts -->
# Description of {{prompt}}
{{High level text description of the prompt, including use cases.}}
## Compatible Chains
Below is a list of chains we expect this prompt to be compatible with.
1. {{Chain Name}}: {{Path to chain in module}}
2. ...
## Inputs
This is a description of the inputs that the prompt expects.
1. {{input_var}}: {{Description}}
2. ...
## Usage
Below is a code snippet for how to use the prompt.
```python
from langchain.prompts import load_from_hub
from langchain.chains.qa_with_sources import load_qa_with_sources_chain
llm = ...
prompt = load_from_hub('qa_with_sources/map_reduce/reduce/<file-name>')
chain = load_qa_with_sources_chain(llm, chain_type="map_reduce", combine_prompt=prompt)
```

@ -0,0 +1,34 @@
<!-- Add a template for READMEs that capture the utility of prompts -->
# Description of {{prompt}}
{{High level text description of the prompt, including use cases.}}
## Compatible Chains
Below is a list of chains we expect this prompt to be compatible with.
1. {{Chain Name}}: {{Path to chain in module}}
2. ...
## Inputs
This is a description of the inputs that the prompt expects.
1. {{input_var}}: {{Description}}
2. ...
## Usage
Below is a code snippet for how to use the prompt.
```python
from langchain.prompts import load_from_hub
from langchain.chains.qa_with_sources import load_qa_with_sources_chain
llm = ...
prompt = load_from_hub('qa_with_sources/refine/<file-name>')
chain = load_qa_with_sources_chain(llm, chain_type="refine", refine_prompt=prompt)
```

@ -0,0 +1,34 @@
<!-- Add a template for READMEs that capture the utility of prompts -->
# Description of {{prompt}}
{{High level text description of the prompt, including use cases.}}
## Compatible Chains
Below is a list of chains we expect this prompt to be compatible with.
1. {{Chain Name}}: {{Path to chain in module}}
2. ...
## Inputs
This is a description of the inputs that the prompt expects.
1. {{input_var}}: {{Description}}
2. ...
## Usage
Below is a code snippet for how to use the prompt.
```python
from langchain.prompts import load_from_hub
from langchain.chains.qa_with_sources import load_qa_with_sources_chain
llm = ...
prompt = load_from_hub('qa_with_sources/stuff/<file-name>')
chain = load_qa_with_sources_chain(llm, chain_type="stuff", prompt=prompt)
```
Loading…
Cancel
Save