跳到主要内容
Open In ColabOpen on GitHub

Konko

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

  1. 为他们的应用程序选择合适的开源或专有 LLM
  2. 通过与领先的应用程序框架集成和完全托管的 API,更快地构建应用程序
  3. 微调较小的开源 LLM,以一小部分成本实现行业领先的性能
  4. 部署生产规模的 API,这些 API 满足安全性、隐私性、吞吐量和延迟 SLA,而无需使用 Konko AI 的 SOC 2 合规、多云基础设施进行基础设施设置或管理

此示例介绍了如何使用 LangChain 与 Konko 完成 模型 交互

要运行此 notebook,您需要 Konko API 密钥。登录我们的 Web 应用程序以创建 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 实例上运行的模型列表的另一种方法是通过此 终端节点

从这里,我们可以初始化我们的模型

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

此页面是否对您有帮助?