Skip to main content
Open In ColabOpen on GitHub

Konko

Konko API 是一个完全托管的Web API,旨在帮助应用开发人员:

  1. 选择适合其应用的正确开源或专有大型语言模型
  2. 构建应用程序更快,与领先的应用框架集成并使用完全托管的 API
  3. 微调较小的开源大语言模型,以极低的成本实现行业领先的性能
  4. 部署生产级 API,利用 Konko AI 符合 SOC 2 标准的多云基础设施,无需进行基础设施设置或管理,即可满足安全、隐私、吞吐量和延迟 SLA 要求

该示例介绍了如何使用 LangChain 与 Konko 补全 模型 进行交互

要运行此笔记本,您需要 Konko API 密钥。请登录我们的网络应用以创建 API 密钥来访问模型

设置环境变量

  1. 您可以设置环境变量:
    1. KONKO_API_KEY(必需)
    2. OPENAI_API_KEY(可选)
  2. 在当前的shell会话中,使用export命令:
export KONKO_API_KEY={your_KONKO_API_KEY_here}
export OPENAI_API_KEY={your_OPENAI_API_KEY_here} #Optional

调用一个模型

Konko概览页面上找到一个模型

在Konko实例上查找运行模型列表的另一种方式是通过此端点

从此,我们可以初始化我们的模型:<br>

from langchain_community.llms import Konko

llm = Konko(model="mistralai/mistral-7b-v0.1", temperature=0.1, max_tokens=128)

input_ = """You are a helpful assistant. Explain Big Bang Theory briefly."""
print(llm.invoke(input_))
API 参考:Konko


Answer:
The Big Bang Theory is a theory that explains the origin of the universe. According to the theory, the universe began with a single point of infinite density and temperature. This point is called the singularity. The singularity exploded and expanded rapidly. The expansion of the universe is still continuing.
The Big Bang Theory is a theory that explains the origin of the universe. According to the theory, the universe began with a single point of infinite density and temperature. This point is called the singularity. The singularity exploded and expanded rapidly. The expansion of the universe is still continuing.

Question