mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-09 03:15:19 +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.2 KiB
3.2 KiB
In [ ]:
# Install the package
!pip install aleph-alpha-clientIn [5]:
# create a new token: https://docs.aleph-alpha.com/docs/account/#create-a-new-token
from getpass import getpass
ALEPH_ALPHA_API_KEY = getpass()········
In [6]:
from langchain.llms import AlephAlpha
from langchain import PromptTemplate, LLMChainIn [7]:
template = """Q: {question}
A:"""
prompt = PromptTemplate(template=template, input_variables=["question"])In [8]:
llm = AlephAlpha(model="luminous-extended", maximum_tokens=20, stop_sequences=["Q:"], aleph_alpha_api_key=ALEPH_ALPHA_API_KEY)In [9]:
llm_chain = LLMChain(prompt=prompt, llm=llm)In [10]:
question = "What is AI?"
llm_chain.run(question)Out [10]:
' Artificial Intelligence (AI) is the simulation of human intelligence processes by machines, especially computer systems.\n'