From 0456ec19f2bf2a5b20044296344705c9ba798e30 Mon Sep 17 00:00:00 2001 From: Samantha Whitmore Date: Sun, 20 Nov 2022 13:34:19 -0800 Subject: [PATCH] Updated a few things that seemed out of date in the getting started docs --- docs/getting_started/chains.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/getting_started/chains.md b/docs/getting_started/chains.md index 86d57a41..c280423c 100644 --- a/docs/getting_started/chains.md +++ b/docs/getting_started/chains.md @@ -12,28 +12,36 @@ This is easy to do with LangChain! First lets define the prompt: ```python -from langchain.prompts import PromptTemplate +from langchain import Prompt -prompt = PromptTemplate( +prompt = Prompt( input_variables=["product"], template="What is a good name for a company that makes {product}?", ) ``` +Next, let's instantiate the LLM (we'll use OpenAI's text-davinci-002 model in this example, with a temperature setting of 0.5. + +```python +from langchain import OpenAI + +llm = OpenAI(model_name="text-davinci-002", temperature=0.5) +``` + We can now create a very simple chain that will take user input, format the prompt with it, and then send it to the LLM: ```python -from langchain.chains import LLMChain +from langchain import LLMChain chain = LLMChain(llm=llm, prompt=prompt) ``` Now we can run that can only specifying the product! ```python -chain.run("colorful socks") +chain.predict("colorful socks") ``` There we go! There's the first chain. -That is it for the Getting Started example. +That is it for the Getting Started example. As a next step, we would suggest checking out the more complex chains in the [Demos section](/examples/demos)