latestOpenAPI 3.1.02026-08-18112878.7 KB

0b8d2bc38f5d

Decisions

Interact (BETA) - natural language injection, queries and question responses

Given a body of text, the endpoint will return a question, result or an error.

question

If a questionResponse is received, the question prompt can be displayed in a UI or used to embed and search a vector store to solicit an answer. The data containing the answer can be resubmitted in a new interact request, ensuring the same session ID is used. Please note: when a questionResponse has been received, the session is locked to the current query in progress. Therefore, if any additional requests contain a new question asked to Rainbird, the new question will be ignored until a result is received.

result

If a resultResponse is received, this contains the answer to the user's original question and can be presented as required. Once a resultResponse is received, the session is unlocked and further queries can be made in that session.

error

If an error response is received, this may be due to an internal error, but it can also be caused by such things as not being able to detect the query, the question being asked in an unfamiliar way, or the knowledge map not being designed to answer it. A suggested error response is included that can be used in chat interfaces. Alternatively, the error code can be mapped to your own custom error messages.

post/nl/interact

Headers

Versionstring required

Version of the natural language API

Request body

sessionIDstring required

The session ID needed to access that specific session

userPromptstring required

The user's prompt for natural language processing

Response

Response to the user prompt

responseType'question' | 'result' | 'error' required

Indicates how the response should be handled.