Skip to main content
The .query() method empowers developers to ask questions and receive relevant answers through a user-friendly query API. Function signature is given below:

Parameters

string
required
Question to ask
string
The conversation ID to which the query belongs in case this is a chatbot scenario
Chunk[]
In case you want to pass along your own context information. Passing this parameter disables the default context generation.

Returns

string
Unique identifier for the query response in a conversation
Date
Unique identifier for the query response in a conversation
string
Unique identifier for the query response in a conversation
SourceDetail[]
The individual sources that were used to generate the answer
object
The number of tokens used to answer the query

Usage

If you want to get the answer to question and return both answer and citations, use the following code snippet:
Code Example