Files
langchain/docs/modules/models/llms/integrations/writer.ipynb
T
leo-gan 5420a0e404 updated langchain/docs/modules/models/llms/integrations/ notebooks (#3041)
- Updated `langchain/docs/modules/models/llms/integrations/` notebooks:
added links to the original sites, the install information, etc.
- Added the `nlpcloud` notebook.
- Removed "Example" from Titles of some notebooks, so all notebook
titles are consistent.
2023-04-17 20:25:32 -07:00

2.9 KiB

Writer

Writer is a platform to generate different language content.

This example goes over how to use LangChain to interact with Writer models.

You have to get the WRITER_API_KEY here.

In [4]:
from getpass import getpass

WRITER_API_KEY = getpass()
 ········
In [5]:
import os

os.environ["WRITER_API_KEY"] = WRITER_API_KEY
In [6]:
from langchain.llms import Writer
from langchain import PromptTemplate, LLMChain
In [7]:
template = """Question: {question}

Answer: Let's think step by step."""

prompt = PromptTemplate(template=template, input_variables=["question"])
In [14]:
# If you get an error, probably, you need to set up the "base_url" parameter that can be taken from the error log.

llm = Writer()
In [15]:
llm_chain = LLMChain(prompt=prompt, llm=llm)
In [ ]:
question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"

llm_chain.run(question)
In [ ]: