Cogniswitch 查询引擎
CogniswitchQueryEngine¶
使用 CogniSwitch 构建生产就绪的应用程序,该应用程序可以完美地消费、组织和检索知识。使用您选择的框架,例如 LlamaIndex,CogniSwitch 有助于减轻在选择正确的存储和检索格式时的决策压力。它还消除了生成响应时的可靠性问题和幻觉。只需 3 个简单步骤,即可开始与您的知识互动!
访问 https://www.cogniswitch.ai/developer。
注册
- 使用您的电子邮件注册并验证您的注册
- 您将收到一封包含平台令牌和用于使用服务的 oauth 令牌的邮件。
上传知识
- 有两种方法可以将您的知识添加到 Cogniswitch。
- 您可以登录 Cogniswitch 网站并上传您的文档文件或从文档上传页面提交 URL。
- 您可以使用 llama-hub 工具中的 CogniswitchToolSpec 在 Cogniswitch 中添加文档或 URL。
CogniswitchQueryEngine
- 使用令牌和 API 密钥实例化 cogniswitchQueryEngine。
- 在查询引擎中使用 query_knowledge 函数并输入您的查询。
- 您将从您的知识中获得答案作为响应。
导入所需的库¶
In [ ]
已复制!
import warnings
warnings.filterwarnings("ignore")
from llama_index.core.query_engine import CogniswitchQueryEngine
import warnings warnings.filterwarnings("ignore") from llama_index.core.query_engine import CogniswitchQueryEngine
Cogniswitch 凭据和 OpenAI 令牌¶
In [ ]
已复制!
# cs_token = <your cogniswitch platform token>
# OAI_token = <your openai token>
# oauth_token = <your cogniswitch apikey>
# cs_token =# OAI_token =# oauth_token =
实例化查询引擎¶
In [ ]
已复制!
query_engine = CogniswitchQueryEngine(
cs_token=cs_token, OAI_token=OAI_token, apiKey=oauth_token
)
query_engine = CogniswitchQueryEngine( cs_token=cs_token, OAI_token=OAI_token, apiKey=oauth_token )
使用 query_engine 与您的知识聊天¶
In [ ]
已复制!
answer_response = query_engine.query_knowledge("tell me about cogniswitch")
print(answer_response)
answer_response = query_engine.query_knowledge("tell me about cogniswitch") print(answer_response)
CogniSwitch is a platform that offers a range of features to users. It helps users organize, explore, and manage data in an intuitive way. The platform visualizes complex ideas, simplifies them, and fine-tunes knowledge. Users can also consume knowledge on-demand through the CogniSwitch API. Furthermore, CogniSwitch provides data storage management capabilities.