mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-09 11:25:21 +03:00
- 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.
3.7 KiB
3.7 KiB
In [3]:
from getpass import getpass
STOCHASTICAI_API_KEY = getpass()········
In [4]:
import os
os.environ["STOCHASTICAI_API_KEY"] = STOCHASTICAI_API_KEYIn [10]:
YOUR_API_URL = getpass()········
In [5]:
from langchain.llms import StochasticAI
from langchain import PromptTemplate, LLMChainIn [6]:
template = """Question: {question}
Answer: Let's think step by step."""
prompt = PromptTemplate(template=template, input_variables=["question"])In [11]:
llm = StochasticAI(api_url=YOUR_API_URL)In [12]:
llm_chain = LLMChain(prompt=prompt, llm=llm)In [13]:
question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"
llm_chain.run(question)Out [13]:
"\n\nStep 1: In 1999, the St. Louis Rams won the Super Bowl.\n\nStep 2: In 1999, Beiber was born.\n\nStep 3: The Rams were in Los Angeles at the time.\n\nStep 4: So they didn't play in the Super Bowl that year.\n"
In [ ]: