mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-23 11:30:37 +00:00
@@ -94,7 +94,7 @@
|
||||
"]\n",
|
||||
"example_prompt = PromptTemplate(input_variables=[\"question\", \"answer\"], template=\"Question: {question}\\n{answer}\")\n",
|
||||
"\n",
|
||||
"prompt = FewShotPrompt(\n",
|
||||
"prompt = FewShotPromptTemplate(\n",
|
||||
" examples=examples, \n",
|
||||
" example_prompt=example_prompt, \n",
|
||||
" suffix=\"Question: {input}\", \n",
|
||||
@@ -104,7 +104,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 4,
|
||||
"id": "897d4e08",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -128,7 +128,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 5,
|
||||
"id": "7ab7379f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -298,7 +298,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.7"
|
||||
"version": "3.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@@ -73,7 +73,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 3,
|
||||
"id": "a7bd36bc",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
@@ -87,7 +87,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 4,
|
||||
"id": "e1efb008",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
@@ -100,15 +100,26 @@
|
||||
"text/plain": [
|
||||
"['',\n",
|
||||
" '',\n",
|
||||
" 'Question: What is the highest mountain peak in North America?',\n",
|
||||
" '',\n",
|
||||
" 'Question: Is the film \"The Omen\" based on a book?',\n",
|
||||
" 'Thought 1: I need to search \"The Omen\" and find if it is based on a book.',\n",
|
||||
" 'Action 1: Search[\"The Omen\"]',\n",
|
||||
" 'Observation 1: The Omen is a 1976 American supernatural horror film directed by Richard Donner and written by David Seltzer.',\n",
|
||||
" 'Thought 2: The Omen is not based on a book.']"
|
||||
" 'Thought 1: I need to search North America and find the highest mountain peak.',\n",
|
||||
" '',\n",
|
||||
" 'Action 1: Search[North America]',\n",
|
||||
" '',\n",
|
||||
" 'Observation 1: North America is a continent entirely within the Northern Hemisphere and almost all within the Western Hemisphere.',\n",
|
||||
" '',\n",
|
||||
" 'Thought 2: I need to look up \"highest mountain peak\".',\n",
|
||||
" '',\n",
|
||||
" 'Action 2: Lookup[highest mountain peak]',\n",
|
||||
" '',\n",
|
||||
" 'Observation 2: (Result 1 / 1) Denali, formerly Mount McKinley, is the highest mountain peak in North America, with a summit elevation of 20,310 feet (6,190 m) above sea level.',\n",
|
||||
" '',\n",
|
||||
" 'Thought 3: Denali is the highest mountain peak in North America, with a summit elevation of 20,310 feet.',\n",
|
||||
" '',\n",
|
||||
" 'Action 3: Finish[20,310 feet]']"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -142,7 +153,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.7"
|
||||
"version": "3.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@@ -191,7 +191,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain.prompts.few_shot import FewShotPromptTemplate"
|
||||
"from langchain.prompts import FewShotPromptTemplate"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -276,7 +276,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain.prompts.example_selector.length_based import LengthBasedExampleSelector"
|
||||
"from langchain.prompts.example_selector import LengthBasedExampleSelector"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -298,7 +298,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"execution_count": 10,
|
||||
"id": "207e55f7",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -328,7 +328,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"execution_count": 11,
|
||||
"id": "d00b4385",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -365,7 +365,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"execution_count": 12,
|
||||
"id": "878bcde9",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -406,7 +406,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain.prompts.example_selector.semantic_similarity import SemanticSimilarityExampleSelector\n",
|
||||
"from langchain.prompts.example_selector import SemanticSimilarityExampleSelector\n",
|
||||
"from langchain.vectorstores import FAISS\n",
|
||||
"from langchain.embeddings import OpenAIEmbeddings"
|
||||
]
|
||||
|
Reference in New Issue
Block a user