add few shot example (#148)

This commit is contained in:
Harrison Chase
2022-11-19 20:32:45 -08:00
committed by GitHub
parent 8869b0ab0e
commit c02eb199b6
68 changed files with 2494 additions and 713 deletions
+1 -1
View File
@@ -169,7 +169,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.7"
}
},
"nbformat": 4,
@@ -25,12 +25,12 @@
}
],
"source": [
"from langchain import Prompt, HuggingFaceHub, LLMChain\n",
"from langchain import PromptTemplate, HuggingFaceHub, LLMChain\n",
"\n",
"template = \"\"\"Question: {question}\n",
"\n",
"Answer: Let's think step by step.\"\"\"\n",
"prompt = Prompt(template=template, input_variables=[\"question\"])\n",
"prompt = PromptTemplate(template=template, input_variables=[\"question\"])\n",
"llm_chain = LLMChain(prompt=prompt, llm=HuggingFaceHub(repo_id=\"google/flan-t5-xl\", model_kwargs={\"temperature\":1e-10}))\n",
"\n",
"question = \"What NFL team won the Super Bowl in the year Justin Beiber was born?\"\n",
@@ -63,7 +63,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.7"
}
},
"nbformat": 4,
+3 -3
View File
@@ -69,7 +69,7 @@
"outputs": [],
"source": [
"# Map reduce example\n",
"from langchain import Prompt\n",
"from langchain import PromptTemplate\n",
"from langchain.text_splitter import CharacterTextSplitter\n",
"from langchain.chains.mapreduce import MapReduceChain\n",
"\n",
@@ -81,7 +81,7 @@
"\n",
"\n",
"CONCISE SUMMARY:\"\"\"\n",
"prompt = Prompt(template=_prompt, input_variables=[\"text\"])\n",
"prompt = PromptTemplate(template=_prompt, input_variables=[\"text\"])\n",
"\n",
"text_splitter = CharacterTextSplitter()\n",
"\n",
@@ -202,7 +202,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.7"
},
"vscode": {
"interpreter": {