2022-10-26 05:00:33 +00:00
|
|
|
{
|
|
|
|
"cells": [
|
2022-11-14 04:13:23 +00:00
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"id": "959300d4",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
2023-02-08 19:05:28 +00:00
|
|
|
"# Hugging Face Hub\n",
|
2022-11-14 04:13:23 +00:00
|
|
|
"\n",
|
2023-02-08 19:05:28 +00:00
|
|
|
"This example showcases how to connect to the Hugging Face Hub."
|
2022-11-14 04:13:23 +00:00
|
|
|
]
|
|
|
|
},
|
2022-10-26 05:00:33 +00:00
|
|
|
{
|
|
|
|
"cell_type": "code",
|
Docs refactor (#480)
Big docs refactor! Motivation is to make it easier for people to find
resources they are looking for. To accomplish this, there are now three
main sections:
- Getting Started: steps for getting started, walking through most core
functionality
- Modules: these are different modules of functionality that langchain
provides. Each part here has a "getting started", "how to", "key
concepts" and "reference" section (except in a few select cases where it
didnt easily fit).
- Use Cases: this is to separate use cases (like summarization, question
answering, evaluation, etc) from the modules, and provide a different
entry point to the code base.
There is also a full reference section, as well as extra resources
(glossary, gallery, etc)
Co-authored-by: Shreya Rajpal <ShreyaR@users.noreply.github.com>
2023-01-02 16:24:09 +00:00
|
|
|
"execution_count": 3,
|
2022-10-26 05:00:33 +00:00
|
|
|
"id": "3acf0069",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
2022-10-26 05:05:11 +00:00
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
2023-02-11 01:56:15 +00:00
|
|
|
"The Seattle Seahawks won the Super Bowl in 2010. Justin Beiber was born in 2010. The final answer: Seattle Seahawks.\n"
|
2022-10-26 05:00:33 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2022-11-20 04:32:45 +00:00
|
|
|
"from langchain import PromptTemplate, HuggingFaceHub, LLMChain\n",
|
2022-10-26 05:00:33 +00:00
|
|
|
"\n",
|
|
|
|
"template = \"\"\"Question: {question}\n",
|
|
|
|
"\n",
|
|
|
|
"Answer: Let's think step by step.\"\"\"\n",
|
2022-11-20 04:32:45 +00:00
|
|
|
"prompt = PromptTemplate(template=template, input_variables=[\"question\"])\n",
|
2023-02-11 01:56:15 +00:00
|
|
|
"llm_chain = LLMChain(prompt=prompt, llm=HuggingFaceHub(repo_id=\"google/flan-t5-xl\", model_kwargs={\"temperature\":0, \"max_length\":64}))\n",
|
2022-10-26 05:00:33 +00:00
|
|
|
"\n",
|
|
|
|
"question = \"What NFL team won the Super Bowl in the year Justin Beiber was born?\"\n",
|
|
|
|
"\n",
|
2022-11-14 04:13:23 +00:00
|
|
|
"print(llm_chain.run(question))"
|
2022-10-26 05:00:33 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "ae4559c7",
|
|
|
|
"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",
|
Docs refactor (#480)
Big docs refactor! Motivation is to make it easier for people to find
resources they are looking for. To accomplish this, there are now three
main sections:
- Getting Started: steps for getting started, walking through most core
functionality
- Modules: these are different modules of functionality that langchain
provides. Each part here has a "getting started", "how to", "key
concepts" and "reference" section (except in a few select cases where it
didnt easily fit).
- Use Cases: this is to separate use cases (like summarization, question
answering, evaluation, etc) from the modules, and provide a different
entry point to the code base.
There is also a full reference section, as well as extra resources
(glossary, gallery, etc)
Co-authored-by: Shreya Rajpal <ShreyaR@users.noreply.github.com>
2023-01-02 16:24:09 +00:00
|
|
|
"version": "3.10.9"
|
2022-10-26 05:00:33 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 5
|
|
|
|
}
|