Konko
Konko API is a fully managed Web API designed to help application developers:
- 选择 适合其应用的开源或专有LLM模型
- 构建 应用程序更快,集成了领先的应用框架和全托管的API
- 微调 更小的开源LLM,以极低的成本实现行业领先的性能
- 部署生产规模的API,满足安全性、隐私性、吞吐量和延迟的服务水平协议(SLA),无需基础设施设置或管理,使用Konko AI符合SOC 2标准的多云基础设施
此示例介绍了如何使用 LangChain 与 Konko 完成 模型 进行交互
要运行此笔记本,您需要Konko API密钥。登录我们的Web应用程序以创建API密钥来访问模型。
设置环境变量
- 你可以设置环境变量为
- KONKO_API_KEY(必需)
- OPENAI_API_KEY(可选)
- 在当前的 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