{
"cells": [
{
"cell_type": "markdown",
"id": "eda326e4",
"metadata": {},
"source": [
"# Brave Search\n",
"\n",
"This notebook goes over how to use the Brave Search tool."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a4c896e5",
"metadata": {},
"outputs": [],
"source": [
"from langchain.tools import BraveSearch"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "6784d37c",
"metadata": {},
"outputs": [],
"source": [
"api_key = \"BSAv1neIuQOsxqOyy0sEe_ie2zD_n_V\""
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "5b14008a",
"metadata": {},
"outputs": [],
"source": [
"tool = BraveSearch.from_api_key(api_key=api_key, search_kwargs={\"count\": 3})"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "f11937b2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'[{\"title\": \"Obama\\'s Middle Name -- My Last Name -- is \\'Hussein.\\' So?\", \"link\": \"https://www.cair.com/cair_in_the_news/obamas-middle-name-my-last-name-is-hussein-so/\", \"snippet\": \"I wasn\\\\u2019t sure whether to laugh or cry a few days back listening to radio talk show host Bill Cunningham repeatedly scream Barack Obama\\\\u2019s middle name \\\\u2014 my last name \\\\u2014 as if he had anti-Muslim Tourette\\\\u2019s. \\\\u201cHussein,\\\\u201d Cunningham hissed like he was beckoning Satan when shouting the ...\"}, {\"title\": \"What\\'s up with Obama\\'s middle name? - Quora\", \"link\": \"https://www.quora.com/Whats-up-with-Obamas-middle-name\", \"snippet\": \"Answer (1 of 15): A better question would be, \\\\u201cWhat\\\\u2019s up with Obama\\\\u2019s first name?\\\\u201d President Barack Hussein Obama\\\\u2019s father\\\\u2019s name was Barack Hussein Obama. He was named after his father. Hussein, Obama\\\\u2019s middle name, is a very common Arabic name, meaning "good," "handsome," or ...\"}, {\"title\": \"Barack Obama | Biography, Parents, Education, Presidency, Books, ...\", \"link\": \"https://www.britannica.com/biography/Barack-Obama\", \"snippet\": \"Barack Obama, in full Barack Hussein Obama II, (born August 4, 1961, Honolulu, Hawaii, U.S.), 44th president of the United States (2009\\\\u201317) and the first African American to hold the office. Before winning the presidency, Obama represented Illinois in the U.S.\"}]'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tool.run(\"obama middle name\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "da9c63d5",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}