통합
LlamaIndex
Thunderbit를 LlamaIndex 파이프라인의 Reader 또는 Tool로 끼워 넣기
LlamaIndex 는 loader 대신 "Reader" 라는 이름을 쓰지만 패턴은 LangChain 과 동일합니다 —— Thunderbit 가 깔끔한 Markdown 을 만들고, LlamaIndex 가 청킹·인덱싱합니다.
설치
pip install llama-index-core httpxReader 로 사용
from llama_index.core import Document
import httpx
API = "https://openapi.thunderbit.com/openapi/v1"
H = {"Authorization": "Bearer YOUR_API_KEY"}
class ThunderbitReader:
def load_data(self, urls: list[str]) -> list[Document]:
job = httpx.post(f"{API}/batch/distill",
headers=H,
json={"urls": urls,
"include": ["metadata"]}).json()
# poll until COMPLETED — see Batch Job Lifecycle guide
return [
Document(text=r["markdown"],
metadata={"source": r["url"], **r.get("metadata", {})})
for r in job["data"]["results"] if r["status"] == "SUCCEEDED"
]
docs = ThunderbitReader().load_data(["https://docs.example.com"])평소처럼 VectorStoreIndex.from_documents(docs) 로 흘려보내세요.
에이전트 Tool 로 사용 (FunctionTool)
from llama_index.core.tools import FunctionTool
def read_url(url: str) -> str:
"""Fetch a URL and return clean Markdown."""
resp = httpx.post(f"{API}/distill",
headers=H,
json={"url": url, "renderMode": "basic"},
timeout=60.0)
resp.raise_for_status()
return resp.json()["data"]["markdown"]
read_tool = FunctionTool.from_defaults(fn=read_url)관련 문서
이 통합은 llama-index-readers-thunderbit 패키지로 확장 중입니다 —— 곧 다시 확인하세요.