id
stringlengths
14
15
text
stringlengths
101
5.26k
source
stringlengths
57
120
84ab24a8de5f-2
h=this||self;function l(){return void 0!==window.google&&void 0!==window.google.kOPI&&0!==window.google.kOPI?window.google.kOPI:null};var m,n=[];function p(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||m}function q(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/requests.html
84ab24a8de5f-3
8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.h{color:#1558d6}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px}.gsfi,.lst{font:18px arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:inline-box;display:inline-block;margin:3px 0 4px;margin-left:4px}input{font-...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/requests.html
84ab24a8de5f-4
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.google.com/maps?hl=en&tab=wl">Maps</a> <a class=gb1 href="https://play.google.com/?hl=en&tab=w8">Play</a> <a class=gb1 href="https://www.youtube.com/?tab=w1">YouT...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/requests.html
84ab24a8de5f-5
XMLHttpRequest)b="2";else if("undefined"!=typeof ActiveXObject){var c,d,e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];for(c=0;d=e[c++];)try{new ActiveXObject(d),b="2"}catch(h){}}a=b;if("2"==a&&-1==location.search.indexOf("&gbv=2")){var f=google.gbvu,g=document.getElementById("gbv");...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/requests.html
84ab24a8de5f-6
this.g+""};var l={};\nfunction p(){var c=u,g=function(){};google.lx=google.stvsc?g:function(){google.timers&&google.timers.load&&google.tick&&google.tick("load","xjsls");var a=document;var b="SCRIPT";"application/xhtml+xml"===a.contentType&&(b=b.toLowerCase());b=a.createElement(b);a=null===c?"null":void 0===c?"undefine...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/requests.html
84ab24a8de5f-7
previous Python REPL next SceneXplain Contents Inside the tool By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 08, 2023.
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/requests.html
4d437b81694d-0
.ipynb .pdf Wikipedia Wikipedia# Wikipedia is a multilingual free online encyclopedia written and maintained by a community of volunteers, known as Wikipedians, through open collaboration and using a wiki-based editing system called MediaWiki. Wikipedia is the largest and most-read reference work in history. First, you...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/wikipedia.html
4d437b81694d-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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/wikipedia.html
4d437b81694d-2
sung by Japanese duo Yuzu in episodes 59 to 75, "Nagareboshi Kirari" also sung by Yuzu from episode 76 to 98, which was originally from the anime film adaptation, Hunter × Hunter: Phantom Rouge, and "Hyōri Ittai" by Yuzu featuring Hyadain from episode 99 to 146, which was also used in the film Hunter × Hunter: The Last...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/wikipedia.html
4d437b81694d-3
previous Twilio next Wolfram Alpha By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 08, 2023.
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/wikipedia.html
cf40366cfd2b-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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_places.html
2e1ee50303de-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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/ifttt.html
d2e833c6e3e7-0
.ipynb .pdf Human as a tool Contents Configuring the Input Function 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. from langchain.chat_models import ChatOpenAI from langchain.llms import OpenAI from langchain.agents import load_tools, initialize_agent ...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/human_tools.html
d2e833c6e3e7-1
Action Input: "Who said 'Veni, vidi, vici'?" Observation: Updated on September 06, 2019. "Veni, vidi, vici" is a famous phrase said to have been spoken by the Roman Emperor Julius Caesar (100-44 BCE) in a bit of stylish bragging that impressed many of the writers of his day and beyond. The phrase means roughly "I came,...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/human_tools.html
c9c12c6b42e5-0
.ipynb .pdf OpenWeatherMap API Contents Use the wrapper Use the tool 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 w...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/openweathermap.html
9bdce3217bfb-0
.ipynb .pdf SceneXplain Contents Usage in an Agent SceneXplain# SceneXplain is an ImageCaptioning service accessible through the SceneXplain Tool. To use this tool, you’ll need to make an account and fetch your API Token from the website. Then you can instantiate the tool. import os os.environ["SCENEX_API_KEY"] = "<Y...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/sceneXplain.html
21b6e6eede13-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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/wolfram_alpha.html
90773ffc0447-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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/python.html
cb9f80144748-0
.ipynb .pdf Shell Tool Contents Use with Agents Shell Tool# Giving agents access to the shell is powerful (though risky outside a sandboxed environment). The LLM can use it to execute any shell commands. A common use case for this is letting the LLM interact with your local file system. from langchain.tools import Sh...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/bash.html
5d7707a36db2-0
.ipynb .pdf Twilio Contents Setup Sending a message Twilio# This notebook goes over how to use the Twilio API wrapper to send a text message. Setup# To use this tool you need to install the Python Twilio package twilio # !pip install twilio You’ll also need to set up a Twilio account and get your credentials. You’ll ...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/twilio.html
c919a3bd9c11-0
.ipynb .pdf GraphQL tool GraphQL tool# This Jupyter Notebook demonstrates how to use the BaseGraphQLTool component with an Agent. GraphQL is a query language for APIs and a runtime for executing those queries against your data. GraphQL provides a complete and understandable description of the data in your API, gives cl...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/graphql.html
22d4b1d3274e-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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/zapier.html
22d4b1d3274e-1
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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/zapier.html
22d4b1d3274e-2
## step 2. generate draft reply template = """You are an assisstant who drafts replies to an incoming email. Output draft reply in plain text (not JSON). Incoming email: {email_data} Draft email reply:""" prompt_template = PromptTemplate(input_variables=["email_data"], template=template) reply_chain = LLMChain(llm=Open...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/zapier.html
22d4b1d3274e-3
> 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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/zapier.html
a17ad4cea117-0
.ipynb .pdf Metaphor Search Contents Metaphor Search Call the API Use Metaphor as a tool Metaphor Search# This notebook goes over how to use Metaphor search. First, you need to set up the proper API keys and environment variables. Request an API key [here](Sign up for early access here). Then enter your API key as an...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/metaphor_search.html
a17ad4cea117-1
'date_created': '2023-03-08'}, {'title': 'Extinction Risk from Artificial Intelligence', 'url': 'https://aisafety.wordpress.com/', 'author': None, 'date_created': '2013-10-08'}, {'title': 'The simple picture on AI safety - LessWrong', 'url': 'https://www.lesswrong.com/posts/WhNxG4r774bK32GcH/the-simple-pictur...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/metaphor_search.html
a17ad4cea117-2
"action_input": { "query": "interesting tweet AI safety", "num_results": 1 } } ``` {'results': [{'url': 'https://safe.ai/', 'title': 'Center for AI Safety', 'dateCreated': '2022-01-01', 'author': None, 'score': 0.18083244562149048}]} Observation: [{'title': 'Center for AI Safety', 'url': 'https://safe.ai/', '...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/metaphor_search.html
747dc35f93a6-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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/serpapi.html
aff12cf17a21-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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/bing_search.html
aff12cf17a21-1
search = BingSearchAPIWrapper() search.results("apples", 5) [{'snippet': 'Lady Alice. Pink Lady <b>apples</b> aren’t the only lady in the apple family. Lady Alice <b>apples</b> were discovered growing, thanks to bees pollinating, in Washington. They are smaller and slightly more stout in appearance than other varieties...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/bing_search.html
76fdaf178f27-0
.ipynb .pdf ArXiv API Tool Contents The ArXiv API Wrapper ArXiv API Tool# This notebook goes over how to use the arxiv component. First, you need to install arxiv python package. !pip install arxiv from langchain.chat_models import ChatOpenAI from langchain.agents import load_tools, initialize_agent, AgentType llm = ...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/arxiv.html
76fdaf178f27-1
docs = arxiv.run("Caprice Stanley") docs 'Published: 2017-10-10\nTitle: On Mixing Behavior of a Family of Random Walks Determined by a Linear Recurrence\nAuthors: Caprice Stanley, Seth Sullivant\nSummary: We study random walks on the integers mod $G_n$ that are determined by an\ninteger sequence $\\{ G_n \\}_{n \\geq 1...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/arxiv.html
342068283d1d-0
.ipynb .pdf AWS Lambda API AWS Lambda API# This notebook goes over how to use the AWS Lambda Tool component. AWS Lambda is a serverless computing service provided by Amazon Web Services (AWS), designed to allow developers to build and run applications and services without the need for provisioning or managing servers. ...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/awslambda.html
65f0acf62ac1-0
.ipynb .pdf Google Serper API Contents As part of a Self Ask With Search Chain Obtaining results with metadata Searching for Google Images Searching for Google News Searching for Google Places Google Serper API# This notebook goes over how to use the Google Serper component to search the web. First you need to sign u...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_serper.html
65f0acf62ac1-1
{'title': 'Business', 'link': 'https://www.apple.com/business/'}, {'title': 'Mac', 'link': 'https://www.apple.com/mac/'}, {'title': 'Watch', 'link': 'https://www.apple.com/watch...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_serper.html
65f0acf62ac1-2
'markets smartphones, personal\n' 'computers, tablets, wearables and accessories ' 'and sells a range of related\n' 'services.', 'title': 'AAPL.O - | Stock Price & Latest News - Reuters', ...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_serper.html
65f0acf62ac1-3
'imageWidth': 754, 'imageHeight': 752, 'thumbnailUrl': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS3fnDub1GSojI0hJ-ZGS8Tv-hkNNloXh98DOwXZoZ_nUs3GWSd&amp;s', 'thumbnailWidth': 225, 'thumbnailHeight': 224, 'source': 'Encyclopedia Britannica', ...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_serper.html
65f0acf62ac1-4
'thumbnailWidth': 273, 'thumbnailHeight': 185, 'source': 'Encyclopedia Britannica', 'domain': 'www.britannica.com', 'link': 'https://www.britannica.com/animal/lion', 'position': 6}, {'title': "Where do lions live? Facts about lions' habitats a...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_serper.html
65f0acf62ac1-5
'domain': 'virginiazoo.org', 'link': 'https://virginiazoo.org/zoos-new-male-lion-explores-habitat-for-thefirst-time/', 'position': 10}]} Searching for Google News# We can also query Google News using this wrapper. For example: search = GoogleSerperAPIWrapper(type="news") results = search.resul...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_serper.html
65f0acf62ac1-6
'snippet': '(Reuters) -Tesla Inc has resumed taking orders for its ' 'Model 3 long-range vehicle in the United States, the ' "company's website showed late on...", 'date': '19 hours ago', 'source': 'Yahoo Finance', 'imageUrl': 'https://encrypt...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_serper.html
65f0acf62ac1-7
search = GoogleSerperAPIWrapper(type="news", tbs="qdr:h") results = search.results("Tesla Inc.") pprint.pp(results) {'searchParameters': {'q': 'Tesla Inc.', 'gl': 'us', 'hl': 'en', 'num': 10, 'type': 'news', 't...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_serper.html
65f0acf62ac1-8
'gl': 'us', 'hl': 'en', 'num': 10, 'type': 'places'}, 'places': [{'position': 1, 'title': "L'Osteria", 'address': '1219 Lexington Ave', 'latitude': 40.777154599999996, 'longitude': -73.9571363, ...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_serper.html
65f0acf62ac1-9
'ratingCount': 152, 'category': 'Italian'}, {'position': 8, 'title': 'Piccola Cucina Uptown', 'address': '106 E 60th St', 'latitude': 40.7632468, 'longitude': -73.9689825, 'thumbnailUrl': 'https://lh5.googleusercontent.com/p/AF1Qi...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_serper.html
7d82f16311f2-0
.ipynb .pdf PubMed Tool PubMed Tool# This notebook goes over how to use PubMed as a tool PubMed® comprises more than 35 million citations for biomedical literature from MEDLINE, life science journals, and online books. Citations may include links to full text content from PubMed Central and publisher web sites. from la...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/pubmed.html
e33cb777c508-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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/google_search.html
ef297e423871-0
.ipynb .pdf File System Tools Contents The FileManagementToolkit Selecting File System Tools File System Tools# LangChain provides tools for interacting with a local file system out of the box. This notebook walks through some of them. Note: these tools are not recommended for use outside a sandboxed environment! Fir...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/filesystem.html
ef297e423871-1
ListDirectoryTool(name='list_directory', description='List files and directories in a specified folder', args_schema=<class 'langchain.tools.file_management.list_dir.DirectoryListingInput'>, return_direct=False, verbose=False, callback_manager=<langchain.callbacks.shared.SharedCallbackManager object at 0x1156f4350>, ro...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/filesystem.html
a8ed119ff0f1-0
.ipynb .pdf Brave Search Brave Search# This notebook goes over how to use the Brave Search tool. from langchain.tools import BraveSearch api_key = "..." tool = BraveSearch.from_api_key(api_key=api_key, search_kwargs={"count": 3}) tool.run("obama middle name") '[{"title": "Barack Obama - Wikipedia", "link": "https://en....
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/brave_search.html
742be4620cc6-0
.ipynb .pdf HuggingFace Tools HuggingFace Tools# Huggingface Tools supporting text I/O can be loaded directly using the load_huggingface_tool function. # Requires transformers>=4.29.0 and huggingface_hub>=0.14.1 !pip install --upgrade transformers huggingface_hub > /dev/null from langchain.agents import load_huggingfac...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/huggingface_tools.html
205e70c151cd-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://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/searx_search.html
205e70c151cd-1
'title': 'Large language models are human-level prompt engineers', 'link': 'https://arxiv.org/abs/2211.01910', 'engines': ['google scholar'], 'category': 'science'}, {'snippet': '… Large language models (LLMs) have introduced new possibilities ' 'for prototyping with AI [18]. Pre-trained on a large ...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/searx_search.html
205e70c151cd-2
'a multi-step manner. To address these issues, we introduce ' 'Prompt Agnostic Essay Scorer (PAES) for cross-prompt AES. Our ' 'method requires no access to labelled or unlabelled ' 'target-prompt data during training and is a single-stage ' 'approach. PAES is easy to...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/searx_search.html
205e70c151cd-3
'better described as locating an already learned task rather than ' 'meta-learning. This analysis motivates rethinking the role of ' 'prompts in controlling and evaluating powerful language models. ' 'In this work, we discuss methods of prompt programming, ' 'emphasiz...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/searx_search.html
205e70c151cd-4
'Reasoning in Large Language Models".', 'title': 'Chain-of-ThoughtsPapers', 'link': 'https://github.com/Timothyxxx/Chain-of-ThoughtsPapers', 'engines': ['github'], 'category': 'it'}, {'snippet': 'Mistral: A strong, northwesterly wind: Framework for transparent ' 'and accessible large-scale languag...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/searx_search.html
205e70c151cd-5
{'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 Linguistics: ACL-IJCNLP 2021.', 'title': 'xl-sum...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/searx_search.html
1895cedd1965-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 DuckDuckGoSearchRun search = DuckDuckGoSearchRun() search.run("Obama's first name?") 'Barack Obama, in full Barack Hussein Obama II, (born A...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/ddg.html
7e5bf7069179-0
.ipynb .pdf Apify Apify# This notebook shows how to use the Apify integration for LangChain. Apify is a cloud platform for web scraping and data extraction, which provides an ecosystem of more than a thousand ready-made apps called Actors for various web scraping, crawling, and data extraction use cases. For example, y...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/apify.html
02ef34806edb-0
.ipynb .pdf YouTubeSearchTool YouTubeSearchTool# This notebook shows how to use a tool to search YouTube Adapted from venuv/langchain_yt_tools #! pip install youtube_search from langchain.tools import YouTubeSearchTool tool = YouTubeSearchTool() tool.run("lex friedman") "['/watch?v=VcVfceTsD0A&pp=ygUMbGV4IGZyaWVkbWFu',...
https://langchain.readthedocs.io/en/latest/modules/agents/tools/examples/youtube.html
d7101e9f37a9-0
.ipynb .pdf How to use the async API for Agents Contents Serial vs. Concurrent Execution How to use the async API for Agents# LangChain provides async support for Agents by leveraging the asyncio library. Async methods are currently supported for the following Tools: GoogleSerperAPIWrapper, SerpAPIWrapper and LLMMath...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/async_agent.html
d7101e9f37a9-1
Action Input: "Who won the US Open men's final in 2019?" Observation: Rafael Nadal defeated Daniil Medvedev in the final, 7–5, 6–3, 5–7, 4–6, 6–4 to win the men's singles tennis title at the 2019 US Open. It was his fourth US ... Draw: 128 (16 Q / 8 WC). Champion: Rafael Nadal. Runner-up: Daniil Medvedev. Score: 7–5, 6...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/async_agent.html
d7101e9f37a9-2
Thought: I need to find out Max Verstappen's age Action: Google Serper Action Input: "Max Verstappen age" Observation: 25 years Thought: I need to calculate 25 raised to the 0.23 power Action: Calculator Action Input: 25^0.23 Observation: Answer: 2.096651272316035 Thought: I now know the final answer Final Answer: Max ...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/async_agent.html
d7101e9f37a9-3
Action: Google Serper Action Input: "US Open women's final 2019 winner" Observation: Sudeikis and Wilde's relationship ended in November 2020. Wilde was publicly served with court documents regarding child custody while she was presenting Don't Worry Darling at CinemaCon 2022. In January 2021, Wilde began dating singer...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/async_agent.html
d7101e9f37a9-4
Thought: Observation: Lewis Hamilton holds the record for the most race wins in Formula One history, with 103 wins to date. Michael Schumacher, the previous record holder, ... Michael Schumacher (top left) and Lewis Hamilton (top right) have each won the championship a record seven times during their careers, while Seb...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/async_agent.html
487c1e82dd8c-0
.ipynb .pdf How to add SharedMemory to an Agent and its Tools How to add SharedMemory to an Agent and its Tools# This notebook goes over adding memory to both of an Agent and its tools. Before going through this notebook, please walk through the following notebooks, as this will build on top of both of them: Adding mem...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
487c1e82dd8c-1
Action: Search Action Input: "ChatGPT" Observation: Nov 30, 2022 ... We've trained a model called ChatGPT which interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer ... ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built ...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
487c1e82dd8c-2
Thought: I now know the final answer Final Answer: ChatGPT was developed by OpenAI. > Finished chain. 'ChatGPT was developed by OpenAI.' agent_chain.run(input="Thanks. Summarize the conversation, for my daughter 5 years old.") > Entering new AgentExecutor chain... Thought: I need to simplify the conversation for a 5 ye...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
487c1e82dd8c-3
Action: Search Action Input: "ChatGPT" Observation: Nov 30, 2022 ... We've trained a model called ChatGPT which interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer ... ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built ...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
487c1e82dd8c-4
> Finished chain. 'ChatGPT was developed by OpenAI.' agent_chain.run(input="Thanks. Summarize the conversation, for my daughter 5 years old.") > Entering new AgentExecutor chain... Thought: I need to simplify the conversation for a 5 year old. Action: Summary Action Input: My daughter 5 years old > Entering new LLMChai...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/sharedmemory_for_tools.html
4968ee3b182e-0
.ipynb .pdf How to access intermediate steps How to access intermediate steps# In order to get more visibility into what an agent is doing, we can also return intermediate steps. This comes in the form of an extra key in the return value, which is a list of (action, observation) tuples. from langchain.agents import loa...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/intermediate_steps.html
a076ed2651c1-0
.ipynb .pdf How to create ChatGPT Clone How to create ChatGPT Clone# This chain replicates ChatGPT by combining (1) a specific prompt, and (2) the concept of memory. Shows off the example as in https://www.engraved.blog/building-a-virtual-machine-inside/ from langchain import OpenAI, ConversationChain, LLMChain, Prompt...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
a076ed2651c1-1
Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based ...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
a076ed2651c1-2
Human: ls ~ AI: ``` $ ls ~ Desktop Documents Downloads Music Pictures Public Templates Videos ``` Human: cd ~ AI: ``` $ cd ~ $ pwd /home/user ``` Human: {Please make a file jokes.txt inside and put some jokes inside} Assistant: > Finished LLMChain chain. ``` $ touch jokes.txt $ echo "Why did the chicken cross...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
a076ed2651c1-3
AI: ``` $ touch jokes.txt $ echo "Why did the chicken cross the road? To get to the other side!" >> jokes.txt $ echo "What did the fish say when it hit the wall? Dam!" >> jokes.txt $ echo "Why did the scarecrow win the Nobel Prize? Because he was outstanding in his field!" >> jokes.txt ``` Human: echo -e "x=lambda y:y...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
a076ed2651c1-4
$ docker run -t my_docker_image Hello from Docker ``` output = chatgpt_chain.predict(human_input="nvidia-smi") print(output) > Entering new LLMChain chain... Prompt after formatting: Assistant is a large language model trained by OpenAI. Assistant is designed to be able to assist with a wide range of tasks, from answer...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
a076ed2651c1-5
Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based ...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
a076ed2651c1-6
Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist. Human: nvidia-smi AI: ``` $ n...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
a076ed2651c1-7
3 packets transmitted, 3 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 14.945/14.945/14.945/0.000 ms ``` Human: curl -fsSL "https://api.github.com/repos/pytorch/pytorch/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g' AI: ``` $ curl -fsSL "https://api.github.com/repos/pytorch/pytorch/...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
a076ed2651c1-8
print(output) > Entering new LLMChain chain... Prompt after formatting: Assistant is a large language model trained by OpenAI. Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a languag...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
a076ed2651c1-9
Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based ...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/chatgpt_clone.html
02d14116f04d-0
.ipynb .pdf How to use a timeout for the agent How to use a timeout for the agent# This notebook walks through how to cap an agent executor after a certain amount of time. This can be useful for safeguarding against long running agent runs. from langchain.agents import load_tools from langchain.agents import initialize...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/max_time_limit.html
787929a773e2-0
.ipynb .pdf How to cap the max number of iterations How to cap the max number of iterations# This notebook walks through how to cap an agent at taking a certain number of steps. This can be useful to ensure that they do not go haywire and take too many steps. from langchain.agents import load_tools from langchain.agent...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/max_iterations.html
92164dadfd00-0
.ipynb .pdf How to combine agents and vectorstores Contents Create the Vectorstore Create the Agent Use the Agent solely as a router Multi-Hop vectorstore reasoning How to combine agents and vectorstores# This notebook covers how to combine agents and vectorstores. The use case for this is that you’ve ingested your d...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/agent_vectorstore.html
92164dadfd00-1
> Finished chain. "Biden said that Jackson is one of the nation's top legal minds and that she will continue Justice Breyer's legacy of excellence." agent.run("Why use ruff over flake8?") > Entering new AgentExecutor chain... I need to find out the advantages of using ruff over flake8 Action: Ruff QA System Action Inp...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/agent_vectorstore.html
92164dadfd00-2
> Finished chain. ' Ruff can be used as a drop-in replacement for Flake8 when used (1) without or with a small number of plugins, (2) alongside Black, and (3) on Python 3 code. It also re-implements some of the most popular Flake8 plugins and related code quality tools natively, including isort, yesqa, eradicate, and m...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/agent_vectorstore.html
8896a9762397-0
.ipynb .pdf Handle Parsing Errors Contents Setup Error Default error handling Custom Error Message Custom Error Function Handle Parsing Errors# Occasionally the LLM cannot determine what step to take because it outputs format in incorrect form to be handled by the output parser. In this case, by default the agent err...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/handle_parsing_errors.html
8896a9762397-1
957 ) File ~/workplace/langchain/langchain/agents/agent.py:773, in AgentExecutor._take_next_step(self, name_to_tool_map, color_mapping, inputs, intermediate_steps, run_manager) 771 raise_error = False 772 if raise_error: --> 773 raise e 774 text = str(e) 775 if isinstance(self.handle_par...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/handle_parsing_errors.html
8896a9762397-2
> Finished chain. 'Gigi Hadid.' Custom Error Function# You can also customize the error to be a function that takes the error in and outputs a string. def _handle_error(error) -> str: return str(error)[:50] mrkl = initialize_agent( tools, ChatOpenAI(temperature=0), agent=AgentType.CHAT_ZERO_SHOT_REACT...
https://langchain.readthedocs.io/en/latest/modules/agents/agent_executors/examples/handle_parsing_errors.html
173e3ec5b314-0
.ipynb .pdf Vectorstore Agent Contents Create the Vectorstores Initialize Toolkit and Agent Examples Multiple Vectorstores Examples Vectorstore Agent# This notebook showcases an agent designed to retrieve information from one or more vectorstores, either with or without sources. Create the Vectorstores# from langchai...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/vectorstore.html
173e3ec5b314-1
from langchain.agents.agent_toolkits import ( create_vectorstore_router_agent, VectorStoreRouterToolkit, VectorStoreInfo, ) ruff_vectorstore_info = VectorStoreInfo( name="ruff", description="Information about the Ruff python linting library", vectorstore=ruff_store ) router_toolkit = VectorStore...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/vectorstore.html
1fb7bc252c7d-0
.ipynb .pdf Pandas Dataframe Agent Contents Multi DataFrame Example Pandas Dataframe Agent# This notebook shows how to use agents to interact with a pandas dataframe. It is mostly optimized for question answering. NOTE: this agent calls the Python agent under the hood, which executes LLM generated Python code - this ...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/pandas.html
56ae7579bca5-0
.ipynb .pdf CSV Agent Contents Multi CSV Example CSV Agent# This notebook shows how to use agents to interact with a csv. It is mostly optimized for question answering. NOTE: this agent calls the Pandas DataFrame agent under the hood, which in turn calls the Python agent, which executes LLM generated Python code - th...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/csv.html
a74cbad6f4c9-0
.ipynb .pdf JSON Agent Contents Initialization Example: getting the required POST parameters for a request JSON Agent# This notebook showcases an agent designed to interact with large JSON/dict objects. This is useful when you want to answer questions about a JSON blob that’s too large to fit in the context window of...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/json.html
a74cbad6f4c9-1
Observation: #/components/schemas/CreateCompletionRequest Thought: I should look at the CreateCompletionRequest schema to see what parameters are required Action: json_spec_list_keys Action Input: data["components"]["schemas"]["CreateCompletionRequest"] Observation: ['type', 'properties', 'required'] Thought: I should ...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/json.html
64f40172db7c-0
.ipynb .pdf OpenAPI agents Contents 1st example: hierarchical planning agent To start, let’s collect some OpenAPI specs. How big is this spec? Let’s see some examples! Try another API. 2nd example: “json explorer” agent OpenAPI agents# We can construct agents to consume arbitrary APIs, here APIs conformant to the Ope...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/openapi.html
64f40172db7c-1
from langchain.agents.agent_toolkits.openapi.spec import reduce_openapi_spec with open("openai_openapi.yaml") as f: raw_openai_api_spec = yaml.load(f, Loader=yaml.Loader) openai_api_spec = reduce_openapi_spec(raw_openai_api_spec) with open("klarna_openapi.yaml") as f: raw_klarna_api_spec = yaml.load(f, Loa...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/openapi.html
64f40172db7c-2
3. GET /me to get the current user's information 4. POST /users/{user_id}/playlists to create a new playlist named "Machine Blues" for the current user 5. POST /playlists/{playlist_id}/tracks to add the first song from "Kind of Blue" to the "Machine Blues" playlist > Entering new AgentExecutor chain... Action: requests...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/openapi.html
64f40172db7c-3
Observation: acoustic, afrobeat, alt-rock, alternative, ambient, anime, black-metal, bluegrass, blues, bossanova, brazil, breakbeat, british, cantopop, chicago-house, children, chill, classical, club, comedy, country, dance, dancehall, death-metal, deep-house, detroit-techno, disco, disney, drum-and-bass, dub, dubstep,...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/openapi.html
64f40172db7c-4
Observation: babbage, davinci, text-davinci-edit-001, babbage-code-search-code, text-similarity-babbage-001, code-davinci-edit-001, text-davinci-001, ada, babbage-code-search-text, babbage-similarity, whisper-1, code-search-babbage-text-001, text-curie-001, code-search-babbage-code-001, text-ada-001, text-embedding-ada...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/openapi.html
64f40172db7c-5
Action Input: 1. GET /models to retrieve the list of available models 2. Choose a suitable model for generating text (e.g., text-davinci-002) 3. POST /completions with the chosen model and a prompt related to improving communication skills to generate a short piece of advice > Entering new AgentExecutor chain... Action...
https://langchain.readthedocs.io/en/latest/modules/agents/toolkits/examples/openapi.html