id stringlengths 14 16 | text stringlengths 45 2.73k | source stringlengths 49 114 |
|---|---|---|
4a8391f6f232-0 | .ipynb
.pdf
Bash
Bash#
It can often be useful to have an LLM generate bash commands, and then run them. A common use case for this is letting the LLM interact with your local file system. We provide an easy util to execute bash commands.
from langchain.utilities import BashProcess
bash = BashProcess()
print(bash.run("l... | https://python.langchain.com/en/latest/modules/agents/tools/examples/bash.html |
e9110e510218-0 | .ipynb
.pdf
Bing Search
Contents
Number of results
Metadata Results
Bing Search#
This notebook goes over how to use the bing search component.
First, you need to set up the proper API keys and environment variables. To set it up, follow the instructions found here.
Then we will need to set some environment variables.... | https://python.langchain.com/en/latest/modules/agents/tools/examples/bing_search.html |
e9110e510218-1 | 'Thanks to the flexibility of <b>Python</b> and the powerful ecosystem of packages, the Azure CLI supports features such as autocompletion (in shells that support it), persistent credentials, JMESPath result parsing, lazy initialization, network-less unit tests, and more. Building an open-source and cross-platform Azur... | https://python.langchain.com/en/latest/modules/agents/tools/examples/bing_search.html |
e9110e510218-2 | assignment operator.It adds two values and assigns the sum to a variable (left operand). W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, <b>Python</b>, SQL, Java, and many, many more. This tutorial introduces t... | https://python.langchain.com/en/latest/modules/agents/tools/examples/bing_search.html |
e9110e510218-3 | To install <b>Python</b> using the Microsoft Store: Go to your Start menu (lower left Windows icon), type "Microsoft Store", select the link to open the store. Once the store is open, select Search from the upper-right menu and enter "<b>Python</b>". Select which version of <b>Python</b> you would l... | https://python.langchain.com/en/latest/modules/agents/tools/examples/bing_search.html |
e9110e510218-4 | Number of results#
You can use the k parameter to set the number of results
search = BingSearchAPIWrapper(k=1)
search.run("python")
'Thanks to the flexibility of <b>Python</b> and the powerful ecosystem of packages, the Azure CLI supports features such as autocompletion (in shells that support it), persistent credentia... | https://python.langchain.com/en/latest/modules/agents/tools/examples/bing_search.html |
e9110e510218-5 | {'snippet': '<b>Apples</b> boast many vitamins and minerals, though not in high amounts. However, <b>apples</b> are usually a good source of vitamin C. Vitamin C. Also called ascorbic acid, this vitamin is a common ...',
'title': 'Apples 101: Nutrition Facts and Health Benefits',
'link': 'https://www.healthline.com... | https://python.langchain.com/en/latest/modules/agents/tools/examples/bing_search.html |
be945bdedb0a-0 | .ipynb
.pdf
ChatGPT Plugins
ChatGPT Plugins#
This example shows how to use ChatGPT Plugins within LangChain abstractions.
Note 1: This currently only works for plugins with no auth.
Note 2: There are almost certainly other ways to do this, this is just a first pass. If you have better ideas, please open a PR!
from lang... | https://python.langchain.com/en/latest/modules/agents/tools/examples/chatgpt_plugins.html |
be945bdedb0a-1 | OpenAPI Spec: {'openapi': '3.0.1', 'info': {'version': 'v0', 'title': 'Open AI Klarna product Api'}, 'servers': [{'url': 'https://www.klarna.com/us/shopping'}], 'tags': [{'name': 'open-ai-product-endpoint', 'description': 'Open AI Product Endpoint. Query for products.'}], 'paths': {'/public/openai/v0/products': {'get':... | https://python.langchain.com/en/latest/modules/agents/tools/examples/chatgpt_plugins.html |
be945bdedb0a-2 | {'schema': {'$ref': '#/components/schemas/ProductResponse'}}}}, '503': {'description': 'one or more services are unavailable'}}, 'deprecated': False}}}, 'components': {'schemas': {'Product': {'type': 'object', 'properties': {'attributes': {'type': 'array', 'items': {'type': 'string'}}, 'name': {'type': 'string'}, 'pric... | https://python.langchain.com/en/latest/modules/agents/tools/examples/chatgpt_plugins.html |
be945bdedb0a-3 | Thought:I need to use the Klarna Shopping API to search for t shirts.
Action: requests_get
Action Input: https://www.klarna.com/us/shopping/public/openai/v0/products?q=t%20shirts | https://python.langchain.com/en/latest/modules/agents/tools/examples/chatgpt_plugins.html |
be945bdedb0a-4 | Observation: {"products":[{"name":"Lacoste Men's Pack of Plain T-Shirts","url":"https://www.klarna.com/us/shopping/pl/cl10001/3202043025/Clothing/Lacoste-Men-s-Pack-of-Plain-T-Shirts/?utm_source=openai","price":"$26.60","attributes":["Material:Cotton","Target Group:Man","Color:White,Black"]},{"name":"Hanes Men's Ultima... | https://python.langchain.com/en/latest/modules/agents/tools/examples/chatgpt_plugins.html |
be945bdedb0a-5 | Comfort T-shirts Men's 3-pack","url":"https://www.klarna.com/us/shopping/pl/cl10001/3202640533/Clothing/adidas-Comfort-T-shirts-Men-s-3-pack/?utm_source=openai","price":"$14.99","attributes":["Material:Cotton","Target Group:Man","Color:White,Black","Neckline:Round"]}]} | https://python.langchain.com/en/latest/modules/agents/tools/examples/chatgpt_plugins.html |
be945bdedb0a-6 | Thought:The available t shirts in Klarna are Lacoste Men's Pack of Plain T-Shirts, Hanes Men's Ultimate 6pk. Crewneck T-Shirts, Nike Boy's Jordan Stretch T-shirts, Polo Classic Fit Cotton V-Neck T-Shirts 3-Pack, and adidas Comfort T-shirts Men's 3-pack.
Final Answer: The available t shirts in Klarna are Lacoste Men's P... | https://python.langchain.com/en/latest/modules/agents/tools/examples/chatgpt_plugins.html |
5abe4488e806-0 | .ipynb
.pdf
DuckDuckGo Search
DuckDuckGo Search#
This notebook goes over how to use the duck-duck-go search component.
# !pip install duckduckgo-search
from langchain.tools import DuckDuckGoSearchTool
search = DuckDuckGoSearchTool()
search.run("Obama's first name?") | https://python.langchain.com/en/latest/modules/agents/tools/examples/ddg.html |
5abe4488e806-1 | 'Barack Obama, in full Barack Hussein Obama II, (born August 4, 1961, Honolulu, Hawaii, U.S.), 44th president of the United States (2009-17) and the first African American to hold the office. Before winning the presidency, Obama represented Illinois in the U.S. Senate (2005-08). Barack Hussein Obama II (/ b ə ˈ r ɑː k ... | https://python.langchain.com/en/latest/modules/agents/tools/examples/ddg.html |
5abe4488e806-2 | previous
ChatGPT Plugins
next
Google Places
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 21, 2023. | https://python.langchain.com/en/latest/modules/agents/tools/examples/ddg.html |
f6bdf0992a92-0 | .ipynb
.pdf
Google Places
Google Places#
This notebook goes through how to use Google Places API
#!pip install googlemaps
import os
os.environ["GPLACES_API_KEY"] = ""
from langchain.tools import GooglePlacesTool
places = GooglePlacesTool()
places.run("al fornos")
"1. Delfina Restaurant\nAddress: 3621 18th St, San Franc... | https://python.langchain.com/en/latest/modules/agents/tools/examples/google_places.html |
17996682fe9c-0 | .ipynb
.pdf
Google Search
Contents
Number of Results
Metadata Results
Google Search#
This notebook goes over how to use the google search component.
First, you need to set up the proper API keys and environment variables. To set it up, create the GOOGLE_API_KEY in the Google Cloud credential console (https://console.... | https://python.langchain.com/en/latest/modules/agents/tools/examples/google_search.html |
17996682fe9c-1 | '1 Child\'s First Name. 2. 6. 7d. Street Address. 71. (Type or print). BARACK. Sex. 3. This Birth. 4. If Twin or Triplet,. Was Child Born. Barack Hussein Obama II is an American retired politician who served as the 44th president of the United States from 2009 to 2017. His full name is Barack Hussein Obama II. Since th... | https://python.langchain.com/en/latest/modules/agents/tools/examples/google_search.html |
17996682fe9c-2 | Number of Results#
You can use the k parameter to set the number of results
search = GoogleSearchAPIWrapper(k=1)
search.run("python")
'The official home of the Python Programming Language.'
‘The official home of the Python Programming Language.’
Metadata Results#
Run query through GoogleSearch and return snippet, title... | https://python.langchain.com/en/latest/modules/agents/tools/examples/google_search.html |
17996682fe9c-3 | 'title': 'Apples: Benefits, nutrition, and tips',
'link': 'https://www.medicalnewstoday.com/articles/267290'},
{'snippet': "An apple is a crunchy, bright-colored fruit, one of the most popular in the United States. You've probably heard the age-old saying, “An apple a day keeps\xa0...",
'title': 'Apples: Nutrition... | https://python.langchain.com/en/latest/modules/agents/tools/examples/google_search.html |
d65a9d4c3915-0 | .ipynb
.pdf
Google Serper API
Contents
As part of a Self Ask With Search Chain
Google Serper API#
This notebook goes over how to use the Google Serper component to search the web. First you need to sign up for a free account at serper.dev and get your api key.
import os
os.environ["SERPER_API_KEY"] = ""
from langchai... | https://python.langchain.com/en/latest/modules/agents/tools/examples/google_serper.html |
d65a9d4c3915-1 | 'El Palmar, Spain'
previous
Google Search
next
Gradio Tools
Contents
As part of a Self Ask With Search Chain
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 21, 2023. | https://python.langchain.com/en/latest/modules/agents/tools/examples/google_serper.html |
4eb9a6412a45-0 | .ipynb
.pdf
Gradio Tools
Contents
Using a tool
Using within an agent
Gradio Tools#
There are many 1000s of Gradio apps on Hugging Face Spaces. This library puts them at the tips of your LLM’s fingers 🦾
Specifically, gradio-tools is a Python library for converting Gradio apps into tools that can be leveraged by a lar... | https://python.langchain.com/en/latest/modules/agents/tools/examples/gradio_tools.html |
4eb9a6412a45-1 | display(im)
Using within an agent#
from langchain.agents import initialize_agent
from langchain.llms import OpenAI
from gradio_tools.tools import (StableDiffusionTool, ImageCaptioningTool, StableDiffusionPromptGeneratorTool,
TextToVideoTool)
from langchain.memory import ConversationBuffe... | https://python.langchain.com/en/latest/modules/agents/tools/examples/gradio_tools.html |
4eb9a6412a45-2 | Thought: Do I need to use a tool? Yes
Action: StableDiffusion
Action Input: A dog riding a skateboard, digital painting, artstation, concept art, smooth, sharp focus, illustration, art by artgerm and greg rutkowski and alphonse mucha
Job Status: Status.STARTING eta: None
Job Status: Status.PROCESSING eta: None
Observat... | https://python.langchain.com/en/latest/modules/agents/tools/examples/gradio_tools.html |
4eb9a6412a45-3 | Job Status: Status.IN_QUEUE eta: 42.49370198879602
Job Status: Status.IN_QUEUE eta: 21.314297944849187
Observation: /var/folders/bm/ylzhm36n075cslb9fvvbgq640000gn/T/tmp5snj_nmzf20_cb3m.mp4
Thought: Do I need to use a tool? No
AI: Here is a video of a painting of a dog sitting on a skateboard.
> Finished chain.
previous... | https://python.langchain.com/en/latest/modules/agents/tools/examples/gradio_tools.html |
ddf0613e41db-0 | .ipynb
.pdf
Human as a tool
Human as a tool#
Human are AGI so they can certainly be used as a tool to help out AI agent
when it is confused.
import sys
from langchain.chat_models import ChatOpenAI
from langchain.llms import OpenAI
from langchain.agents import load_tools, initialize_agent
from langchain.agents import Ag... | https://python.langchain.com/en/latest/modules/agents/tools/examples/human_tools.html |
ddf0613e41db-1 | Action: Calculator
Action Input: "Is 2021 a leap year?"
Observation: Answer: False
Thought:I have all the information I need to answer the original question.
Final Answer: Eric Zhu's birthday is on August 1st and it is not a leap year in 2021.
> Finished chain.
"Eric Zhu's birthday is on August 1st and it is not a leap... | https://python.langchain.com/en/latest/modules/agents/tools/examples/human_tools.html |
fa841cf987cc-0 | .ipynb
.pdf
IFTTT WebHooks
Contents
Creating a webhook
Configuring the “If This”
Configuring the “Then That”
Finishing up
IFTTT WebHooks#
This notebook shows how to use IFTTT Webhooks.
From https://github.com/SidU/teams-langchain-js/wiki/Connecting-IFTTT-Services.
Creating a webhook#
Go to https://ifttt.com/create
Co... | https://python.langchain.com/en/latest/modules/agents/tools/examples/ifttt.html |
fa841cf987cc-1 | service, and you’re ready to start receiving data and triggering actions 🎉
Finishing up#
To get your webhook URL go to https://ifttt.com/maker_webhooks/settings
Copy the IFTTT key value from there. The URL is of the form
https://maker.ifttt.com/use/YOUR_IFTTT_KEY. Grab the YOUR_IFTTT_KEY value.
from langchain.tools.if... | https://python.langchain.com/en/latest/modules/agents/tools/examples/ifttt.html |
030a385d30c9-0 | .ipynb
.pdf
OpenWeatherMap API
OpenWeatherMap API#
This notebook goes over how to use the OpenWeatherMap component to fetch weather information.
First, you need to sign up for an OpenWeatherMap API key:
Go to OpenWeatherMap and sign up for an API key here
pip install pyowm
Then we will need to set some environment vari... | https://python.langchain.com/en/latest/modules/agents/tools/examples/openweathermap.html |
13c915ae02cd-0 | .ipynb
.pdf
Python REPL
Python REPL#
Sometimes, for complex calculations, rather than have an LLM generate the answer directly, it can be better to have the LLM generate code to calculate the answer, and then run that code to get the answer. In order to easily do that, we provide a simple Python REPL to execute command... | https://python.langchain.com/en/latest/modules/agents/tools/examples/python.html |
28982a3cd6d3-0 | .ipynb
.pdf
Requests
Requests#
The web contains a lot of information that LLMs do not have access to. In order to easily let LLMs interact with that information, we provide a wrapper around the Python Requests module that takes in a URL and fetches data from that URL.
from langchain.utilities import TextRequestsWrapper... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-1 | '<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world\'s information, including webpages, images, videos and more. Google has many special features to help you find exactly what you\'re looking for." name="description"><meta content="noodp" name="robots"... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-2 | nonce="skA52jTjrFARNMkurZZTjQ">(function(){window.google={kEI:\'5dkIZP3HJ4WPur8PmJ23iAc\',kEXPI:\'0,18168,772936,568305,6059,206,4804,2316,383,246,5,1129120,1197787,614,165,379924,16115,28684,22431,1361,12313,17586,4998,13228,37471,4820,887,1985,2891,3926,7828,606,29842,826,19390,10632,15324,432,3,346,1244,1,5444,149,1... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-3 | 7428,5821,2536,4094,7596,1,42154,2,14022,2373,342,23024,5679,1021,31121,4569,6258,23418,1252,5835,14967,4333,7484,445,2,2,1,24626,2006,8155,7381,2,3,15965,872,9626,10008,7,1922,5784,3995,19130,2261,14763,6304,2008,18192,927,14678,4531,14,82,16514,3692,109,1513,899,879,2226,2751,1854,1931,156,8524,2426,721,1021,904,1423... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-4 | 974,9,184,26,469,2238,5,1648,109,1127,450,6708,5318,1002,258,3392,1991,4,29,212,2,375,537,1046,314,1720,78,890,1861,1,1172,2275,129,29,632,274,599,731,1305,392,307,536,592,87,113,762,845,2552,3788,220,669,3,750,1174,601,310,611,27,54,49,398,51,238,1079,67,3232,710,1652,82,5,667,2077,544,3,15,2,24,497,977,40,338,224,119... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-5 | 393,1137,781,4,81,1558,241,104,5232351,297,152,8798692,3311,141,795,19735,302,46,23950484,553,4041590,1964,1008,15665,2893,512,5738,12560,1540,1218,146,1415332\',kBL:\'Td3a\'};google.sn=\'webhp\';google.kHL=\'en\';})();(function(){\nvar | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-6 | f=this||self;var h,k=[];function l(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||h}function m(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b}\nfunction n(a,b,c,d,g){var e="";c||-1!==b.search("&ei=")||(e="&ei="+l(d),-1===b.search("&l... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-7 | c=a.id;else{do c=Math.random();while(google.y[c])}google.y[c]=[a,b];return!1};google.sx=function(a){google.sy.push(a)};google.lm=[];google.plm=function(a){google.lm.push.apply(google.lm,a)};google.lq=[];google.load=function(a,b,c){google.lq.push([[a],b,c])};google.loadAll=function(a,b){google.lq.push([a,b])};google.bx=... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-8 | !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}\n</style><style>body,td,a,p,.h{font-family:arial,sans-serif}body{margin:0;overflow-y:scroll}#gog{padding:3px 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.h{color:#1558d6}em{f... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-9 | 0 -261px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px arial,sans-serif;vertical-align:top}.lsb:active{background:#dadce0}.lst:focus{outline:none}</style><script nonce="skA52jTjrFARNMkurZZTjQ">(function(){window.google.erd={jsr:1,bv:1756,de:true};\nvar h=this||self;var k,l=null... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-10 | f=a.lineNumber;void 0!==f&&(c+="&line="+f);var g=\na.fileName;g&&(0<g.indexOf("-extension:/")&&(e=3),c+="&script="+b(g),f&&g===window.location.href&&(f=document.documentElement.outerHTML.split("\\n")[f],c+="&cad="+b(f?f.substring(0,300):"No script found.")));c+="&jsel="+e;for(var u in d)c+="&",c+=b(u),c+="=",c+=b(d[u])... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-11 | window.n();if (document.images){new Image().src=src;}\nif (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();}\n}\n})();</script><div id="mngb"><div id=gbar><nobr><b class=gb1>Search</b> <a class=gb1 href="https://www.google.com/imghp?hl=en&tab=wi">Images</a> <a class=gb1 href="https://maps... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-12 | class=gb4>Web History</a> | <a href="/preferences?hl=en" class=gb4>Settings</a> | <a target=_top id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=en&passive=true&continue=https://www.google.com/&ec=GAZAAQ" class=gb4>Sign in</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div>... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-13 | Women\'s Day 2023" border="0" height="200" src="/logos/doodles/2023/international-womens-day-2023-6753651837109578-l.png" title="International Women\'s Day 2023" width="500" id="hplogo"><br></a><br></div><form action="/search" name="f"><table cellpadding="0" cellspacing="0"><tr valign="top"><td width="25%"> </td><... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-14 | Feeling Lucky" name="btnI" type="submit"><script nonce="skA52jTjrFARNMkurZZTjQ">(function(){var id=\'tsuid_1\';document.getElementById(id).onclick = function(){if (this.form.q.value){this.checked = 1;if (this.form.iflsig)this.form.iflsig.disabled = false;}\nelse top.location=\'/doodles/\';};})();</script><input value="... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-15 | f=google.gbvu,g=document.getElementById("gbv");g&&(g.value=a);f&&window.setTimeout(function(){location.href=f},0)};}).call(this);</script></form><div id="gac_scont"></div><div style="font-size:83%;min-height:3.5em"><br><div id="prm"><style>.szppmdbYutt__middle-slot-promo{font-size:small;margin-bottom:32px}.szppmdbYutt_... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-16 | id="footer"><div style="font-size:10pt"><div style="margin:19px auto;text-align:center" id="WqQANb"><a href="/intl/en/ads/">Advertising</a><a href="/services/">Business Solutions</a><a href="/intl/en/about.html">About Google</a></div></div><p style="font-size:8pt;color:#70757a">© 2023 - <a href="/intl/en/policies/... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-17 | nonce="skA52jTjrFARNMkurZZTjQ">(function(){var u=\'/xjs/_/js/k\\x3dxjs.hp.en.ObwAV4EjOBQ.O/am\\x3dAACgEwBAAYAF/d\\x3d1/ed\\x3d1/rs\\x3dACT90oGDUDSLlBIGF3CSmUWoHe0AKqeZ6w/m\\x3dsb_he,d\';var amd=0;\nvar d=this||self,e=function(a){return a};var g;var l=function(a,b){this.g=b===h?a:""};l.prototype.toString=function(){retu... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-18 | l&&a.constructor===l?a.g:"type_error:TrustedResourceUrl";var f,n;(f=(a=null==(n=(f=(c.ownerDocument&&c.ownerDocument.defaultView||window).document).querySelector)?void 0:n.call(f,"script[nonce]"))?a.nonce||a.getAttribute("nonce")||"":"")&&c.setAttribute("nonce",f);document.body.appendChild(c);google.psa=!0};google.xjsu... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-19 | Search\\x22,\\x22dym\\x22:\\x22Did you mean:\\x22,\\x22lcky\\x22:\\x22I\\\\u0026#39;m Feeling Lucky\\x22,\\x22lml\\x22:\\x22Learn more\\x22,\\x22psrc\\x22:\\x22This search was removed from your \\\\u003Ca href\\x3d\\\\\\x22/history\\\\\\x22\\\\u003EWeb History\\\\u003C/a\\\\u003E\\x22,\\x22psrl\\x22:\\x22Remove\\x22,\\... | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
28982a3cd6d3-20 | previous
Python REPL
next
Search Tools
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 21, 2023. | https://python.langchain.com/en/latest/modules/agents/tools/examples/requests.html |
0afea6a0de45-0 | .ipynb
.pdf
Search Tools
Contents
Google Serper API Wrapper
SerpAPI
GoogleSearchAPIWrapper
SearxNG Meta Search Engine
Search Tools#
This notebook shows off usage of various search tools.
from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.agents import AgentType
from l... | https://python.langchain.com/en/latest/modules/agents/tools/examples/search_tools.html |
0afea6a0de45-1 | Action: Search
Action Input: "weather in Pomfret"
Observation: Partly cloudy skies during the morning hours will give way to cloudy skies with light rain and snow developing in the afternoon. High 42F. Winds WNW at 10 to 15 ...
Thought: I now know the current weather in Pomfret.
Final Answer: Partly cloudy skies during... | https://python.langchain.com/en/latest/modules/agents/tools/examples/search_tools.html |
0afea6a0de45-2 | Action: Google Search
Action Input: "weather in Pomfret"
Observation: Showers early becoming a steady light rain later in the day. Near record high temperatures. High around 60F. Winds SW at 10 to 15 mph. Chance of rain 60%. Pomfret, CT Weather Forecast, with current conditions, wind, air quality, and what to expect fo... | https://python.langchain.com/en/latest/modules/agents/tools/examples/search_tools.html |
0afea6a0de45-3 | > Finished AgentExecutor chain.
'Showers early becoming a steady light rain later in the day. Near record high temperatures. High around 60F. Winds SW at 10 to 15 mph. Chance of rain 60%.'
SearxNG Meta Search Engine#
Here we will be using a self hosted SearxNG meta search engine.
tools = load_tools(["searx-search"], se... | https://python.langchain.com/en/latest/modules/agents/tools/examples/search_tools.html |
0afea6a0de45-4 | Pomfret, CT ; Current Weather. 1:06 AM. 35°F · RealFeel® 32° ; TODAY'S WEATHER FORECAST. 3/3. 44°Hi. RealFeel® 50° ; TONIGHT'S WEATHER FORECAST. 3/3. 32°Lo.
Pomfret, MD Forecast Today Hourly Daily Morning 41° 1% Afternoon 43° 0% Evening 35° 3% Overnight 34° 2% Don't Miss Finally, Here’s Why We Get More Colds and Flu Wh... | https://python.langchain.com/en/latest/modules/agents/tools/examples/search_tools.html |
0afea6a0de45-5 | Thought: I now know the final answer
Final Answer: The current weather in Pomfret is mainly cloudy with snow showers around in the morning. The temperature is around 40F with winds NNW at 5 to 10 mph. Chance of snow is 40%.
> Finished chain.
'The current weather in Pomfret is mainly cloudy with snow showers around in t... | https://python.langchain.com/en/latest/modules/agents/tools/examples/search_tools.html |
0f622935f49c-0 | .ipynb
.pdf
SearxNG Search API
Contents
Custom Parameters
Obtaining results with metadata
SearxNG Search API#
This notebook goes over how to use a self hosted SearxNG search API to search the web.
You can check this link for more informations about Searx API parameters.
import pprint
from langchain.utilities import S... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-1 | search.run("large language model ", engines=['wiki'])
'Large language models (LLMs) represent a major advancement in AI, with the promise of transforming domains through learned knowledge. LLM sizes have been increasing 10X every year for the last few years, and as these models grow in complexity and size, so do their ... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-2 | search.run("deep learning", language='es', engines=['wiki'])
'Aprendizaje profundo (en inglés, deep learning) es un conjunto de algoritmos de aprendizaje automático (en inglés, machine learning) que intenta modelar abstracciones de alto nivel en datos usando arquitecturas computacionales que admiten transformaciones no... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-3 | 'title': 'Promptchainer: Chaining large language model prompts through '
'visual programming',
'link': 'https://dl.acm.org/doi/abs/10.1145/3491101.3519729',
'engines': ['google scholar'],
'category': 'science'},
{'snippet': '… can introspect the large prompt model. We derive the view '
'ϕ... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-4 | 'link': 'https://arxiv.org/abs/2204.02329',
'engines': ['google scholar'],
'category': 'science'}]
Get papers from arxiv
results = search.results("Large Language Model prompt", num_results=5, engines=['arxiv'])
pprint.pp(results)
[{'snippet': 'Thanks to the advanced improvement of large pre-trained language '
... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-5 | 'development of real-world AES systems, yet it remains an '
'under-explored area of research. Models designed for '
'prompt-specific AES rely heavily on prompt-specific knowledge '
'and perform poorly in the cross-prompt setting, whereas current '
'approaches to cross... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-6 | 'example selection. We further explore the use of monolingual '
'data and the feasibility of cross-lingual, cross-domain, and '
'sentence-to-document transfer learning in prompting. Extensive '
'experiments with GLM-130B (Zeng et al., 2022) as the testbed '
'show that... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-7 | 'effective, especially when the prompts are natural language. In '
'this paper, we investigate common attributes shared by effective '
'prompts. We first propose a human readable prompt tuning method '
'(F LUENT P ROMPT) based on Langevin dynamics that incorporates a '
... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-8 | 'In this work, we discuss methods of prompt programming, '
'emphasizing the usefulness of considering prompts through the '
'lens of natural language. We explore techniques for exploiting '
'the capacity of narratives and cultural anchors to encode '
'nuanced intentio... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-9 | 'scripts and screenplays.',
'title': 'dramatron',
'link': 'https://github.com/deepmind/dramatron',
'engines': ['github'],
'category': 'it'}]
We could also directly query for results from github and other source forges.
results = search.results("large language model", num_results = 20, engines=['github', 'gitlab... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-10 | 'engines': ['github'],
'category': 'it'},
{'snippet': 'Code for loralib, an implementation of "LoRA: Low-Rank '
'Adaptation of Large Language Models"',
'title': 'LoRA',
'link': 'https://github.com/microsoft/LoRA',
'engines': ['github'],
'category': 'it'},
{'snippet': 'Code for the paper "Evalua... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-11 | 'engines': ['github'],
'category': 'it'},
{'snippet': 'Optimus: the first large-scale pre-trained VAE language model',
'title': 'Optimus',
'link': 'https://github.com/ChunyuanLI/Optimus',
'engines': ['github'],
'category': 'it'},
{'snippet': 'Seminar on Large Language Models (COMP790-101 at UNC Chapel '
... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-12 | 'link': 'https://github.com/bigscience-workshop/biomedical',
'engines': ['github'],
'category': 'it'},
{'snippet': 'ChatGPT @ Home: Large Language Model (LLM) chatbot application, '
'written by ChatGPT',
'title': 'ChatGPT-at-Home',
'link': 'https://github.com/Sentdex/ChatGPT-at-Home',
'engines':... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
0f622935f49c-13 | 'engines': ['github'],
'category': 'it'},
{'snippet': 'This repository contains the code, data, and models of the paper '
'titled "XL-Sum: Large-Scale Multilingual Abstractive '
'Summarization for 44 Languages" published in Findings of the '
'Association for Computational Lingu... | https://python.langchain.com/en/latest/modules/agents/tools/examples/searx_search.html |
179de8bd3101-0 | .ipynb
.pdf
SerpAPI
Contents
Custom Parameters
SerpAPI#
This notebook goes over how to use the SerpAPI component to search the web.
from langchain.utilities import SerpAPIWrapper
search = SerpAPIWrapper()
search.run("Obama's first name?")
'Barack Hussein Obama II'
Custom Parameters#
You can also customize the SerpAPI... | https://python.langchain.com/en/latest/modules/agents/tools/examples/serpapi.html |
0e271025b568-0 | .ipynb
.pdf
Wikipedia API
Wikipedia API#
This notebook goes over how to use the wikipedia component.
First, you need to install wikipedia python package.
pip install wikipedia
from langchain.utilities import WikipediaAPIWrapper
wikipedia = WikipediaAPIWrapper()
wikipedia.run('HUNTER X HUNTER') | https://python.langchain.com/en/latest/modules/agents/tools/examples/wikipedia.html |
0e271025b568-1 | 'Page: Hunter × Hunter\nSummary: Hunter × Hunter (stylized as HUNTER×HUNTER and pronounced "hunter hunter") is a Japanese manga series written and illustrated by Yoshihiro Togashi. It has been serialized in Shueisha\'s shōnen manga magazine Weekly Shōnen Jump since March 1998, although the manga has frequently gone on ... | https://python.langchain.com/en/latest/modules/agents/tools/examples/wikipedia.html |
0e271025b568-2 | × Hunter was adapted into a 62-episode anime television series produced by Nippon Animation and directed by Kazuhiro Furuhashi, which ran on Fuji Television from October 1999 to March 2001. Three separate original video animations (OVAs) totaling 30 episodes were subsequently produced by Nippon Animation and released i... | https://python.langchain.com/en/latest/modules/agents/tools/examples/wikipedia.html |
0e271025b568-3 | × Hunter has been a huge critical and financial success and has become one of the best-selling manga series of all time, having over 84 million copies in circulation by July 2022.\n\nPage: Hunter × Hunter (2011 TV series)\nSummary: Hunter × Hunter is an anime television series that aired from 2011 to 2014 based on Yosh... | https://python.langchain.com/en/latest/modules/agents/tools/examples/wikipedia.html |
0e271025b568-4 | new Hunter × Hunter anime was announced on July 24, 2011. It is a complete reboot of the anime adaptation starting from the beginning of the manga, with no connections to the first anime from 1999. Produced by Nippon TV, VAP, Shueisha and Madhouse, the series is directed by Hiroshi Kōjina, with Atsushi Maekawa and Tsut... | https://python.langchain.com/en/latest/modules/agents/tools/examples/wikipedia.html |
0e271025b568-5 | On television, the series began airing on Adult Swim\'s Toonami programming block on April 17, 2016, and ended on June 23, 2019.The anime series\' opening theme is alternated between the song "Departure!" and an alternate version titled "Departure! -Second Version-" both sung by Galneryus\' vocalist Masatoshi Ono. Five... | https://python.langchain.com/en/latest/modules/agents/tools/examples/wikipedia.html |
0e271025b568-6 | The background music and soundtrack for the series was composed by Yoshihisa Hirano.\n\n\n\nPage: List of Hunter × Hunter characters\nSummary: The Hunter × Hunter manga series, created by Yoshihiro Togashi, features an extensive cast of characters. It takes place in a fictional universe where licensed specialists known... | https://python.langchain.com/en/latest/modules/agents/tools/examples/wikipedia.html |
0e271025b568-7 | previous
SerpAPI
next
Wolfram Alpha
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 21, 2023. | https://python.langchain.com/en/latest/modules/agents/tools/examples/wikipedia.html |
926cc1c2f7bc-0 | .ipynb
.pdf
Wolfram Alpha
Wolfram Alpha#
This notebook goes over how to use the wolfram alpha component.
First, you need to set up your Wolfram Alpha developer account and get your APP ID:
Go to wolfram alpha and sign up for a developer account here
Create an app and get your APP ID
pip install wolframalpha
Then we wil... | https://python.langchain.com/en/latest/modules/agents/tools/examples/wolfram_alpha.html |
632074a89f27-0 | .ipynb
.pdf
Zapier Natural Language Actions API
Contents
Zapier Natural Language Actions API
Example with Agent
Example with SimpleSequentialChain
Zapier Natural Language Actions API#
Full docs here: https://nla.zapier.com/api/v1/docs
Zapier Natural Language Actions gives you access to the 5k+ apps, 20k+ actions on Z... | https://python.langchain.com/en/latest/modules/agents/tools/examples/zapier.html |
632074a89f27-1 | %autoreload 2
import os
# get from https://platform.openai.com/
os.environ["OPENAI_API_KEY"] = os.environ.get("OPENAI_API_KEY", "")
# get from https://nla.zapier.com/demo/provider/debug (under User Information, after logging in):
os.environ["ZAPIER_NLA_API_KEY"] = os.environ.get("ZAPIER_NLA_API_KEY", "")
Example with ... | https://python.langchain.com/en/latest/modules/agents/tools/examples/zapier.html |
632074a89f27-2 | Action: Gmail: Find Email
Action Input: Find the latest email from Silicon Valley Bank
Observation: {"from__name": "Silicon Valley Bridge Bank, N.A.", "from__email": "sreply@svb.com", "body_plain": "Dear Clients, After chaotic, tumultuous & stressful days, we have clarity on path for SVB, FDIC is fully insuring all dep... | https://python.langchain.com/en/latest/modules/agents/tools/examples/zapier.html |
632074a89f27-3 | Observation: {"message__text": "Silicon Valley Bank has announced that Tim Mayopoulos is the new CEO. FDIC is fully insuring all deposits and they have an ask for clients and partners as they rebuild.", "message__permalink": "https://langchain.slack.com/archives/C04TSGU0RA7/p1678859932375259", "channel": "C04TSGU0RA7",... | https://python.langchain.com/en/latest/modules/agents/tools/examples/zapier.html |
632074a89f27-4 | from langchain.tools.zapier.tool import ZapierNLARunAction
from langchain.utilities.zapier import ZapierNLAWrapper
## step 0. expose gmail 'find email' and slack 'send direct message' actions
# first go here, log in, expose (enable) the two actions: https://nla.zapier.com/demo/start -- for this example, can leave all f... | https://python.langchain.com/en/latest/modules/agents/tools/examples/zapier.html |
632074a89f27-5 | SLACK_HANDLE = "@Ankush Gola"
def nla_slack(inputs):
action = next((a for a in actions if a["description"].startswith("Slack: Send Direct Message")), None)
instructions = f'Send this to {SLACK_HANDLE} in Slack: {inputs["draft_reply"]}'
return {"slack_data": ZapierNLARunAction(action_id=action["id"], zapier_... | https://python.langchain.com/en/latest/modules/agents/tools/examples/zapier.html |
632074a89f27-6 | overall_chain.run(GMAIL_SEARCH_INSTRUCTIONS)
> Entering new SimpleSequentialChain chain...
{"from__name": "Silicon Valley Bridge Bank, N.A.", "from__email": "sreply@svb.com", "body_plain": "Dear Clients, After chaotic, tumultuous & stressful days, we have clarity on path for SVB, FDIC is fully insuring all deposits & h... | https://python.langchain.com/en/latest/modules/agents/tools/examples/zapier.html |
632074a89f27-7 | Best regards,
[Your Name]
{"message__text": "Dear Silicon Valley Bridge Bank, \n\nThank you for your email and the update regarding your new CEO Tim Mayopoulos. We appreciate your dedication to keeping your clients and partners informed and we look forward to continuing our relationship with you. \n\nBest regards, \n[... | https://python.langchain.com/en/latest/modules/agents/tools/examples/zapier.html |
632074a89f27-8 | > Finished chain.
'{"message__text": "Dear Silicon Valley Bridge Bank, \\n\\nThank you for your email and the update regarding your new CEO Tim Mayopoulos. We appreciate your dedication to keeping your clients and partners informed and we look forward to continuing our relationship with you. \\n\\nBest regards, \\n[You... | https://python.langchain.com/en/latest/modules/agents/tools/examples/zapier.html |
3387518f6cb9-0 | .ipynb
.pdf
Getting Started
Contents
Why do we need chains?
Query an LLM with the LLMChain
Combine chains with the SequentialChain
Create a custom chain with the Chain class
Getting Started#
In this tutorial, we will learn about creating simple chains in LangChain. We will learn how to create a chain, add components ... | https://python.langchain.com/en/latest/modules/chains/getting_started.html |
3387518f6cb9-1 | print(chain.run("colorful socks"))
Rainbow Socks Co.
You can use a chat model in an LLMChain as well:
from langchain.chat_models import ChatOpenAI
from langchain.prompts.chat import (
ChatPromptTemplate,
HumanMessagePromptTemplate,
)
human_message_prompt = HumanMessagePromptTemplate(
prompt=PromptTempla... | https://python.langchain.com/en/latest/modules/chains/getting_started.html |
3387518f6cb9-2 | template="Write a catchphrase for the following company: {company_name}",
)
chain_two = LLMChain(llm=llm, prompt=second_prompt)
Now we can combine the two LLMChains, so that we can create a company name and a catchphrase in a single step.
from langchain.chains import SimpleSequentialChain
overall_chain = SimpleSequenti... | https://python.langchain.com/en/latest/modules/chains/getting_started.html |
3387518f6cb9-3 | return list(all_input_vars)
@property
def output_keys(self) -> List[str]:
return ['concat_output']
def _call(self, inputs: Dict[str, str]) -> Dict[str, str]:
output_1 = self.chain_1.run(inputs)
output_2 = self.chain_2.run(inputs)
return {'concat_output': output_1 + output_2}
... | https://python.langchain.com/en/latest/modules/chains/getting_started.html |
86602af5d5b7-0 | .rst
.pdf
How-To Guides
How-To Guides#
A chain is made up of links, which can be either primitives or other chains.
Primitives can be either prompts, models, arbitrary functions, or other chains.
The examples here are broken up into three sections:
Generic Functionality
Covers both generic chains (that are useful in a ... | https://python.langchain.com/en/latest/modules/chains/how_to_guides.html |
8c521ee3a1cc-0 | .ipynb
.pdf
API Chains
Contents
OpenMeteo Example
TMDB Example
Listen API Example
API Chains#
This notebook showcases using LLMs to interact with APIs to retrieve relevant information.
from langchain.chains.api.prompt import API_RESPONSE_PROMPT
from langchain.chains import APIChain
from langchain.prompts.prompt impor... | https://python.langchain.com/en/latest/modules/chains/examples/api.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.