Async pipeline (recommended)
UseAsyncConnectorClient when your RAG pipeline uses asyncio — LangChain, LlamaIndex,
FastAPI, or any framework where embedding and vector store calls are already async.
Background task inside FastAPI
Sync pipeline
If your pipeline is synchronous, useConnectorClient. The SSE reader and your callback
run on separate threads — blocking calls (embedding APIs, database writes) are safe.
Strategy: actions vs. summaries
Index actions
Upsert each
ActionsPayload as it arrives — granular, session-level embeddings.
Good for detailed retrieval (“what did this user click last session?”).Replace with summaries
When a
SummaryPayload arrives (payload.replaces actions), replace the raw
embeddings with a single prose embedding. Keeps your context window compact.