名称: llmwhisperer
描述: 使用 LLMWhisperer API 从图像和 PDF 中提取文本与布局。擅长处理手写内容和复杂表格。
元数据: {"clawdbot":{"emoji":"📄","scripts":["scripts/llmwhisperer"]}}
使用 LLMWhisperer API 从图像和 PDF 中提取文本与布局,尤其适用于手写内容和复杂表格。
需要在 ~/.clawdbot/.env 文件中设置 LLMWHISPERER_API_KEY 环境变量:
echo "LLMWHISPERER_API_KEY=your_key_here" >> ~/.clawdbot/.env
访问 unstract.com/llmwhisperer 获取免费 API 密钥。
- 免费额度: 每天 100 页
llmwhisperer <文件路径>
可执行脚本位于 scripts/llmwhisperer。
#!/bin/bash
# 使用 LLMWhisperer API 提取文本
if [ -z "$LLMWHISPERER_API_KEY" ]; then
if [ -f ~/.clawdbot/.env ]; then
# shellcheck disable=SC2046
export $(grep -v '^#' ~/.clawdbot/.env | grep 'LLMWHISPERER_API_KEY' | xargs)
fi
fi
if [ -z "$LLMWHISPERER_API_KEY" ]; then
echo "错误:在环境变量或 ~/.clawdbot/.env 中未找到 LLMWHISPERER_API_KEY"
exit 1
fi
FILE="$1"
if [ -z "$FILE" ]; then
echo "用法:$0 <文件路径>"
exit 1
fi
curl -s -X POST "https://llmwhisperer-api.us-central.unstract.com/api/v2/whisper?mode=high_quality&output_mode=layout_preserving" \
-H "Content-Type: application/octet-stream" \
-H "unstract-key: $LLMWHISPERER_API_KEY" \
--data-binary "@$FILE"
将提取的文本输出到终端:
llmwhisperer flyer.jpg
将输出保存到文本文件:
llmwhisperer invoice.pdf > invoice.txt
处理手写笔记:
llmwhisperer notes.jpg