get https://gw.ask-ai.co/external-search/generative-answers//stream
The generative answer process within the Ask-AI API is managed through a state machine mechanism that begins once a question is submitted via the External Ask endpoint and if expect_direct_answer
is True
.
This flow is done in an SSE stream, you can read more here: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
Flow Diagram
Steps
- After calling External Ask,
is_answerable
will beFalse
and thestatus
will be:PENDING
- Generative answer starts.
is_answerable
will beFalse
andstatus
will beRUNNING
- If the generative models successfully generate an answer:
is_answerable
will beTrue
and thestatus
will beRUNNING
and theanswer
will begin to be populated with generated content- Once the generative answer will be done, the
status
will beDONE
and theis_answerable
will betrue
- Else (generative answer model is not able to generate an answer):
- The
is_answerable
will beFalse
and thestatus
will be:DONE
- The
Understanding the States
PENDING
: The question is queued and awaiting processing.RUNNING
: Active processing is underway to generate an answer.DONE
: The process has concluded. Theis_answerable
flag indicates whether an answer was successfully generated.