Skip to main content

Aleph Alpha

The Luminous series 是一系列大型语言模型。

本示例介绍如何使用 LangChain 与 Aleph Alpha 模型进行交互。

# 安装包
pip install aleph-alpha-client
# 创建一个新的令牌:https://docs.aleph-alpha.com/docs/account/#create-a-new-token

from getpass import getpass

ALEPH_ALPHA_API_KEY = getpass()
     ········
from langchain.llms import AlephAlpha
from langchain import PromptTemplate, LLMChain
template = """Q: {question}

A:"""

prompt = PromptTemplate(template=template, input_variables=["question"])
llm = AlephAlpha(
model="luminous-extended",
maximum_tokens=20,
stop_sequences=["Q:"],
aleph_alpha_api_key=ALEPH_ALPHA_API_KEY,
)
llm_chain = LLMChain(prompt=prompt, llm=llm)
question = "What is AI?"

llm_chain.run(question)
    '人工智能(AI)是通过机器,尤其是计算机系统模拟人类智能过程。\n'