Add youdotcom retriever (#11304)

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
mrbean
2023-10-05 16:48:11 -04:00
committed by GitHub
parent 1655ff2ded
commit 9903a70379
4 changed files with 150 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "47828a7a",
"metadata": {},
"source": [
"## Using the You.com Retriever\n",
"The retriever from You.com is good for retrieving lots of text. We return multiple of the best text snippets per URL we find to be relevant.\n",
"\n",
"First you just need to initialize the retriever"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a90d61d4",
"metadata": {},
"outputs": [],
"source": [
"from langchain.retrievers.you_retriever import YouRetriever\n",
"from langchain.chains import RetrievalQA\n",
"from langchain.llms import OpenAI\n",
"\n",
"yr = YouRetriever()\n",
"qa = RetrievalQA.from_chain_type(llm=OpenAI(), chain_type=\"map_reduce\", retriever=yr)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4a223f2f",
"metadata": {},
"outputs": [],
"source": [
"query = \"what starting ohio state quarterback most recently went their entire college career without beating Michigan?\"\n",
"qa.run(query)"
]
}
],
"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.9.17"
}
},
"nbformat": 4,
"nbformat_minor": 5
}