Konko
Konko API is a fully managed Web API designed to help application developers (Konko API 是一個完全託管的 Web API,旨在幫助應用程式開發人員)
- Select the right open source or proprietary LLMs for their application (為其應用程式選擇合適的開源或專有 LLM)
- Build applications faster with integrations to leading application frameworks and fully managed APIs (透過與領先應用程式框架和完全託管的 API 整合,更快速地構建應用程式)
- Fine tune smaller open-source LLMs to achieve industry-leading performance at a fraction of the cost (微調較小的開源 LLM,以一小部分的成本實現業界領先的性能)
- Deploy production-scale APIs that meet security, privacy, throughput, and latency SLAs without infrastructure set-up or administration using Konko AI's SOC 2 compliant, multi-cloud infrastructure (部署生產規模的 API,這些 API 符合安全性、隱私性、吞吐量和延遲 SLA,而無需使用 Konko AI 的 SOC 2 合規、多雲基礎架構進行基礎架構設置或管理)
This example goes over how to use LangChain to interact with Konko
completion models (此範例介紹如何使用 LangChain 與 Konko
完成 模型互動)
To run this notebook, you'll need Konko API key. Sign in to our web app to create an API key to access models (要運行此筆記本,您需要 Konko API 密鑰。 登錄我們的 Web 應用程式以建立 API 密鑰來存取模型)
Set Environment Variables (設定環境變數)
- You can set environment variables for (您可以設定以下環境變數)
- KONKO_API_KEY (Required) (KONKO_API_KEY (必填))
- OPENAI_API_KEY (Optional) (OPENAI_API_KEY (可選))
- In your current shell session, use the export command (在您目前的 Shell 會話中,使用 export 命令)
export KONKO_API_KEY={your_KONKO_API_KEY_here}
export OPENAI_API_KEY={your_OPENAI_API_KEY_here} #Optional
Calling a model (呼叫模型)
Find a model on the Konko overview page (在 Konko 概述頁面上找到模型)
Another way to find the list of models running on the Konko instance is through this endpoint. (另一種查找在 Konko 實例上運行的模型列表的方法是通過此端點。)
From here, we can initialize our model (從這裡,我們可以初始化我們的模型)
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_))
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
Related (相關)
- LLM conceptual guide (LLM 概念指南)
- LLM how-to guides (LLM 操作指南)