Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
使用 SoMark SDK 在 Python 或 JavaScript 项目里完成文档解析集成。
安装 SDK
pip install somark
npm install somark-js
初始化客户端
from somark import SoMark client = SoMark(api_key="sk-your-api-key")
import { SoMark } from 'somark-js' const client = new SoMark({ apiKey: 'sk-your-api-key' })
先完成一次同步解析
response = client.parser.parse( file="./document.pdf", formats=["md", "json"], ) response.save("./document.md")
const response = await client.parser.parse({ file: './document.pdf', formats: ['md', 'json'], }) await response.save('./document.md')
大文件改用异步任务
task = client.parser.parse_async(file="./large.pdf", formats=["md"]) result = task.wait() result.save("./large.md")
const task = await client.parser.parseAsync({ file: './large.pdf', formats: ['md'], }) const result = await task.wait() await result.save('./large.md')