Overview
Streams an AI-generated answer to a natural language question, grounded in your project’s content. Uses SSE (Server-Sent Events) to deliver tokens incrementally. Returns source citations once the stream completes. For integration guidance, see Ask Content.Usage Example
Parameters
Callask with:
string
required
The natural language question.
("entity" | "comment" | "message")[]
Limit the content types searched for context.
string
Scope context lookup to a specific space.
string
Scope context lookup to a specific conversation.
number
Maximum number of source records to use as context.
string
Resolves the embedded author reputation on each source record into a
spaceReputation number. Accepts a space <uuid>, "none" (project-general bucket), or "context" (server-derived from the request context). Empty string, "general", and null are rejected. See Reputation.boolean
When
true, spaceReputation is the subtree sum (the space plus all its descendants). Only honored when spaceReputationId is an explicit <uuid>.Returns
string
The AI-generated answer. Grows token by token while
streaming is true.ContentSearchResult[]
Source records used as context. Populated after streaming ends. When
spaceReputationId is set, each record’s embedded author carries an added spaceReputation number. See Reputation.boolean
true while the SSE stream is open and tokens are arriving.boolean
true from ask() call until the first token arrives.string | null
Error message if the request failed.
(props) => void
Starts a new question. Aborts any in-flight stream first.
() => void
Aborts in-flight stream and clears all state.
In React Native, SSE streaming requires polyfills. Install
react-native-fetch-api, web-streams-polyfill, and react-native-polyfill-globals, then call polyfillGlobals() at app startup before using this hook.
