Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update import paths and move to lcel for llama.cpp examples #19391

Merged
merged 3 commits into from
Mar 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 10 additions & 12 deletions docs/docs/integrations/llms/llamacpp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,9 @@
},
"outputs": [],
"source": [
"from langchain.callbacks.manager import CallbackManager\n",
"from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler\n",
"from langchain.chains import LLMChain\n",
"from langchain.prompts import PromptTemplate\n",
"from langchain_community.llms import LlamaCpp"
"from langchain_community.llms import LlamaCpp\n",
"from langchain_core.callbacks import CallbackManager, StreamingStdOutCallbackHandler\n",
"from langchain_core.prompts import PromptTemplate"
]
},
{
Expand Down Expand Up @@ -329,10 +327,10 @@
}
],
"source": [
"prompt = \"\"\"\n",
"question = \"\"\"\n",
"Question: A rap battle between Stephen Colbert and John Oliver\n",
"\"\"\"\n",
"llm.invoke(prompt)"
"llm.invoke(question)"
]
},
{
Expand Down Expand Up @@ -360,7 +358,7 @@
"metadata": {},
"outputs": [],
"source": [
"llm_chain = LLMChain(prompt=prompt, llm=llm)"
"llm_chain = prompt | llm"
]
},
{
Expand Down Expand Up @@ -406,7 +404,7 @@
],
"source": [
"question = \"What NFL team won the Super Bowl in the year Justin Bieber was born?\"\n",
"llm_chain.run(question)"
"llm_chain.invoke({\"question\": question})"
]
},
{
Expand Down Expand Up @@ -488,9 +486,9 @@
}
],
"source": [
"llm_chain = LLMChain(prompt=prompt, llm=llm)\n",
"llm_chain = prompt | llm\n",
"question = \"What NFL team won the Super Bowl in the year Justin Bieber was born?\"\n",
"llm_chain.run(question)"
"llm_chain.invoke({\"question\": question})"
]
},
{
Expand Down Expand Up @@ -710,7 +708,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.9.1"
},
"vscode": {
"interpreter": {
Expand Down