Tensorlake 是 AI 数据云,能够可靠地将非结构化数据源转换为 AI 应用程序可直接摄入的格式。
此 langchain-tensorlake 软件包在 Tensorlake 与 LangChain, 之间提供无缝集成,使您能够构建具有增强解析功能的复杂文档处理代理,例如签名检测。
Tensorlake 功能概述
Tensorlake 为您提供以下工具: - 提取:基于模式的结构化数据提取,从文档中提取特定字段。 - Parse: Convert documents to markdown to build RAG/Knowledge Graph systems. - 编排:构建可编程的工作流,用于大规模摄入和丰富文档、文本、音频、视频等数据。
了解更多,请访问 docs.tensorlake.ai
安装
pip install -U langchain-tensorlake
uv add langchain-tensorlake
示例
请参阅 完整教程 了解如何使用 langchain-tensorlake tool.
或查看此 Colab notebook 快速入门。
快速开始
1. 设置您的环境
您应通过设置以下环境变量来配置 Tensorlake 和 OpenAI 的凭据:
从 Tensorlake 云控制台获取您的 Tensorlake API 密钥。新用户可获得 100 免费积分。
2. 导入必要的包
from langchain_tensorlake import document_markdown_tool
from langchain.agents import create_agent
3. 构建签名检测代理
async def main(question):
# Create the agent with the Tensorlake tool
agent = create_agent(
model="gpt-5.4-mini",
tools=[document_markdown_tool],
prompt=(
"""
I have a document that needs to be parsed. \n\nPlease parse this document and answer the question about it.
"""
),
name="real-estate-agent",
)
# Run the agent
result = await agent.ainvoke({"messages": [{"role": "user", "content": question}]})
# Print the result
print(result["messages"][-1].content)
*Note:* 我们强烈推荐使用 openai 作为代理模型,以确保代理设置正确的解析参数
4. 示例用法
# Define the path to the document to be parsed
path = "path/to/your/document.pdf"
# Define the question to be asked and create the agent
question = f"What contextual information can you extract about the signatures in my document found at {path}?"
if __name__ == "__main__":
asyncio.run(main(question))
需要帮助?
通过以下方式联系我们 Slack 或 GitHub 上的包仓库 directly.