id stringlengths 14 16 | text stringlengths 36 2.73k | source stringlengths 59 127 |
|---|---|---|
dc38ca462716-12 | 'imageWidth': 1400,
'imageHeight': 845,
'thumbnailUrl': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSgB3z_D4dMEOWJ7lajJk4XaQSL4DdUvIRj4UXZ0YoE5fGuWuo&s',
'thumbnailWidth': 289,
'thumbnailHeight': 174,
'source': "Smithsonian's National Zoo",... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-13 | Searching for Google News#
We can also query Google News using this wrapper. For example:
search = GoogleSerperAPIWrapper(type="news")
results = search.results("Tesla Inc.")
pprint.pp(results)
{'searchParameters': {'q': 'Tesla Inc.',
'gl': 'us',
'hl': 'en',
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-14 | 'quarterly earnings after it...',
'date': '1 day ago',
'source': 'Reuters',
'imageUrl': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ4u4CP8aOdGyRFH6o4PkXi-_eZDeY96vLSag5gDjhKMYf98YBER2cZPbkStQ&s',
'position': 2},
{'title': 'Tesla Wanted an EV Price War. F... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-15 | 'contract extension to deliver up to nine air taxis to '
'the U.S. Air Force,...',
'date': '4 hours ago',
'source': 'Yahoo Finance',
'imageUrl': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQO0uVn297LI-xryrPNqJ-apUOulj4ohM-xkN4OfmvMOYh1CPdUEBbYx6hviw&s',
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-16 | 'snippet': 'Tesla has reopened orders for the Model 3 Long Range '
'RWD, which has been unavailable for months due to high '
'demand.',
'date': '7 hours ago',
'source': 'Not a Tesla App',
'imageUrl': 'https://encrypted-tbn0.gstatic.com/images?... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-17 | 'Business Journal',
'link': 'https://www.bizjournals.com/austin/news/2023/05/02/tesla-leases-building-seattle-area.html',
'snippet': 'Check out what Puget Sound Business Journal has to '
"report about the Austin-based company's real estate "
'footprint i... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-18 | 'position': 9}]}
If you want to only receive news articles published in the last hour, you can do the following:
search = GoogleSerperAPIWrapper(type="news", tbs="qdr:h")
results = search.results("Tesla Inc.")
pprint.pp(results)
{'searchParameters': {'q': 'Tesla Inc.',
'gl': 'us',
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-19 | 'snippet': 'Ryder System Inc. presentó RyderElectric+ TM como su '
'nueva solución llave en mano ... Ryder también tiene '
'reservados los semirremolques Tesla y continúa...',
'date': '56 mins ago',
'source': 'Revista Transportes y Turismo',
'... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-20 | 'position': 3}]}
Some examples of the tbs parameter:
qdr:h (past hour)
qdr:d (past day)
qdr:w (past week)
qdr:m (past month)
qdr:y (past year)
You can specify intermediate time periods by adding a number:
qdr:h12 (past 12 hours)
qdr:d3 (past 3 days)
qdr:w2 (past 2 weeks)
qdr:m6 (past 6 months)
qdr:m2 (past 2 years)
For... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-21 | 'ratingCount': 91,
'category': 'Italian'},
{'position': 2,
'title': "Tony's Di Napoli",
'address': '1081 3rd Ave',
'latitude': 40.7643567,
'longitude': -73.9642373,
'thumbnailUrl': 'https://lh5.googleusercontent.com/p/AF1QipNbNv6j... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-22 | 'longitude': -73.950351,
'thumbnailUrl': 'https://lh5.googleusercontent.com/p/AF1QipNPCpCPuqPAb1Mv6_fOP7cjb8Wu1rbqbk2sMBlh=w92-h92-n-k-no',
'rating': 4.5,
'ratingCount': 140,
'category': 'Italian'},
{'position': 5,
'title': "Paola's",
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-23 | 'address': '1606 1st Ave.',
'latitude': 40.7750785,
'longitude': -73.9504801,
'thumbnailUrl': 'https://lh5.googleusercontent.com/p/AF1QipPPN5GXxfH3NDacBc0Pt3uGAInd9OChS5isz9RF=w92-h92-n-k-no',
'rating': 4.4,
'ratingCount': 152,
'category': 'I... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
dc38ca462716-24 | 'rating': 4.5,
'ratingCount': 113,
'category': 'Italian'},
{'position': 10,
'title': 'Barbaresco',
'address': '843 Lexington Ave #1',
'latitude': 40.7654332,
'longitude': -73.9656873,
'thumbnailUrl': 'https://lh5.goog... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_serper.html |
919f294c2bb4-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/apify.html |
919f294c2bb4-1 | actor_id="apify/website-content-crawler",
run_input={"startUrls": [{"url": "https://python.langchain.com/en/latest/"}]},
dataset_mapping_function=lambda item: Document(
page_content=item["text"] or "", metadata={"source": item["url"]}
),
)
Initialize the vector index from the crawled documents:
inde... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/apify.html |
125b64df69af-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/metaphor_search.html |
125b64df69af-1 | {'results': [{'url': 'https://www.anthropic.com/index/core-views-on-ai-safety', 'title': 'Core Views on AI Safety: When, Why, What, and How', 'dateCreated': '2023-03-08', 'author': None, 'score': 0.1998831331729889}, {'url': 'https://aisafety.wordpress.com/', 'title': 'Extinction Risk from Artificial Intelligence', 'da... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/metaphor_search.html |
125b64df69af-2 | 'title': 'Planning for AGI and beyond', 'dateCreated': '2023-02-24', 'author': 'Authors', 'score': 0.18665121495723724}, {'url': 'https://waitbutwhy.com/2015/01/artificial-intelligence-revolution-1.html', 'title': 'The Artificial Intelligence Revolution: Part 1 - Wait But Why', 'dateCreated': '2015-01-22', 'author': 'T... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/metaphor_search.html |
125b64df69af-3 | [{'title': 'Core Views on AI Safety: When, Why, What, and How',
'url': 'https://www.anthropic.com/index/core-views-on-ai-safety',
'author': None,
'date_created': '2023-03-08'},
{'title': 'Extinction Risk from Artificial Intelligence',
'url': 'https://aisafety.wordpress.com/',
'author': None,
'date_created'... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/metaphor_search.html |
125b64df69af-4 | 'date_created': '2023-02-24'},
{'title': 'The Artificial Intelligence Revolution: Part 1 - Wait But Why',
'url': 'https://waitbutwhy.com/2015/01/artificial-intelligence-revolution-1.html',
'author': 'Tim Urban',
'date_created': '2015-01-22'},
{'title': 'Anthropic: Core Views on AI Safety: When, Why, What, and H... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/metaphor_search.html |
125b64df69af-5 | )
async_browser = create_async_playwright_browser()
toolkit = PlayWrightBrowserToolkit.from_browser(async_browser=async_browser)
tools = toolkit.get_tools()
tools_by_name = {tool.name: tool for tool in tools}
print(tools_by_name.keys())
navigate_tool = tools_by_name["navigate_browser"]
extract_text = tools_by_name["ext... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/metaphor_search.html |
125b64df69af-6 | Observation: [{'title': 'Center for AI Safety', 'url': 'https://safe.ai/', 'author': None, 'date_created': '2022-01-01'}]
Thought:I need to navigate to the URL provided in the search results to find the tweet.
> Finished chain.
'I need to navigate to the URL provided in the search results to find the tweet.'
previous
I... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/metaphor_search.html |
837ed077b9e5-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/huggingface_tools.html |
2a4fd9a05c74-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/serpapi.html |
2a4fd9a05c74-1 | repl_tool = Tool(
name="python_repl",
description="A Python shell. Use this to execute python commands. Input should be a valid python command. If you want to see the output of a value, you should print it out with `print(...)`.",
func=search.run,
)
previous
SearxNG Search API
next
Twilio
Contents
Custo... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/serpapi.html |
e31df537a713-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/chatgpt_plugins.html |
e31df537a713-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':... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/chatgpt_plugins.html |
e31df537a713-2 | 'title': 'Product'}, 'ProductResponse': {'type': 'object', 'properties': {'products': {'type': 'array', 'items': {'$ref': '#/components/schemas/Product'}}}, 'title': 'ProductResponse'}}}} | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/chatgpt_plugins.html |
e31df537a713-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 | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/chatgpt_plugins.html |
e31df537a713-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/chatgpt_plugins.html |
e31df537a713-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"]}]} | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/chatgpt_plugins.html |
e31df537a713-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/chatgpt_plugins.html |
866df808d6cd-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/python.html |
05e46f3481c5-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/openweathermap.html |
05e46f3481c5-1 | agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True
)
agent_chain.run("What's the weather like in London?")
> Entering new AgentExecutor chain...
I need to find out the current weather in London.
Action: OpenWeatherMap
Action Input: London,GB
Observation: In London,GB, the current weather is as follows:
Deta... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/openweathermap.html |
8d6a6f4996ac-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/filesystem.html |
8d6a6f4996ac-1 | toolkit.get_tools()
[CopyFileTool(name='copy_file', description='Create a copy of a file in a specified location', args_schema=<class 'langchain.tools.file_management.copy.FileCopyInput'>, return_direct=False, verbose=False, callback_manager=<langchain.callbacks.shared.SharedCallbackManager object at 0x1156f4350>, root... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/filesystem.html |
8d6a6f4996ac-2 | MoveFileTool(name='move_file', description='Move or rename a file from one location to another', args_schema=<class 'langchain.tools.file_management.move.FileMoveInput'>, return_direct=False, verbose=False, callback_manager=<langchain.callbacks.shared.SharedCallbackManager object at 0x1156f4350>, root_dir='/var/folders... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/filesystem.html |
8d6a6f4996ac-3 | Selecting File System Tools#
If you only want to select certain tools, you can pass them in as arguments when initializing the toolkit, or you can individually initialize the desired tools.
tools = FileManagementToolkit(root_dir=str(working_directory.name), selected_tools=["read_file", "write_file", "list_directory"]).... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/filesystem.html |
8d6a6f4996ac-4 | write_tool.run({"file_path": "example.txt", "text": "Hello World!"})
'File written successfully to example.txt.'
# List files in the working directory
list_tool.run({})
'example.txt'
previous
DuckDuckGo Search
next
Google Places
Contents
The FileManagementToolkit
Selecting File System Tools
By Harrison Chase
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/filesystem.html |
efd7c70e897c-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.... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_search.html |
efd7c70e897c-1 | "STATE OF HAWAII. 1 Child's First Name. (Type or print). 2. Sex. BARACK. 3. This Birth. CERTIFICATE OF LIVE BIRTH. FILE. NUMBER 151 le. lb. Middle Name. Barack Hussein Obama II is an American former politician who served as the 44th president of the United States from 2009 to 2017. A member of the Democratic\xa0... Whe... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_search.html |
efd7c70e897c-2 | Number of Results#
You can use the k parameter to set the number of results
search = GoogleSearchAPIWrapper(k=1)
tool = Tool(
name = "I'm Feeling Lucky",
description="Search Google and return the first result.",
func=search.run
)
tool.run("python")
'The official home of the Python Programming Language.'
‘Th... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_search.html |
ea0980349fcd-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. ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/awslambda.html |
ea0980349fcd-1 | agent.run("Send an email to test@testing123.com saying hello world.")
previous
ArXiv API Tool
next
Shell Tool
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/awslambda.html |
207d2b5ff204-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/sceneXplain.html |
207d2b5ff204-1 | Observation: In a charmingly whimsical scene, a young girl is seen braving the rain alongside her furry companion, the lovable Totoro. The two are depicted standing on a bustling street corner, where they are sheltered from the rain by a bright yellow umbrella. The girl, dressed in a cheerful yellow frock, holds onto t... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/sceneXplain.html |
207d2b5ff204-2 | By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/sceneXplain.html |
fdfbd3073e65-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/google_places.html |
4ca5061df915-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 ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/twilio.html |
b4320e08235c-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") | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/brave_search.html |
b4320e08235c-1 | '[{"title": "Barack Obama - Wikipedia", "link": "https://en.wikipedia.org/wiki/Barack_Obama", "snippet": "Outside of politics, <strong>Obama</strong> has published three bestselling books: Dreams from My Father (1995), The Audacity of Hope (2006) and A Promised Land (2020). Rankings by scholars and historians, in which... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/brave_search.html |
b4320e08235c-2 | Hussein, Obama\\u2019s middle name, is a very common Arabic name, meaning "good," "handsome," or "beautiful.""}]' | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/brave_search.html |
b4320e08235c-3 | previous
Bing Search
next
ChatGPT Plugins
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/brave_search.html |
16156d453e5b-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/wolfram_alpha.html |
d75cce8b1c87-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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 ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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 '
'ϕ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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 '
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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 '
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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 '
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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':... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
d75cce8b1c87-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/searx_search.html |
53fae5a3f959-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/search_tools.html |
53fae5a3f959-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/search_tools.html |
53fae5a3f959-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/search_tools.html |
53fae5a3f959-3 | Thought: I now know the current weather conditions in Pomfret.
Final Answer: 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%.
> Finished AgentExecutor chain.
'Showers early becoming a steady light rain later in the... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/search_tools.html |
53fae5a3f959-4 | 10 Day Weather - Pomfret, VT As of 3:51 am EST Special Weather Statement Today 39°/ 32° 37% Wed 01 | Day 39° 37% NE 4 mph Cloudy with snow showers developing for the afternoon. High 39F....
Pomfret, CT ; Current Weather. 1:06 AM. 35°F · RealFeel® 32° ; TODAY'S WEATHER FORECAST. 3/3. 44°Hi. RealFeel® 50° ; TONIGHT'S WEA... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/search_tools.html |
53fae5a3f959-5 | 12:00 pm · Feels Like36° · WindN 5 mph · Humidity43% · UV Index3 of 10 · Cloud Cover65% · Rain Amount0 in ...
Pomfret Center, CT Weather Conditions | Weather Underground star Popular Cities San Francisco, CA 49 °F Clear Manhattan, NY 37 °F Fair Schiller Park, IL (60176) warning39 °F Mostly Cloudy...
Thought: I now know... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/search_tools.html |
60f9504612b3-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 = ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/arxiv.html |
60f9504612b3-1 | Final Answer: The paper 1605.08386 is about heat-bath random walks with Markov bases on graphs of lattice points.
> Finished chain.
'The paper 1605.08386 is about heat-bath random walks with Markov bases on graphs of lattice points.'
The ArXiv API Wrapper#
The tool wraps the API Wrapper. Below, we can explore some of t... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/arxiv.html |
60f9504612b3-2 | 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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/arxiv.html |
60f9504612b3-3 | Now, we are trying to find information about non-existing article. In this case, the response is “No good Arxiv Result was found”
docs = arxiv.run("1605.08386WWW")
docs
'No good Arxiv Result was found'
previous
Apify
next
AWS Lambda API
Contents
The ArXiv API Wrapper
By Harrison Chase
© Copyright 2023, H... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/arxiv.html |
08e6d333a176-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/wikipedia.html |
08e6d333a176-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 ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/wikipedia.html |
08e6d333a176-2 | by Viz Media, with the first series having aired on the Funimation Channel in 2009 and the second series broadcast on Adult Swim\'s Toonami programming block from April 2016 to June 2019.\nHunter × Hunter has been a huge critical and financial success and has become one of the best-selling manga series of all time, hav... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/wikipedia.html |
08e6d333a176-3 | cast to voice the characters. The new series premiered airing weekly on Nippon TV and the nationwide Nippon News Network from October 2, 2011. The series started to be collected in both DVD and Blu-ray format on January 25, 2012. Viz Media has licensed the anime for a DVD/Blu-ray release in North America with an Engli... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/wikipedia.html |
08e6d333a176-4 | on special jobs ranging from treasure hunting to assassination. The story initially focuses on Gon Freecss and his quest to become a Hunter in order to find his father, Ging, who is himself a famous Hunter. On the way, Gon meets and becomes close friends with Killua Zoldyck, Kurapika and Leorio Paradinight.\nAlthough m... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/wikipedia.html |
08e6d333a176-5 | previous
Twilio
next
Wolfram Alpha
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/wikipedia.html |
96f7e3de787f-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/graphql.html |
96f7e3de787f-1 | name
classification
homeworld {
name
}
}
}
}
}
"""
suffix = "Search for the titles of all the stawars films stored in the graphql database that has this schema "
agent.run(suffix + graphql_fields)
> Entering new AgentExecutor chain...
I need to query the gr... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/graphql.html |
96f7e3de787f-2 | By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/tools/examples/graphql.html |
ed4adcbf338f-0 | .ipynb
.pdf
SQL Database Agent
Contents
Initialization
Using ZERO_SHOT_REACT_DESCRIPTION
Using OpenAI Functions
Example: describing a table
Example: describing a table, recovering from an error
Example: running queries
Recovering from an error
SQL Database Agent#
This notebook showcases an agent designed to interact ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-1 | verbose=True,
agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION
)
Using OpenAI Functions#
This shows how to initialize the agent using the OPENAI_FUNCTIONS agent type. Note that this is an alternative to the above.
# agent_executor = create_sql_agent(
# llm=ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613"),
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-2 | "TrackId" INTEGER NOT NULL,
PRIMARY KEY ("PlaylistId", "TrackId"),
FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"),
FOREIGN KEY("PlaylistId") REFERENCES "Playlist" ("PlaylistId")
)
```
Here are three sample rows from the `PlaylistTrack` table:
```
PlaylistId TrackId
1 3402
1 3389
1 ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-3 | Action: list_tables_sql_db
Action Input: ""
Observation: Genre, PlaylistTrack, MediaType, Invoice, InvoiceLine, Track, Playlist, Customer, Album, Employee, Artist
Thought: I should look at the schema of the PlaylistSong table
Action: schema_sql_db
Action Input: "PlaylistSong"
Observation: Error: table_names {'PlaylistS... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-4 | Action: list_tables_sql_db
Action Input: ""
Observation: Invoice, MediaType, Artist, InvoiceLine, Genre, Playlist, Employee, Album, PlaylistTrack, Track, Customer
Thought: I should look at the schema of the relevant tables to see what columns I can use.
Action: schema_sql_db
Action Input: "Invoice, Customer"
Observatio... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-5 | 2 Leonie Köhler None Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 +49 0711 2842222 None leonekohler@surfeu.de 5
3 François Tremblay None 1498 rue Bélanger Montréal QC Canada H2G 1A7 +1 (514) 721-4711 None ftremblay@gmail.com 3
CREATE TABLE "Invoice" (
"InvoiceId" INTEGER NOT NULL,
"CustomerId" INTEGER NOT NU... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-6 | Action: query_sql_db
Action Input: SELECT c.Country, SUM(i.Total) AS TotalSales FROM Invoice i INNER JOIN Customer c ON i.CustomerId = c.CustomerId GROUP BY c.Country ORDER BY TotalSales DESC LIMIT 10
Observation: [('USA', 523.0600000000003), ('Canada', 303.9599999999999), ('France', 195.09999999999994), ('Brazil', 190... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-7 | )
SELECT * FROM 'Playlist' LIMIT 3;
PlaylistId Name
1 Music
2 Movies
3 TV Shows
CREATE TABLE "PlaylistTrack" (
"PlaylistId" INTEGER NOT NULL,
"TrackId" INTEGER NOT NULL,
PRIMARY KEY ("PlaylistId", "TrackId"),
FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"),
FOREIGN KEY("PlaylistId") REFERENCES "Playlist"... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-8 | Observation: [('90’s Music', 1477), ('Brazilian Music', 39), ('Classical', 75), ('Classical 101 - Deep Cuts', 25), ('Classical 101 - Next Steps', 25), ('Classical 101 - The Basics', 25), ('Grunge', 15), ('Heavy Metal Classic', 26), ('Music', 6580), ('Music Videos', 1)]
Thought: I now know the final answer.
Final Answer... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-9 | Action: list_tables_sql_db
Action Input: ""
Observation: MediaType, Track, Invoice, Album, Playlist, Customer, Employee, InvoiceLine, PlaylistTrack, Genre, Artist
Thought: I should look at the schema of the Artist, InvoiceLine, and Track tables to see what columns I can use.
Action: schema_sql_db
Action Input: "Artist,... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-10 | 2 Balls to the Wall 2 2 1 None 342562 5510424 0.99
3 Fast As a Shark 3 2 1 F. Baltes, S. Kaufman, U. Dirkscneider & W. Hoffman 230619 3990994 0.99
CREATE TABLE "InvoiceLine" (
"InvoiceLineId" INTEGER NOT NULL,
"InvoiceId" INTEGER NOT NULL,
"TrackId" INTEGER NOT NULL,
"UnitPrice" NUMERIC(10, 2) NOT NULL,
"Quant... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
ed4adcbf338f-11 | [SQL: SELECT Artist.Name, SUM(InvoiceLine.Quantity) AS TotalQuantity FROM Artist INNER JOIN Track ON Artist.ArtistId = Track.ArtistId INNER JOIN InvoiceLine ON Track.TrackId = InvoiceLine.TrackId GROUP BY Artist.Name ORDER BY TotalQuantity DESC LIMIT 3]
(Background on this error at: https://sqlalche.me/e/14/e3q8)
Thoug... | rtdocs_stable/api.python.langchain.com/en/stable/modules/agents/toolkits/examples/sql_database.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.