Query
Ask dynamic questions about the user’s history and context with query().
Use Query for questions that cannot or should not be anticipated in a fixed profile schema. It can draw on the user’s derived context and privacy-preserving representations to compute a structured answer.
Ask a contextual question#
As with profile(), these TypeScript examples use an authenticated server-side Rollup client bound to the consented application user.
const result = await rollup.query({ question: "What kinds of vacations does this user seem to prefer?" })
{ "answer": { "trip_styles": [ "city-heavy international travel", "food-focused travel", "short outdoor excursions" ] }, "confidence": 0.87, "evidence": { "supporting_moments": 46, "history_months": 32 } }
Use Query when the question changes#
- Give AI assistants and agents context for the current conversation.
- Answer dynamic recommendation questions.
- Adapt onboarding and interfaces to the user’s history.
- Support questions the developer did not predefine when integrating Rollup.
Dynamic work, structured output#
Query is question-specific and potentially model-assisted. It is conceptually more expensive than reading the maintained Profile, so use it when the question warrants new work. Model choice and the location of reasoning can evolve; Query does not promise that all reasoning runs on-device.
A Query answer includes confidence and aggregate supporting evidence. It does not include media downloads or local asset identifiers. Use search() on the device to retrieve relevant moments.