mirror of
https://github.com/hwchase17/langchain.git
synced 2026-01-24 05:50:18 +00:00
q
This commit is contained in:
@@ -56,12 +56,12 @@
|
||||
"from langchain.chat_models import ChatOpenAI\n",
|
||||
"from langchain.llms import OpenAI\n",
|
||||
"from langchain.chains.question_answering import load_qa_chain\n",
|
||||
"from langchain.chains.research.fetch import PlaywrightDownloadHandler"
|
||||
"from langchain.chains.research.download import PlaywrightDownloadHandler"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": 2,
|
||||
"id": "70474885-0acd-41b2-8050-15dd54f44f1e",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
@@ -69,24 +69,17 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"question = \"\"\"\\\n",
|
||||
"Compile information about Harrison Chase from langchain. \n",
|
||||
"Ignore if it's a different Harrison Chase. \n",
|
||||
"Compile information about Albert Einstein.\n",
|
||||
"Ignore if it's a different Albert Einstein. \n",
|
||||
"Only include information you're certain about.\n",
|
||||
"\n",
|
||||
"Include:\n",
|
||||
"* education history\n",
|
||||
"* verbal skills\n",
|
||||
"* work history \n",
|
||||
"* favorite pets\n",
|
||||
"* phone number\n",
|
||||
"* hobbies\n",
|
||||
"* does he like sports\n",
|
||||
"* is he a honest person?\n",
|
||||
"* living location\n",
|
||||
"* social profiles (e.g., github, twitter, etc.)\n",
|
||||
"* smoking habits\n",
|
||||
"* which languages can he code in?\n",
|
||||
"* does he play sports?\n",
|
||||
"* major contributions\n",
|
||||
"* names of spouse \n",
|
||||
"* date of birth\n",
|
||||
"* place of birth\n",
|
||||
"* a 3 sentence short biography\n",
|
||||
"\n",
|
||||
"Format your answer in a bullet point format for each sub-question.\n",
|
||||
"\n",
|
||||
@@ -105,7 +98,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": 3,
|
||||
"id": "e74a44b4-2075-4cc6-933e-c769bf3f6002",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
@@ -128,7 +121,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 4,
|
||||
"id": "2f538062-14e3-49ab-9b25-bc470eb5869c",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
@@ -140,7 +133,50 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": 7,
|
||||
"id": "e7de5ba1-c4c1-45db-b385-41c34bc11d02",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"d = PlaywrightDownloadHandler()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"id": "6b21a400-fe9f-4d14-8576-174a67825663",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "ValueError",
|
||||
"evalue": "Could not create a blob for content at https://www.britannica.com/biography/Albert-Einstein. Content type is <class 'playwright._impl._api_types.TimeoutError'>",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mValidationError\u001b[0m Traceback (most recent call last)",
|
||||
"File \u001b[0;32m~/src/langchain/langchain/chains/research/download.py:117\u001b[0m, in \u001b[0;36m_repackage_as_blobs\u001b[0;34m(urls, contents)\u001b[0m\n\u001b[1;32m 116\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 117\u001b[0m blobs\u001b[38;5;241m.\u001b[39mappend(\u001b[43mBlob\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcontent\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmimetype\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmimetype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 118\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ValidationError:\n",
|
||||
"File \u001b[0;32m~/.pyenv/versions/3.11.1/envs/langchain/lib/python3.11/site-packages/pydantic/main.py:341\u001b[0m, in \u001b[0;36mpydantic.main.BaseModel.__init__\u001b[0;34m()\u001b[0m\n",
|
||||
"\u001b[0;31mValidationError\u001b[0m: 2 validation errors for Blob\ndata\n byte type expected (type=type_error.bytes)\ndata\n str type expected (type=type_error.str)",
|
||||
"\nDuring handling of the above exception, another exception occurred:\n",
|
||||
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[0;32mIn[9], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m s \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m d\u001b[38;5;241m.\u001b[39madownload([\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mhttps://www.britannica.com/biography/Albert-Einstein\u001b[39m\u001b[38;5;124m'\u001b[39m])\n",
|
||||
"File \u001b[0;32m~/src/langchain/langchain/chains/research/download.py:92\u001b[0m, in \u001b[0;36mPlaywrightDownloadHandler.adownload\u001b[0;34m(self, urls)\u001b[0m\n\u001b[1;32m 89\u001b[0m contents \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m asyncio\u001b[38;5;241m.\u001b[39mgather(\u001b[38;5;241m*\u001b[39mtasks, return_exceptions\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m 90\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m browser\u001b[38;5;241m.\u001b[39mclose()\n\u001b[0;32m---> 92\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_repackage_as_blobs\u001b[49m\u001b[43m(\u001b[49m\u001b[43murls\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontents\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[0;32m~/src/langchain/langchain/chains/research/download.py:119\u001b[0m, in \u001b[0;36m_repackage_as_blobs\u001b[0;34m(urls, contents)\u001b[0m\n\u001b[1;32m 117\u001b[0m blobs\u001b[38;5;241m.\u001b[39mappend(Blob(data\u001b[38;5;241m=\u001b[39mcontent, mimetype\u001b[38;5;241m=\u001b[39mmimetype, path\u001b[38;5;241m=\u001b[39murl))\n\u001b[1;32m 118\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ValidationError:\n\u001b[0;32m--> 119\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 120\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not create a blob for content at \u001b[39m\u001b[38;5;132;01m{\u001b[39;00murl\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mContent type is \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mtype\u001b[39m(content)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 122\u001b[0m )\n\u001b[1;32m 124\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m blobs\n",
|
||||
"\u001b[0;31mValueError\u001b[0m: Could not create a blob for content at https://www.britannica.com/biography/Albert-Einstein. Content type is <class 'playwright._impl._api_types.TimeoutError'>"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"s = await d.adownload(['https://www.britannica.com/biography/Albert-Einstein'])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "a96f3ed3-10de-4a85-9e93-a8b78d8bfbb6",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
@@ -151,29 +187,39 @@
|
||||
" query_generation_llm=llm, \n",
|
||||
" link_selection_llm=selector_llm, \n",
|
||||
" underlying_reader_chain=qa_chain, \n",
|
||||
" top_k_per_search=3, \n",
|
||||
" max_num_pages_per_doc=30, \n",
|
||||
" top_k_per_search=2, \n",
|
||||
" max_num_pages_per_doc=3, \n",
|
||||
" download_handler=PlaywrightDownloadHandler()\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 6,
|
||||
"id": "3207c696-a72c-4378-b427-7d285f5fdd1c",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Retrying langchain.llms.openai.acompletion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised RateLimitError: The server had an error while processing your request. Sorry about that!.\n",
|
||||
"Retrying langchain.llms.openai.acompletion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised RateLimitError: The server had an error while processing your request. Sorry about that!.\n",
|
||||
"Retrying langchain.llms.openai.acompletion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised RateLimitError: The server had an error while processing your request. Sorry about that!.\n",
|
||||
"Retrying langchain.llms.openai.acompletion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised RateLimitError: The server had an error while processing your request. Sorry about that!.\n",
|
||||
"Retrying langchain.llms.openai.acompletion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised RateLimitError: The server had an error while processing your request. Sorry about that!.\n"
|
||||
"ename": "ValueError",
|
||||
"evalue": "Could not create a blob for content at https://www.britannica.com/biography/Albert-Einstein. Content type is <class 'playwright._impl._api_types.TimeoutError'>",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mValidationError\u001b[0m Traceback (most recent call last)",
|
||||
"File \u001b[0;32m~/src/langchain/langchain/chains/research/download.py:117\u001b[0m, in \u001b[0;36m_repackage_as_blobs\u001b[0;34m(urls, contents)\u001b[0m\n\u001b[1;32m 116\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 117\u001b[0m blobs\u001b[38;5;241m.\u001b[39mappend(\u001b[43mBlob\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcontent\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmimetype\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmimetype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 118\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ValidationError:\n",
|
||||
"File \u001b[0;32m~/.pyenv/versions/3.11.1/envs/langchain/lib/python3.11/site-packages/pydantic/main.py:341\u001b[0m, in \u001b[0;36mpydantic.main.BaseModel.__init__\u001b[0;34m()\u001b[0m\n",
|
||||
"\u001b[0;31mValidationError\u001b[0m: 2 validation errors for Blob\ndata\n byte type expected (type=type_error.bytes)\ndata\n str type expected (type=type_error.str)",
|
||||
"\nDuring handling of the above exception, another exception occurred:\n",
|
||||
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[0;32mIn[6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m results \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m research\u001b[38;5;241m.\u001b[39macall(inputs\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mquestion\u001b[39m\u001b[38;5;124m'\u001b[39m: question})\n",
|
||||
"File \u001b[0;32m~/src/langchain/langchain/chains/base.py:178\u001b[0m, in \u001b[0;36mChain.acall\u001b[0;34m(self, inputs, return_only_outputs, callbacks)\u001b[0m\n\u001b[1;32m 176\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (\u001b[38;5;167;01mKeyboardInterrupt\u001b[39;00m, \u001b[38;5;167;01mException\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 177\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m run_manager\u001b[38;5;241m.\u001b[39mon_chain_error(e)\n\u001b[0;32m--> 178\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m e\n\u001b[1;32m 179\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m run_manager\u001b[38;5;241m.\u001b[39mon_chain_end(outputs)\n\u001b[1;32m 180\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mprep_outputs(inputs, outputs, return_only_outputs)\n",
|
||||
"File \u001b[0;32m~/src/langchain/langchain/chains/base.py:172\u001b[0m, in \u001b[0;36mChain.acall\u001b[0;34m(self, inputs, return_only_outputs, callbacks)\u001b[0m\n\u001b[1;32m 166\u001b[0m run_manager \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m callback_manager\u001b[38;5;241m.\u001b[39mon_chain_start(\n\u001b[1;32m 167\u001b[0m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m},\n\u001b[1;32m 168\u001b[0m inputs,\n\u001b[1;32m 169\u001b[0m )\n\u001b[1;32m 170\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 171\u001b[0m outputs \u001b[38;5;241m=\u001b[39m (\n\u001b[0;32m--> 172\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_acall(inputs, run_manager\u001b[38;5;241m=\u001b[39mrun_manager)\n\u001b[1;32m 173\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m new_arg_supported\n\u001b[1;32m 174\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_acall(inputs)\n\u001b[1;32m 175\u001b[0m )\n\u001b[1;32m 176\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (\u001b[38;5;167;01mKeyboardInterrupt\u001b[39;00m, \u001b[38;5;167;01mException\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 177\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m run_manager\u001b[38;5;241m.\u001b[39mon_chain_error(e)\n",
|
||||
"File \u001b[0;32m~/src/langchain/langchain/chains/research/api.py:110\u001b[0m, in \u001b[0;36mResearch._acall\u001b[0;34m(self, inputs, run_manager)\u001b[0m\n\u001b[1;32m 105\u001b[0m search_results \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msearcher\u001b[38;5;241m.\u001b[39macall(\n\u001b[1;32m 106\u001b[0m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mquestion\u001b[39m\u001b[38;5;124m\"\u001b[39m: question},\n\u001b[1;32m 107\u001b[0m callbacks\u001b[38;5;241m=\u001b[39mrun_manager\u001b[38;5;241m.\u001b[39mget_child() \u001b[38;5;28;01mif\u001b[39;00m run_manager \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 108\u001b[0m )\n\u001b[1;32m 109\u001b[0m urls \u001b[38;5;241m=\u001b[39m search_results[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124murls\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[0;32m--> 110\u001b[0m blobs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdownloader\u001b[38;5;241m.\u001b[39madownload(urls)\n\u001b[1;32m 111\u001b[0m parser \u001b[38;5;241m=\u001b[39m MarkdownifyHTMLParser()\n\u001b[1;32m 112\u001b[0m docs \u001b[38;5;241m=\u001b[39m itertools\u001b[38;5;241m.\u001b[39mchain\u001b[38;5;241m.\u001b[39mfrom_iterable(parser\u001b[38;5;241m.\u001b[39mlazy_parse(blob) \u001b[38;5;28;01mfor\u001b[39;00m blob \u001b[38;5;129;01min\u001b[39;00m blobs)\n",
|
||||
"File \u001b[0;32m~/src/langchain/langchain/chains/research/download.py:92\u001b[0m, in \u001b[0;36mPlaywrightDownloadHandler.adownload\u001b[0;34m(self, urls)\u001b[0m\n\u001b[1;32m 89\u001b[0m contents \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m asyncio\u001b[38;5;241m.\u001b[39mgather(\u001b[38;5;241m*\u001b[39mtasks, return_exceptions\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m 90\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m browser\u001b[38;5;241m.\u001b[39mclose()\n\u001b[0;32m---> 92\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_repackage_as_blobs\u001b[49m\u001b[43m(\u001b[49m\u001b[43murls\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontents\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[0;32m~/src/langchain/langchain/chains/research/download.py:119\u001b[0m, in \u001b[0;36m_repackage_as_blobs\u001b[0;34m(urls, contents)\u001b[0m\n\u001b[1;32m 117\u001b[0m blobs\u001b[38;5;241m.\u001b[39mappend(Blob(data\u001b[38;5;241m=\u001b[39mcontent, mimetype\u001b[38;5;241m=\u001b[39mmimetype, path\u001b[38;5;241m=\u001b[39murl))\n\u001b[1;32m 118\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ValidationError:\n\u001b[0;32m--> 119\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 120\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not create a blob for content at \u001b[39m\u001b[38;5;132;01m{\u001b[39;00murl\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mContent type is \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mtype\u001b[39m(content)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 122\u001b[0m )\n\u001b[1;32m 124\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m blobs\n",
|
||||
"\u001b[0;31mValueError\u001b[0m: Could not create a blob for content at https://www.britannica.com/biography/Albert-Einstein. Content type is <class 'playwright._impl._api_types.TimeoutError'>"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -183,57 +229,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"execution_count": null,
|
||||
"id": "6971fee2-ad44-48bd-8ee8-71682cd61a30",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "843616b3-32d7-49c7-a42b-b0272d71f3ed",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"----------------------------------------------------------------------------------------------------------------------------------------------------------------\n",
|
||||
"https://www.linkedin.com/in/harrison-chase-961287118\n",
|
||||
"\n",
|
||||
"Download May Have Failed.\n",
|
||||
"----------------------------------------------------------------------------------------------------------------------------------------------------------------\n",
|
||||
"https://github.com/hwchase17\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"* Education history: Unknown\n",
|
||||
"* Verbal skills: Unknown\n",
|
||||
"* Work history: GitHub user since 2015, 3,548 contributions in the last year\n",
|
||||
"* Favorite pets: Unknown\n",
|
||||
"* Phone number: Unknown\n",
|
||||
"* Hobbies: Unknown\n",
|
||||
"* Does he like sports: Unknown\n",
|
||||
"* Is he a honest person?: Unknown\n",
|
||||
"* Living location: Unknown\n",
|
||||
"* Social profiles: GitHub (https://github.com/hwchase17)\n",
|
||||
"* Smoking habits: Unknown\n",
|
||||
"* Which languages can he code in?: Python, TypeScript\n",
|
||||
"* Does he play sports?: Unknown\n",
|
||||
"----------------------------------------------------------------------------------------------------------------------------------------------------------------\n",
|
||||
"https://twitter.com/hwchase17?lang=en\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"* Education history: Unknown\n",
|
||||
"* Verbal skills: Unknown\n",
|
||||
"* Work history: CEO of LangChainAI, previously RobustHQ and Kensho\n",
|
||||
"* Favorite pets: Unknown\n",
|
||||
"* Phone number: Unknown\n",
|
||||
"* Hobbies: Unknown\n",
|
||||
"* Does he like sports: Unknown\n",
|
||||
"* Is he a honest person: Unknown\n",
|
||||
"* Living location: Unknown\n",
|
||||
"* Social profiles: Twitter (@hwchase17)\n",
|
||||
"* Smoking habits: Unknown\n",
|
||||
"* Which languages can he code in: Unknown\n",
|
||||
"* Does he play sports: Unknown\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for doc in results['docs']:\n",
|
||||
" print('--'*80)\n",
|
||||
@@ -251,7 +260,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"execution_count": null,
|
||||
"id": "76136bff-b7df-4539-9bcb-760fc4449390",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
@@ -263,7 +272,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 27,
|
||||
"execution_count": null,
|
||||
"id": "b352f3f3-6777-4795-acbb-ed26ecac137d",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
@@ -275,33 +284,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"execution_count": null,
|
||||
"id": "1c90c305-a89d-42e2-b975-dda039e816b6",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" \n",
|
||||
"* Education history: Unknown\n",
|
||||
"* Verbal skills: Unknown\n",
|
||||
"* Work history: CEO of LangChainAI, previously RobustHQ and Kensho\n",
|
||||
"* Favorite pets: Unknown\n",
|
||||
"* Phone number: Unknown\n",
|
||||
"* Hobbies: Unknown\n",
|
||||
"* Does he like sports: Unknown\n",
|
||||
"* Is he a honest person: Unknown\n",
|
||||
"* Living location: Unknown\n",
|
||||
"* Social profiles: GitHub (https://github.com/hwchase17), Twitter (@hwchase17)\n",
|
||||
"* Smoking habits: Unknown\n",
|
||||
"* Which languages can he code in: Unknown\n",
|
||||
"* Does he play sports: Unknown\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"print(summary['output_text'])"
|
||||
]
|
||||
@@ -324,26 +312,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 53,
|
||||
"execution_count": null,
|
||||
"id": "4e2c369c-8763-458e-9ab8-684466395890",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'question': \"Compile information about Harrison Chase from langchain. \\nIgnore if it's a different harrison chase. \\nOnly include information you're certain about.\\n\\nInclude:\\n* education history\\n* verbal skills\\n* work history \\n* favorite pets\\n* phone number\\n* hobbies\\n* does he like sports\\n* is he a honest person?\\n* living location\\n* social profiles (e.g., github, twitter, etc.)\\n* smoking habits\\n* which languages can he code in?\\n* does he play sports?\",\n",
|
||||
" 'urls': ['https://www.linkedin.com/in/harrison-chase-961287118',\n",
|
||||
" 'https://www.youtube.com/watch?v=zaYTXQFR0_s',\n",
|
||||
" 'https://twitter.com/hwchase17?lang=en']}"
|
||||
]
|
||||
},
|
||||
"execution_count": 53,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"results = await research.searcher.acall(inputs={'question': question})\n",
|
||||
"results"
|
||||
@@ -359,7 +333,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 58,
|
||||
"execution_count": null,
|
||||
"id": "c6f9d1b5-e513-4d8d-b325-32eacbee92b4",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
@@ -371,46 +345,24 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 65,
|
||||
"execution_count": null,
|
||||
"id": "964aae51-6a1f-4f63-a6fe-11c83557888a",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'<!DOCTYPE html><html lang=\"en-US\" class=\"artdeco \"'"
|
||||
]
|
||||
},
|
||||
"execution_count": 65,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"blobs[0].as_string()[:50]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 66,
|
||||
"execution_count": null,
|
||||
"id": "7faf045a-e9e6-4ebb-b0ee-618b958a9790",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'https://www.linkedin.com/in/harrison-chase-961287118'"
|
||||
]
|
||||
},
|
||||
"execution_count": 66,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"blobs[0].source"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user