Files
langchain/docs/modules/models/llms/integrations/aleph_alpha.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

3.2 KiB

Aleph Alpha

The Luminous series is a family of large language models.

This example goes over how to use LangChain to interact with Aleph Alpha models

In [ ]:
# Install the package
!pip install aleph-alpha-client
In [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, LLMChain
In [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'