from openviking_sdk import SyncHTTPClient
client = SyncHTTPClient(url="http://localhost:1933", api_key="<ARK_API_KEY>")
add_result = client.add_resource(
path="https://raw.githubusercontent.com/volcengine/OpenViking/refs/heads/main/README.md"
root_uri = add_result['root_uri']
ls_result = client.ls(root_uri)
print(f"Directory structure:\n{ls_result}\n")
glob_result = client.glob(pattern="**/*.md", uri=root_uri)
if glob_result['matches']:
content = client.read(glob_result['matches'][0])
print(f"Content preview: {content[:200]}...\n")
print("Wait for semantic processing...")
client.wait_processed(timeout=120)
abstract = client.abstract(root_uri)
overview = client.overview(root_uri)
print(f"Abstract:\n{abstract}\n\nOverview:\n{overview}\n")
results = client.find("what is openviking", target_uri=root_uri)
print("Search results:")
for r in results.get("resources", []):
print(f" {r['uri']} (score: {r['score']:.4f})")