Alli Generative Answer API
The system has the ability to understand a question, and subsequently generate accurate and comprehensive responses by scanning through vast collections of source documents.
Last updated
The system has the ability to understand a question, and subsequently generate accurate and comprehensive responses by scanning through vast collections of source documents.
Last updated
Kindly be advised that the utilization of Alli generative answer is not universally accessible to all clients. Should you express interest in utilizing Alli generative answer, we recommend that you reach out to your designated account manager for further information and guidance.
Please provide your API key in the request header API-KEY
. Your REST API key can be found in your dashboard Settings menu, under the General tab.
You can add user information in the request header to specify who makes the call.
A user ID can be provided in the request header OWN-USER-ID
. The user ID can be either a new one or an existing one, and if a new user ID is provided, Alli will create a new user with that ID. Any future API calls with the same OWN-USER-ID
header will be considered as they're from the same user.
If you want to update the user's email address at the same time, you can provide the email address in the request header USER-EMAIL
. Below is an example.
You cannot use non-ASCII characters for OWN-USER-ID
. If the user ID includes any non-ASCII characters, you can encode the ID to base64 and use base64:CONVERTED_ID.
You can find saved user ID and email information in your Alli dashboard Customers menu.
Please read the error message you get if you don't get the response that you expected. For example, if you don't use the right HTTP method for the API, you'll get this type of error as response:
POST
https://backend.alli.ai/webapi/generative_answer
Generative Answer API finds an answer from your unstructured text documents, Q&A, and even from complex tables.
You will get the result as the following JSON format:
answer: It's the answer extracted from uploaded documents in the dashboard.answerHash: This is used to identify the answer to give or cancel feedback.
answerHash: This is used to identify the answer to give or cancel feedback.
confidence: It shows the confidence value from AI model. Shown as a number value between 0 and 1.
effectiveConfidence: When you provide feedback to the query result, it automatically trains the AI model. Effective confidence is the adjusted score with these users' and agents' feedback. Shown as a number value between 0 and 1.
documentId: The document's ID where the answer is extracted from.
documentName: The document's name where the answer is extracted from.hashtags: The hashtags attached to the document.
pageNo: The page number in the document where the answer was derived.
createdDate: The date when the document was uploaded.
agentFeedback: The feedback from agents (through dashboard and REST calls) about this document
userFeedback: The feedback from users about this document
body: If returnPreview is true in the request, the html body of the document search preview is displayed.
css: If returnPreview is true in the request, the css of the document search preview is displayed.
pdfPreview: If returnPdfPreview is true in the request, the URL to a PDF preview of the document with the answer highlighted is displayed. Note that the URL can be restricted using the Download IP Allowlist setting.
folder: If the answer is found from a folder under the Documents database, the folder name will be returned here.
editor: List of the agents' email who has the editor access to the documents (if they're set in the Alli dashboard).
viewer: List of the agents' email who has the viewer access to the documents. (if they're set in the Alli dashboard).
The number of search results and the threshold follows your dashboard setting. Please check your setting in Documents > Settings.
Please replace REST_API_KEY with your one in the example below. Please see getting-api-key section.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
API-KEY*
string
Your API key can be found in your dashboard Settings menu, under the General tab.
OWN-USER-ID (optional)
string
If you want to specify a user, you can provide the user's ID here. Existing User ID's can be found on the Conversations menu in your dashboard. If you use a User ID that does not exist, a new User will be created.
If OWN-USER-ID is not entered, the default User ID per project is used and the threadId
feature is disabled.
query*
string
This is a query string.
model
string
Utilize the LLM of your choice when generating answers. Default model is GPT 3.5 Turbo. Please see table below for available options.
answerFormat
string
Determine the format of the response given for easier integrations. Acceptable values are DRAFTJS
and MARKDOWN
. Default format is DRAFTJS
isStateful
boolean
To use follow-up question, previous conversation history is required. The conversation history is managed by threadId
. If you set isStateful
option to True and enter a threadId
, the query will be rewritten with reference to the previous conversation history Default = False
.
threadId
string (UUID)
threadId is used when isStateful = True
.
The first time you start a conversation, send it empty, and from the next query on, send it using the threadId from the output.
However, if you want to set the threadId from the beginning, write it as a UUID and send it.
Example UUID - 36e7bb2b-1063-47ec-
Default = None
promptGroupId
string
Select which group prompt from your project to use for generating responses. The ID is located within the URL when viewing the group prompt within the Settings page.
This is a very helpful option for a project with multiple different group prompts that are altered for specific tasks. The URL should look something like this and the ID is identified below:
https://app.alli.ai/projects/UHJvamVjdDo2NDljYTRjZDMzMGY2MDZkYWRjOPOjNjE=/settings/prompt-management/generative-answer/groups/TExNUHJvbXB0R3JvdXA6NjUzNzc3MzA5GHUyMGE2ZjlhM2Q5OTIw
mode
string
Whether to output data as stream or sync. Current available values: sync
OR stream
(default=sync
)
When in stream mode, .json strings with the same output format as sync are outputted as streaming.
clueText
boolean
Whether to include the text of the document used as a clue. Default = False
ONLY works if clues is enabled.
clues
boolean
Whether to include clues in the output that will be used to create a generative answer. Default = False
hashtags
json
Utilize this feature to scope the search via hashtags on documents or Q&A's. You can include or exclude certain hashtags as well as provide an option of and/or for the hashtags selected.
See example below:
{ "qnaInclude
" : ["hash name", "hash name2"], "qnaIncludeOption
" : "and"/"or", "qnaExclude
" : ["hash name", "hash name2"], "qnaExcludeOption
" : "and"/"or", "docsInclude
" : ["hash name", "hash name2"], "docsIncludeOption
" : "and"/"or", "docsExclude
" : ["hash name", "hash name2"], "docsExcludeOption
" : "and"/"or", }
search_from
json
Specifies the range of source data for Generative Answer to find data from. Currently available values are: web, qna, document, and enter data in the form of a list.
For example -> ["web", "qna"]