Maira Settings and Conversation Summary
Settings
There are four endpoints for Maira settings
First, to create a new setting for Maira, you have to use POST /v1/gpt/settings
. Below is an example request body:
{
"bot_mode_strict": false,
"default_profile": "a0cc6beb-2909-459b-be55-62196af78ce4",
"default_vision_profile": "a0cc6beb-2909-459b-be55-62196af78ce4",
"summary_settings": {
"units": [
"user_id"
],
"interval": [
"daily"
],
"prompt": "define specific rules and instructions for the summary building",
"model": "gpt-3.5-turbo-0125",
"exclude_filters": {
"gpt_profile_id": [
"a0cc6beb-2909-459b-be55-62196af78ce4"
],
"conversation_metadata.project_id": [
"project_id"
]
}
},
"max_feedback_rating": 5
}
Let's go through the parameters:
- bot_mode_strict: Setting this parameter to
True
ensures your GPT responds only with your own data, when set toFalse
, it answers from its broader general knowledge. - default_profile: As we saw in the tutorial for Profile, you can create multiple profiles for your project. Then with every request, to
v1/gpt/ask
, aprofile_id
is passed. However if noprofile_id
is passed, a default profile will be used, which is defined here with theprofile_id
- default_vision_profile: Similar to above, this setting is for
/v1/gpt/ask/vision
- summary_settings: Here you can set how the summaries of your conversations will be generated. More about summaries are discussed in the following sections in this tutorial.
- units: Here you can set the unit of summary generation. In the example above, it is set to
user_id
. With this settings, you can get conversations summaries byuser_id
. Any key or field of a conversation can be used as an unit. Alsoconversation_metadata
can be used here for summary generation. Conversation details (and keys) can be acquired with the endpointGET /v1/gpt/conversations/{conversation_id}
. - interval: Summary generation intervals, current supported interval is
daily
. - prompt: GPT prompt to generate the summary.
- Example: "Create a summary of the following conversation in Japanese. The summary should be in a natural and direct tone, and should not include any names. The summary should be in plain text format, not JSON or any other format."
- model: Official name of the models to use to generate the summary, possible values are
gpt-3.5-turbo-0125
,gpt-3.5-turbo-0613
,gpt-3.5-turbo-instruct
,gpt-3.5-turbo-16k-0613
,gpt-3.5-turbo-1106
,gpt-4-0613
,gpt-4-1106-preview
,gpt-4-0125-preview
,gpt-4-turbo-2024-04-09
,gpt-4o-2024-05-13
,gpt-4-vision-preview
,gpt-4o-mini
,gpt-4o-mini-2024-07-18
,gpt-4o-2024-08-06
- exclude_filters: Here you can add any
conversation_metadata
or key from your dataset, to exclude them from the generated summary. - exclude_filters: It supports same key as
units
.exclude_filters
andunits
do not support filtering by dataset keys.
- units: Here you can set the unit of summary generation. In the example above, it is set to
max_feedback_rating: You can send feedback for conversations/responses via our endpoint /v1/gpt/conversations/
. This parameter decides what could be the highest rating. The minimum value is 1.
You can view, update, and delete your settings using the following endpoints:
GET /v1/gpt/settings
– Retrieve the current settings.PUT /v1/gpt/settings
– Modify the settings.DELETE /v1/gpt/settings
– Remove the settings.
Summary
Maira allows you to generate customized summary reports of "conversations" by dates.
There are two endpoints for managing summaries:
POST /v1/gpt/summaries/generate
- Generates a summary report for conversations on a specific date.POST /v1/gpt/summaries/list
- Retrieves a list of all previously generated summaries.
Summaries cannot be generated unless your project has set up summary_settings
as part of the GPT settings, which is discussed in the previous section of this tutorial.
Once the summary setting is there, summaries are generated automatically, daily as part of a batch process. This batch runs at 1 AM the following day. For example, conversations from July 1st will have their summary generated at 1 AM on July 2nd.
Note that every month's conversation summary will be saved as a Dataset. This dataset automatically goes into training data.
You can also use POST /v1/gpt/summaries/generate
to generate summary manually for a specific date. The request body only takes a date:
{
"date": "2024-04-09"
}
You can use this endpoint to generate summaries manually, for reasons such as:
- You want to generate summary for today, before the daily batch job
- There is a change in the past conversation history, and you want to regenerate the summary.
Note that this is a background job. This API response, you will give you a task_id
, which then can be used to check if the task was successful
/pending
/failed
using our endpoint GET /v1/tasks/{task_id}
.
Once the summary generation is done, you can usePOST /v1/gpt/summaries/list
to fetch the list of summaries.
Here is an example request body:
Example Value
Schema
{
"start_date": "2024-04-09",
"end_date": "2024-04-09",
"start": 0,
"size": 10,
"filters": {
"user_id": [
"user_1",
"user_2"
],
"project_id": [
"project_1",
"project_2"
]
}
}
Let's go through the parameters
- start_date: (Str) - Initial date of date range based on which you want to get summaries. Format: year-month-day, e.g. 2024-12-31
- end_date: (Str) - End date of date range based on which you want to get summaries. It is optional and by default it is today if not provided, Format: year-month-day, e.g. 2024-12-31
- start: (int) - Start index of summary documents, this is an optional value, default is 0
- size: (int) - Length of the returned list, this is an optional value, default is 10
- Filters: Here you can specify if you want to filter the summary in anyway. units in the settings.