Compare commits

...

1 Commits

Author SHA1 Message Date
Samantha Whitmore 0456ec19f2 Updated a few things that seemed out of date in the getting started docs 2 years ago

@ -12,28 +12,36 @@ This is easy to do with LangChain!
First lets define the prompt: First lets define the prompt:
```python ```python
from langchain.prompts import PromptTemplate from langchain import Prompt
prompt = PromptTemplate( prompt = Prompt(
input_variables=["product"], input_variables=["product"],
template="What is a good name for a company that makes {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: 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 ```python
from langchain.chains import LLMChain from langchain import LLMChain
chain = LLMChain(llm=llm, prompt=prompt) chain = LLMChain(llm=llm, prompt=prompt)
``` ```
Now we can run that can only specifying the product! Now we can run that can only specifying the product!
```python ```python
chain.run("colorful socks") chain.predict("colorful socks")
``` ```
There we go! There's the first chain. 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) As a next step, we would suggest checking out the more complex chains in the [Demos section](/examples/demos)

Loading…
Cancel
Save