mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
4cc18d6c2a
make stuff look nice
75 lines
1.9 KiB
Plaintext
75 lines
1.9 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "7e3b513e",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\u001b[49m\n",
|
|
"Are follow up questions needed here:\u001b[0m\u001b[102m Yes.\n",
|
|
"Follow up: Who is the reigning men's U.S. Open champion?\u001b[0m\u001b[49m\n",
|
|
"Intermediate answer: \u001b[0m\u001b[103mCarlos Alcaraz.\u001b[0m\u001b[102m\n",
|
|
"Follow up: Where is Carlos Alcaraz from?\u001b[0m\u001b[49m\n",
|
|
"Intermediate answer: \u001b[0m\u001b[103mEl Palmar, Murcia, Spain.\u001b[0m\u001b[102m\n",
|
|
"So the final answer is: El Palmar, Murcia, Spain\u001b[0m"
|
|
]
|
|
},
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"'\\nSo the final answer is: El Palmar, Murcia, Spain'"
|
|
]
|
|
},
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"from langchain import SelfAskWithSearchChain, OpenAI, SerpAPIChain\n",
|
|
"\n",
|
|
"llm = OpenAI(temperature=0)\n",
|
|
"search = SerpAPIChain()\n",
|
|
"\n",
|
|
"self_ask_with_search = SelfAskWithSearchChain(llm=llm, search_chain=search, verbose=True)\n",
|
|
"\n",
|
|
"self_ask_with_search.run(\"What is the hometown of the reigning men's U.S. Open champion?\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "6195fc82",
|
|
"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.7.6"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|