Use this file to discover all available pages before exploring further.
What this builds. A single asyncio.run(main()) that creates a KB, ingests a file, queries it, lists attached integrations, and deletes it — all via await.
You’ll end up with. A round-trip through the most common KB surface using only async methods, suitable as a copy-paste starter for async pipelines.
"""Example 10: Async pairs — `aXxx` for every method.Every public KB method has an async sibling prefixed with `a`. Thisexample exercises the most common async surface: `KnowledgeBase.anew`,`aadd_files_and_wait`, `aquery`, `aintegrations`, `adelete`."""import asyncioimport tempfilefrom pathlib import Pathfrom vectorshift.knowledge_base import KnowledgeBase, QaConfig, QaModeasync def main() -> None: with tempfile.NamedTemporaryFile(mode="w", suffix=".md", delete=False) as f: f.write("# Async demo\n\nAsync file ingestion sample.") p = Path(f.name) kb = await KnowledgeBase.anew( name="SDK async demo", embedding_model="text-embedding-3-small", ) print(f"1. anew: id={kb.id}") final = await kb.aadd_files_and_wait([p], timeout=120) print(f"2. aadd_files_and_wait: status={final.status}") res = await kb.aquery( "What does the doc say?", top_k=3, qa=QaConfig(mode=QaMode.FAST, citations=True), ) print(f"3. aquery answer: {res.get('answer', '<none>')}") integrations = await kb.aintegrations() print(f"4. aintegrations: {len(integrations)} attached") await kb.adelete() p.unlink(missing_ok=True) print("5. adelete done.")if __name__ == "__main__": asyncio.run(main())