Skip to Content

Session

Create session

POST /v2/team/sessions

Create a session. A session is a continuous interaction process with MAXIR AI within a single dialogue. Each user can retain up to 150 sessions simultaneously. If you reach this limit and wish to create a new session, you can delete unused sessions before creating.

Body Request Parameters

{ "name": "My session", "output_language": "FR", "job_mode": "AUTO", "max_contextual_job_history": 10, "agent_id": "DATA_ANALYSIS_AGENT", "user_id": "tmm-dafasdfasdfasdf" }

Request Parameters

NameLocationTypeRequiredDescription
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supporting up to 128 characters. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.
bodybodyobjectNonone
» namebodystringYesSession name, supporting up to 128 characters. If it exceeds this limit, the name will be truncated.
» output_languagebodystringNoResponse language of MAXIR AI. For example, if set to EN, MAXIR AI replies in English. If not specified, it defaults to AUTO, where MAXIR AI chooses the appropriate language based on the prompt. Possible values include:
» job_modebodystringNoTask type. Possible values include:
» max_contextual_job_historybodyintegerNoNumber of historical tasks as context for the next task, ranging from 0 to 10, default is 10. If set to 0, the current task will not use any historical task as contextual information.
» agent_idbodystringNoAI agent ID. This parameter is reserved and should be set to DATA_ANALYSIS_AGENT.
» user_idbodystringYesUser ID, which is your unique identifier within the organization.

Detailed Explanation

» output_language: Response language of MAXIR AI. For example, if set to EN, MAXIR AI replies in English. If not specified, it defaults to AUTO. Possible values include:

  • AUTO: Automatically recognize based on prompts
  • EN: English
  • ES: Spanish
  • AR: Arabic
  • PT: Portuguese
  • ID: Indonesian
  • JA: Japanese
  • RU: Russian
  • HI: Hindi
  • FR: French
  • DE: German
  • VI: Vietnamese
  • TR: Turkish
  • PL: Polish
  • IT: Italian
  • KO: Korean
  • ZH-CN: Simplified Chinese
  • ZH-TW: Traditional Chinese

» job_mode: Task type. Possible values include:

  • AUTO: MAXIR AI determines whether the task is a data analysis or information retrieval task based on your inquiry.
  • DATA_ANALYTICS: MAXIR AI performs data analysis based on your input.

If unspecified, the default is AUTO. If you specifically want data analysis, we recommend setting the value to DATA_ANALYTICS to skip intent recognition and expedite processing.

Enumeration Values

AttributeValue
» output_languageAUTO
» output_languageEN
» output_languageES
» output_languageAR
» output_languagePT
» output_languageID
» output_languageJA
» output_languageRU
» output_languageHI
» output_languageFR
» output_languageDE
» output_languageVI
» output_languageTR
» output_languagePL
» output_languageIT
» output_languageKO
» output_languageZH-CN
» output_languageZH-TW
» job_modeAUTO
» job_modeDATA_ANALYTICS
» agent_idDATA_ANALYSIS_AGENT

Response Example

{ "code": 0, "data": { "id": "session-dasfasdgasdgfasdgasdg" } }

Response Results

Status CodeStatus MessageDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintsChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates success. Other values indicate failure. For error troubleshooting, refer to Error Codes.
» dataobjecttruenoneRetrieved data object.
»» idstringtruenoneSession ID.

To use the session for executing tasks, save this ID.

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.

List sessions

GET /v2/team/sessions

Return a list of sessions you have created.

Request Parameters

NameLocationTypeRequiredDescription
page_numberqueryintegerNoPage number to start pagination. If not specified, defaults to 1.
page_sizequeryintegerNoNumber of records per page. If not specified, defaults to 10.
searchquerystringNoSearch keyword, supporting up to 128 characters. All sessions with names containing this keyword will be returned.
user_idquerystringYesUser ID, which is your unique identifier within the organization.
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supporting up to 128 characters. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.

Detailed Explanation

search: Search keyword, supporting up to 128 characters. All sessions with names containing this keyword will be returned.

If omitted, all sessions will be listed.

Response Example

{ "code": 0, "data": { "total_items": 8, "page_size": 10, "page_number": 1, "records": [ { "id": "04b69928-532d-408a-8716-8f5e70fcacc6", "name": "Finding Your Inner Spark", "output_language": "AUTO", "job_mode": "AUTO", "max_contextual_job_history": 10, "agent_id": "DATA_ANALYSIS_AGENT" }, { "id": "7e9941af-ad1b-4834-a421-4b37b54aae19", "name": "session_trade_analyze_001", "output_language": "EN", "job_mode": "AUTO", "max_contextual_job_history": 1, "agent_id": "DATA_ANALYSIS_AGENT" }, { "id": "a137ecc8-9554-42c3-b042-2458dd2aeb36", "name": "My first session", "output_language": "AUTO", "job_mode": "AUTO", "max_contextual_job_history": 10, "agent_id": "DATA_ANALYSIS_AGENT" }, { "id": "4440ab38-3df0-465b-a66c-bf6acb0f1bc2", "name": "New name", "output_language": "EN", "job_mode": "AUTO", "max_contextual_job_history": 10, "agent_id": "DATA_ANALYSIS_AGENT" }, { "id": "3eb5e294-11eb-4bf0-8854-7177c415d15c", "name": "trade_analyze_001", "output_language": "ZH-CN", "job_mode": "AUTO", "max_contextual_job_history": 10, "agent_id": "DATA_ANALYSIS_AGENT" }, { "id": "ccca6d34-894f-4f6f-a8b5-c9df93126309", "name": "lhtest-old", "output_language": "ZH-CN", "job_mode": "AUTO", "max_contextual_job_history": 5, "agent_id": "DATA_ANALYSIS_AGENT" }, { "id": "c28a1f47-da68-4456-bb0b-e85bf5a0e98e", "name": "lhtest-newest", "output_language": "ZH-TW", "job_mode": "AUTO", "max_contextual_job_history": 6, "agent_id": "DATA_ANALYSIS_AGENT" }, { "id": "fbde9b45-69cd-408e-97d1-f874236aadac", "name": "General-session", "output_language": "ZH-CN", "job_mode": "AUTO", "max_contextual_job_history": 10, "agent_id": "DATA_ANALYSIS_AGENT" } ] } }

Response Results

Status CodeStatus MessageDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintsChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates success. Other values indicate failure. For error troubleshooting, refer to Error Codes.
» dataobjecttruenonePaginated list of sessions.
»» total_itemsintegertruenoneTotal number of returned sessions.
»» page_numberintegertruenonePage number of the current page.
»» page_sizeintegertruenoneNumber the sessions returned per page.
»» recordsobjecttruenoneList of sessions returned on the current page.
»»» idstringtruenoneSession ID, the unique identifier within the current project.
»»» namestringtruenoneSession name. If the name length exceeds 128 characters, only the first 128 characters will be returned.
»»» output_languagestringfalsenoneResponse language of MAXIR AI. Possible values include:

- AUTO: Automatically recognize based on prompts
- EN: English
- ES: Spanish
- AR: Arabic
- PT: Portuguese
- ID: Indonesian
- JA: Japanese
- RU: Russian
- HI: Hindi
- FR: French
- DE: German
- VI: Vietnamese
- TR: Turkish
- PL: Polish
- IT: Italian
- KO: Korean
- ZH-CN: Simplified Chinese
- ZH-TW: Traditional Chinese
»»» job_modestringfalsenoneTask type. Possible values include:

- AUTO: MAXIR AI determines whether the task is a data analysis or information retrieval task based on your inquiry.
- DATA_ANALYTICS: MAXIR AI performs data analysis based on your input.
»»» max_contextual_job_historyintegerfalsenoneThe number of tasks retained in the session as the next task’s context, ranging from 0 to 10, default 10. A value of 0 means the session’s tasks will not use previous tasks’ execution results as context information.
»»» agent_idstringfalsenoneAI agent ID. This parameter is reserved and has no actual significance—please ignore.

Enumeration Values

AttributeValue
output_languageAUTO
output_languageEN
output_languageES
output_languageAR
output_languagePT
output_languageID
output_languageJA
output_languageRU
output_languageHI
output_languageFR
output_languageDE
output_languageVI
output_languageTR
output_languagePL
output_languageIT
output_languageKO
output_languageZH-CN
output_languageZH-TW
job_modeAUTO
job_modeDATA_ANALYTICS
agent_idDATA_ANALYSIS_AGENT

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.

Modify session

POST /v2/team/sessions/{id}

Modify session configurations.

Body Request Parameters

{ "name": "hello", "output_language": "EN", "job_mode": "DATA_ANALYSIS", "max_contextual_job_history": 3, "user_id": "tmm-ddsdfsfgs" }

Request Parameters

NameLocationTypeRequiredDescription
idpathstringYesSession ID to be modified.
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supporting up to 128 characters. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.
bodybodyobjectNonone
» namebodystringYesSession name, supporting up to 128 characters. If it exceeds this limit, the name will be truncated.
» output_languagebodystringNoResponse language of MAXIR AI. For example, if set to EN, MAXIR AI replies in English. If not specified, it defaults to AUTO, where MAXIR AI chooses the appropriate language based on the prompt. Possible values include:
» job_modebodystringNoTask type. Possible values include:
» max_contextual_job_historybodyintegerNoNumber of historical tasks as context for the next task, ranging from 0 to 10, default is 10. If set to 0, the current task will not use any historical task as contextual information.
» user_idbodystringYesUser ID, which is your unique identifier within the organization.

Detailed Explanation

id: Session ID to be modified.

To view sessions in the project, call GET /v2/team/sessions.

» output_language: Response language of MAXIR AI. For example, if set to EN, MAXIR AI replies in English. If not specified, it defaults to AUTO. Possible values include:

  • AUTO: Automatically recognize based on prompts
  • EN: English
  • ES: Spanish
  • AR: Arabic
  • PT: Portuguese
  • ID: Indonesian
  • JA: Japanese
  • RU: Russian
  • HI: Hindi
  • FR: French
  • DE: German
  • VI: Vietnamese
  • TR: Turkish
  • PL: Polish
  • IT: Italian
  • KO: Korean
  • ZH-CN: Simplified Chinese
  • ZH-TW: Traditional Chinese

» job_mode: Task type. Possible values include:

  • AUTO: MAXIR AI determines whether the task is a data analysis or information retrieval task based on your inquiry.
  • DATA_ANALYTICS: MAXIR AI performs data analysis based on your input.

If unspecified, the default is AUTO. If you specifically want data analysis, we recommend setting the value to DATA_ANALYTICS to skip intent recognition and expedite processing.

Enumeration Values

AttributeValue
» output_languageAUTO
» output_languageEN
» output_languageES
» output_languageAR
» output_languagePT
» output_languageID
» output_languageJA
» output_languageRU
» output_languageHI
» output_languageFR
» output_languageDE
» output_languageVI
» output_languageTR
» output_languagePL
» output_languageIT
» output_languageKO
» output_languageZH-CN
» output_languageZH-TW
» job_modeAUTO
» job_modeDATA_ANALYTICS

Response Example

200 Response

{ "code": 0, "data": {} }

Response Results

Status CodeStatus MessageDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintsChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates success. Other values indicate failure. For error troubleshooting, refer to Error Codes.
» dataobjecttruenoneIf operation is successful, returns null.

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.

Delete session

DELETE /v2/team/sessions/{id}

Delete a session. Once deleted, the session and its task history will be permanently removed and cannot be recovered.

Body Request Parameters

{ "user_id": "tmm-dafasdfasdfasdf" }

Request Parameters

NameLocationTypeRequiredDescription
idpathstringYesSession ID to be deleted.
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supporting up to 128 characters. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.
bodybodyobjectNonone
» user_idbodystringYesUser ID, which is your unique identifier within the organization.

Detailed Explanation

id: Session ID to be deleted.

To view sessions in the project, call GET /v2/team/sessions.

Response Example

200 Response

{ "code": 0, "data": {} }

Response Results

Status CodeStatus MessageDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintsChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates success. Other values indicate failure. For error troubleshooting, refer to Error Codes.
» dataobjectfalsenoneIf operation is successful, returns null.

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.

Get session

GET /v2/team/sessions/{id}

Retrieve the configuration information of a specified session.

Request Parameters

NameLocationTypeRequiredDescription
idpathstringYesTarget session ID.
user_idquerystringYesUser ID, which is your unique identifier within the organization.
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supporting up to 128 characters. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.

Detailed Explanation

id: Target session ID.

To view sessions in the project, call GET /v2/team/sessions.

Response Example

{ "code": 0, "data": { "id": "cckrXXg68P8lmb59dg4yO", "name": "Analyze performance", "output_language": "HI", "job_mode": "AUTO", "max_contextual_job_history": 76, "agent_id": "DATA_ANALYSIS_AGENT" } }

Response Results

Status CodeStatus MessageDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintsChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates success. Other values indicate failure. For error troubleshooting, refer to Error Codes.
» dataobjecttruenoneSession object.
»» idstringtruenoneSession ID, the unique identifier within the current project.
»» namestringtruenoneSession name. If the name length exceeds 128 characters, only the first 128 characters will be returned.
»» output_languagestringfalsenoneResponse language of MAXIR AI. Possible values include:

- AUTO: Automatically recognize based on prompts
- EN: English
- ES: Spanish
- AR: Arabic
- PT: Portuguese
- ID: Indonesian
- JA: Japanese
- RU: Russian
- HI: Hindi
- FR: French
- DE: German
- VI: Vietnamese
- TR: Turkish
- PL: Polish
- IT: Italian
- KO: Korean
- ZH-CN: Simplified Chinese
- ZH-TW: Traditional Chinese
»» job_modestringfalsenoneTask type. Possible values include:

- AUTO: MAXIR AI determines whether the task is a data analysis or information retrieval task based on your inquiry.
- DATA_ANALYTICS: MAXIR AI performs data analysis based on your input.
»» max_contextual_job_historyintegerfalsenoneThe number of tasks retained in the session as the next task’s context, ranging from 0 to 10, default 10. A value of 0 means the session’s tasks will not use previous tasks’ execution results as context information.
»» agent_idstringfalsenoneAI agent ID. This parameter is reserved and has no actual significance—please ignore.

Enumeration Values

AttributeValue
output_languageAUTO
output_languageEN
output_languageES
output_languageAR
output_languagePT
output_languageID
output_languageJA
output_languageRU
output_languageHI
output_languageFR
output_languageDE
output_languageVI
output_languageTR
output_languagePL
output_languageIT
output_languageKO
output_languageZH-CN
output_languageZH-TW
job_modeAUTO
job_modeDATA_ANALYTICS
agent_idDATA_ANALYSIS_AGENT

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.

Get job history in session

GET /v2/team/sessions/{id}/history

Retrieve task records within a specified session.

Request Parameters

NameLocationTypeRequiredDescription
idpathstringYesTarget session ID.
page_numberqueryintegerNoPage number to start pagination. If not specified, defaults to 1.
page_sizequeryintegerNoNumber of records per page. If not specified, defaults to 10.
user_idquerystringYesUser ID, which is your unique identifier within the organization.
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supporting up to 128 characters. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.

Detailed Explanation

id: Target session ID.

To view sessions in the project, call GET /v2/team/sessions.

Response Example

{ "code": 0, "data": { "total_items": 1, "page_number": 1, "page_size": 10, "records": [ { "job_id": "job-1dsfasddfasgddsaffds", "question": { "blocks": [ { "type": "MESSAGE", "content": "Check for negative values across all sales columns" } ] }, "answer": { "blocks": [ { "type": "MESSAGE", "content": "- Check for negative values across all sales columns.\n- Filter the DataFrame to retain only rows with no negative sales values.", "group_id": "ba582fc9-bb36-4c5d-a8e8-d35bda6389cd", "group_name": "Identify the channels with negative sales values by examining each day's sales data. Filter out the rows where any sales value is negative.", "stage": "Analyze" }, { "type": "CODE", "content": "```python\n\nimport pandas as pd\n\ndef invoke(input_0: pd.DataFrame) -> pd.DataFrame:\n '''\n input_0: pd.DataFrame SalesByChannelByDay_Summary_Demo.Sheet1_0_table_1.csv\n '''\n # Identify columns that represent sales data (all except the first column)\n sales_columns = input_0.columns[1:]\n \n # Filter rows where any sales value is negative\n filtered_df = input_0[~(input_0[sales_columns] < 0).any(axis=1)]\n \n # Assign the result to the output variable\n output = filtered_df\n \n return output\n\n```", "group_id": "ba582fc9-bb36-4c5d-a8e8-d35bda6389cd", "group_name": "Identify the channels with negative sales values by examining each day's sales data. Filter out the rows where any sales value is negative.", "stage": "Analyze" }, { "type": "TABLE", "content": "https://s3.amazonaws.com/xxxtest/tmp_datasource_cache/code_result/clvl4cad2001q01l1m522hxlu/baf7d6d1-fb81-4fdb-bcdd-32923d214c7b.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20241018T104617Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20241018%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9bcb5af552793f162e35f41d62fb9306cf90888924bfbdce81ea687265fddf83", "group_id": "ba582fc9-bb36-4c5d-a8e8-d35bda6389cd", "group_name": "Identify the channels with negative sales values by examining each day's sales data. Filter out the rows where any sales value is negative.", "stage": "Analyze" }, { "type": "MESSAGE", "content": "- Sum the sales across all days for each channel.\n- Create a new DataFrame with the channel names and their corresponding total sales.", "group_id": "47183fd1-307b-4408-9986-e9238d952ec1", "group_name": "Calculate the overall sales trend for the identified channels with negative sales values. This involves summing up the sales across all days for each channel and analyzing the trend.", "stage": "Analyze" }, { "type": "CODE", "content": "```python\n\nimport pandas as pd\n\ndef invoke(negative_sales_channels: pd.DataFrame) -> pd.DataFrame:\n '''\n negative_sales_channels: pd.DataFrame negative_sales_channels.csv\n '''\n # Sum the sales across all days for each channel\n total_sales = negative_sales_channels.iloc[:, 1:].sum(axis=1)\n \n # Create a new DataFrame with the channel names and their corresponding total sales\n output = pd.DataFrame({\n 'Channel': negative_sales_channels.iloc[:, 0],\n 'Total Sales': total_sales\n })\n \n return output\n\n```", "group_id": "47183fd1-307b-4408-9986-e9238d952ec1", "group_name": "Calculate the overall sales trend for the identified channels with negative sales values. This involves summing up the sales across all days for each channel and analyzing the trend.", "stage": "Analyze" }, { "type": "TABLE", "content": "https://s3.amazonaws.com/xxxtest/tmp_datasource_cache/code_result/clvl4cad2001q01l1m522hxlu/10cffac2-8bf3-45f4-86e6-1ed8457329f2.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20241018T104617Z&X-Amz-SignedHeaders=host&X-Amz-Expires=600&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20241018%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=c6f5b522d2ddceea730304b86a45d5f5165f05f9fda3c1d275d11e9022c1e7ac", "group_id": "47183fd1-307b-4408-9986-e9238d952ec1", "group_name": "Calculate the overall sales trend for the identified channels with negative sales values. This involves summing up the sales across all days for each channel and analyzing the trend.", "stage": "Analyze" }, { "type": "MESSAGE", "content": "- Replace any negative sales values with zero in the data.\n- Sum the sales across all days for each channel.\n- Create a new data structure with the summed sales values.", "group_id": "6b93c2b1-8908-4c2b-afb2-2a81f2d24739", "group_name": "Calculate the overall sales trend for the same channels but excluding the negative sales values. This involves setting negative values to zero or removing them and then summing up the sales across all days for each channel.", "stage": "Analyze" }, { "type": "CODE", "content": "```python\n\nimport pandas as pd\n\ndef invoke(negative_sales_channels: pd.DataFrame) -> pd.DataFrame:\n '''\n negative_sales_channels: pd.DataFrame negative_sales_channels.csv\n '''\n # Replace negative values with zero\n negative_sales_channels.iloc[:, 1:] = negative_sales_channels.iloc[:, 1:].clip(lower=0)\n \n # Sum the sales across all days for each channel\n sales_sum = negative_sales_channels.iloc[:, 1:].sum(axis=1)\n \n # Create a new DataFrame with the summed sales values\n output = pd.DataFrame({\n 'Channel': negative_sales_channels.iloc[:, 0],\n 'Total Sales': sales_sum\n })\n \n return output\n\n```", "group_id": "6b93c2b1-8908-4c2b-afb2-2a81f2d24739", "group_name": "Calculate the overall sales trend for the same channels but excluding the negative sales values. This involves setting negative values to zero or removing them and then summing up the sales across all days for each channel.", "stage": "Analyze" }, { "type": "TABLE", "content": "https://s3.amazonaws.com/xxxtest/tmp_datasource_cache/code_result/clvl4cad2001q01l1m522hxlu/f4c99616-dd7c-48b1-8a35-d3141d732c36.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20241018T104617Z&X-Amz-SignedHeaders=host&X-Amz-Expires=600&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20241018%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=d21a8d939ab09547bc201754ba253ca6c0d1da5361752f2228237e3ff59be256", "group_id": "6b93c2b1-8908-4c2b-afb2-2a81f2d24739", "group_name": "Calculate the overall sales trend for the same channels but excluding the negative sales values. This involves setting negative values to zero or removing them and then summing up the sales across all days for each channel.", "stage": "Analyze" }, { "type": "MESSAGE", "content": "- Merge the two datasets on the 'Channel' column to align sales data for comparison.\n- Calculate the difference in 'Total Sales' between the datasets for each channel.\n- Store the results, including channel name and calculated difference, in a new dataset.", "group_id": "3488f538-f7fc-4c0e-a265-b66e3a38d41e", "group_name": "Compare the sales trends with and without negative sales values to determine the impact of negative sales on the overall sales trend for the affected channels.", "stage": "Analyze" }, { "type": "CODE", "content": "```python\n\nimport pandas as pd\n\ndef invoke(sales_trend_with_negatives: pd.DataFrame, sales_trend_without_negatives: pd.DataFrame) -> pd.DataFrame:\n # Merge the two DataFrames on the 'Channel' column\n merged_df = pd.merge(sales_trend_with_negatives, sales_trend_without_negatives, on='Channel', suffixes=('_with_negatives', '_without_negatives'))\n \n # Calculate the difference in 'Total Sales' between the two DataFrames\n merged_df['Sales Difference'] = merged_df['Total Sales_without_negatives'] - merged_df['Total Sales_with_negatives']\n \n # Create a new DataFrame to store the results\n output = merged_df[['Channel', 'Sales Difference']]\n \n return output\n\n```", "group_id": "3488f538-f7fc-4c0e-a265-b66e3a38d41e", "group_name": "Compare the sales trends with and without negative sales values to determine the impact of negative sales on the overall sales trend for the affected channels.", "stage": "Analyze" }, { "type": "TABLE", "content": "https://s3.amazonaws.com/xxxtest/tmp_datasource_cache/code_result/clvl4cad2001q01l1m522hxlu/aaf4f2f7-e2db-4f2e-98ae-0bdd18f42333.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20241018T104617Z&X-Amz-SignedHeaders=host&X-Amz-Expires=600&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20241018%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=19fcfe97c70bf40292b920ecbf0299c101e1de11e49b54fb8f62934b6e874f52", "group_id": "3488f538-f7fc-4c0e-a265-b66e3a38d41e", "group_name": "Compare the sales trends with and without negative sales values to determine the impact of negative sales on the overall sales trend for the affected channels.", "stage": "Analyze" }, { "type": "MESSAGE", "content": "\n\n`Analyzing Conclusions` \n\n### The impact of negative sales values on overall sales trends\n\n#### Sales variance analysis\n\n", "group_id": "fd1a62e6-48cf-4ac1-8bac-025665444710", "group_name": "Conclusions", "stage": "Respond" }, { "type": "TABLE", "content": "https://s3.amazonaws.com/xxxtest/tmp_datasource_cache/code_result/clvl4cad2001q01l1m522hxlu/aaf4f2f7-e2db-4f2e-98ae-0bdd18f42333.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20241018T104617Z&X-Amz-SignedHeaders=host&X-Amz-Expires=600&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20241018%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=19fcfe97c70bf40292b920ecbf0299c101e1de11e49b54fb8f62934b6e874f52", "group_id": "fd1a62e6-48cf-4ac1-8bac-025665444710", "group_name": "Conclusions", "stage": "Respond" }, { "type": "MESSAGE", "content": "\n\n- **Sales variance**:In all channels (including EC, JD, Tmall, WeChat, retail, corporate stores, outlets, and total), the sales difference is 0.0. This indicates that regardless of the presence of negative sales values, the sales trend has not changed.\n\n#### Conclusion and Insights\n- **The impact of negative sales values**:Based on the provided data, negative sales values have no impact on the overall sales trend of the affected channels, as the sales variance for all channels is 0.0.\n- **Data consistency**:The sales discrepancies across all channels are consistent, indicating that there are no anomalies or deviations caused by negative sales values during data processing or analysis.", "group_id": "fd1a62e6-48cf-4ac1-8bac-025665444710", "group_name": "Conclusions", "stage": "Respond" }, { "type": "SOURCES", "content": [ { "source": "SalesByChannelByDay_Summary_Demo.xlsx", "datasource_id": "cm2ej4wmo000001fcdkwbdrml", "dataset_id": "cm2ej4vx900hp01l1o378zr9o", "file_type": "xlsx", "external_id": "" } ], "group_id": "", "group_name": "", "stage": "Respond" }, { "type": "QUESTIONS", "content": [ "Analyze the specific channels with negative sales values on different dates and discuss whether the sales strategies of these channels might lead to negative values.", "Study the long-term impact of negative sales values on overall sales trends and assess whether adjustments to data analysis methods are needed to more accurately reflect the actual situation.", "Investigate the source of negative sales values, whether they are related to returns, discounts, or other factors, and propose possible solutions to reduce the occurrence of negative values." ], "group_id": "-1", "stage": "Respond" } ] } } ] } }

Response Results

Status CodeStatus MessageDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintsChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates success. Other values indicate failure. For error troubleshooting, refer to Error Codes.
» dataobjecttruenonePaginated list of returned task records.
»» total_itemsintegertruenoneTotal number of returned task records.
»» page_numberintegertruenonePage number of the current page.
»» page_sizeintegertruenoneNumber of records returned per page.
»» recordsobjecttruenoneList of task records returned on the current page.
»»» questionobjecttruenoneYour question (i.e., prompt).
»»»» blocksobjecttruenoneList of content blocks that make up the entire question.
»»»»» typestringtruenoneThe content type of the question block. Possible values are:
- MESSAGE: The content is a piece of text.
- CODE: The content a code snippet in Markdown format.
»»»»» contentstringtruenoneThe block content. It is a piece of text when the type is MESSAGE, and a code snippet when the type is CODE.
»»» answerobjecttruenoneMAXIR AI’s answer.
»»»» blocksobjecttruenoneMAXIR AI’s answer.
»»»»» typestringtruenoneThe content type of the answer block. Possible values are:

- MESSAGE: Denotes message content.
- CODE: Denotes code snippet content.
- TABLE: Denotes table content.
- IMAGE: Denotes image content.
- SOURCE: Denotes content as a reference source for answer blocks.
- QUESTIONS: Represents MAXIR AI-generated suggested questions to guide your further data exploration and analysis.
»»»»» contentstringtruenoneThe content of the answer block, varying with type value:

- When type is MESSAGE, the content is a piece of text.
- When type is CODE, the content is a code snippet in Markdown format.
- When type is TABLE, the content represents a table, including the following parameters:
- name: The name of the .csv file.
- url: The S3 Key or URL of the file.
- expires_at: Expiration time of the url. To save the table for later use, ensure it is downloaded before the URL expires.
- When type is IMAGE, the content represents an image, including the following parameters:
- name: The name of the image.
- url: The S3 Key or URL of the image.
- expires_at: Expiration time of the url. To save the image for later use, ensure it is downloaded before the URL expires.
- When type is SOURCE, the content represents reference sources of the answer block, including the following parameters:
- source: The file name of the datasource.
- datasource_id: Datasource ID.
- dataset_id: Dataset ID.
- file_type: The file extension of the datasource.
- When type is QUESTIONS, the content is the MAXIR AI-generated suggested questions to guide your further data exploration and analysis.
»»»»» group_idstringtruenoneGroup ID to which the answer block belongs.
»»»»» group_namestringtruenoneGroup name to which the answer block belongs.
»»»»» stagestringtruenoneThe process of generating answers by MAXIR AI is divided into two stages: Analyze and Respond.

- Answer blocks in the Analyze stage are not part of the final answer and are output during the analysis process to help you understand how the answer was generated.
- Answer blocks in the Respond stage are the final reply generated by MAXIR AI based on your question.
»»» job_idstringtruenoneTask ID, the unique identifier within the current session.

Enumeration Values

AttributeValue
typeMESSAGE
typeCODE
typeMESSAGE
typeCODE
typeTABLE
typeSOURCES
typeQUESTIONS
stageAnalyze
stageRespond

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. If an error occurs, provide this ID to the MAXIR AI team for troubleshooting.