Dataherald
本笔记本介绍如何使用Dataherald组件。
首先,您需要设置您的Dataherald账户并获取您的API密钥:
- 前往dataherald并在这里注册
- 登录您的管理控制台后,创建一个API密钥
- pip install dataherald
然后我们需要设置一些环境变量:
- 将您的API密钥保存到DATAHERALD_API_KEY环境变量中
pip install dataherald
%pip install --upgrade --quiet langchain-community
import os
os.environ["DATAHERALD_API_KEY"] = ""
<!--IMPORTS:[{"imported": "DataheraldAPIWrapper", "source": "langchain_community.utilities.dataherald", "docs": "https://python.langchain.com/api_reference/community/utilities/langchain_community.utilities.dataherald.DataheraldAPIWrapper.html", "title": "Dataherald"}]-->
from langchain_community.utilities.dataherald import DataheraldAPIWrapper
dataherald = DataheraldAPIWrapper(db_connection_id="65fb766367dd22c99ce1a12d")
dataherald.run("How many employees are in the company?")
'select COUNT(*) from employees'