diff --git a/api-spec/openapiSpecv3-2_0.json b/api-spec/openapiSpecv3-2_0.json index c416dd7f..c71741e7 100644 --- a/api-spec/openapiSpecv3-2_0.json +++ b/api-spec/openapiSpecv3-2_0.json @@ -393,6 +393,78 @@ } } }, + "/api/rest/2.0/ai/instructions/get": { + "post": { + "operationId": "getNLInstructions", + "description": "\nBeta Version: 10.13.0.cl or later\n\nThis API allows users to retrieve existing natural language (NL) instructions for a specific worksheet. These instructions guide the AI system in understanding data context and generating more accurate responses when processing natural language queries.\n\n#### Usage guidelines\n\nTo retrieve NL instructions for a worksheet, the request must include:\n- `worksheet_identifier`: The unique ID or name of the worksheet for which to retrieve NL instructions\n\nThe API returns a response object with:\n- `nl_instructions_info`: An array of instruction objects, each containing:\n - `instructions`: Array of text instructions for natural language processing\n - `scope`: The scope of the instruction (`WORKSHEET_USER` or `GLOBAL`)\n\n#### Instruction Scopes\n\n- **GLOBAL**: Instructions that apply globally across the system\n- **WORKSHEET_USER**: Instructions that apply only to the specific worksheet and user context\n\n#### Example Usage\n\n```graphql\nquery {\n getNLInstructions(worksheet_identifier: \"worksheet-123\") {\n nl_instructions_info {\n instructions\n scope\n }\n }\n}\n```\n\n#### Example Response\n\n```json\n{\n \"data\": {\n \"getNLInstructions\": {\n \"nl_instructions_info\": [\n {\n \"instructions\": [\n \"When analyzing sales data, always include year-over-year comparisons\",\n \"Use 'Revenue' instead of 'Sales' in all responses\"\n ],\n \"scope\": \"GLOBAL\"\n },\n {\n \"instructions\": [\n \"Always format currency values with appropriate symbols\"\n ],\n \"scope\": \"WORKSHEET_USER\"\n }\n ]\n }\n }\n}\n```\n\n> ###### Note:\n> * This endpoint is currently in Beta. Breaking changes may be introduced before the endpoint is made Generally Available.\n> * Available from version 10.13.0.cl and later.\n> * This endpoint requires Spotter — please contact ThoughtSpot Support to enable Spotter on your cluster.\n> * Use this API to view currently configured instructions before modifying them with `setNLInstructions`.\n\n\n\n\n#### Endpoint URL\n", + "tags": [ + "AI", + "10.13.0.cl" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "worksheet_identifier": { + "description": "Unique ID or name of the worksheet for which to retrieve NL instructions.", + "type": "string" + } + }, + "required": [ + "worksheet_identifier" + ] + } + } + }, + "required": true + }, + "parameters": [], + "responses": { + "200": { + "description": "Common successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetNLInstructionsResponse" + } + } + } + }, + "201": { + "description": "Common error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetNLInstructionsResponse" + } + } + } + }, + "400": { + "description": "Operation failed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Operation failed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, "/api/rest/2.0/ai/relevant-questions/": { "post": { "operationId": "getRelevantQuestions", @@ -861,6 +933,86 @@ } } }, + "/api/rest/2.0/ai/instructions/set": { + "post": { + "operationId": "setNLInstructions", + "description": "\nBeta Version: 10.13.0.cl or later\n\nThis API allows users to set natural language (NL) instructions for a specific worksheet to improve AI-generated answers and query processing. These instructions help guide the AI system to better understand the data context and provide more accurate responses.\n\n#### Usage guidelines\n\nTo set NL instructions for a worksheet, the request must include:\n- `worksheet_identifier`: The unique ID or name of the worksheet for which to set NL instructions\n- `nl_instructions_info`: An array of instruction objects, each containing:\n - `instructions`: Array of text instructions for natural language processing\n - `scope`: The scope of the instruction (`WORKSHEET_USER` or `GLOBAL`). Defaults to `GLOBAL`\n\nThe API returns a response object with:\n- `success`: Boolean indicating whether the operation was successful\n\n#### Instruction Scopes\n\n- **GLOBAL**: Instructions that apply globally across the system\n- **WORKSHEET_USER**: Instructions that apply only to the specific worksheet and user context\n\n#### Example Usage\n\n```graphql\nmutation {\n setNLInstructions(\n worksheet_identifier: \"worksheet-123\"\n nl_instructions_info: [\n {\n instructions: [\n \"When analyzing sales data, always include year-over-year comparisons\",\n \"Use 'Revenue' instead of 'Sales' in all responses\"\n ]\n scope: GLOBAL\n }\n ]\n ) {\n success\n }\n}\n```\n\n> ###### Note:\n> * This endpoint is currently in Beta. Breaking changes may be introduced before the endpoint is made Generally Available.\n> * Available from version 10.13.0.cl and later.\n> * This endpoint requires Spotter — please contact ThoughtSpot Support to enable Spotter on your cluster.\n> * Instructions help improve the accuracy and relevance of AI-generated responses for the specified worksheet.\n\n\n\n\n#### Endpoint URL\n", + "tags": [ + "AI", + "10.13.0.cl" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "worksheet_identifier": { + "description": "Unique ID or name of the worksheet for which to set NL instructions.", + "type": "string" + }, + "nl_instructions_info": { + "description": "List of NL instructions to set for the worksheet.", + "type": "array", + "items": { + "$ref": "#/components/schemas/NLInstructionsInfoInput" + } + } + }, + "required": [ + "worksheet_identifier", + "nl_instructions_info" + ] + } + } + }, + "required": true + }, + "parameters": [], + "responses": { + "200": { + "description": "Common successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetNLInstructionsResponse" + } + } + } + }, + "201": { + "description": "Common error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetNLInstructionsResponse" + } + } + } + }, + "400": { + "description": "Operation failed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Operation failed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, "/api/rest/2.0/ai/answer/create": { "post": { "operationId": "singleAnswer", @@ -19576,6 +19728,45 @@ } } }, + "GetNLInstructionsResponse": { + "type": "object", + "required": [ + "nl_instructions_info" + ], + "properties": { + "nl_instructions_info": { + "type": "array", + "items": { + "$ref": "#/components/schemas/NLInstructionsInfo" + }, + "description": "List of NL instructions with their scopes." + } + } + }, + "NLInstructionsInfo": { + "type": "object", + "required": [ + "instructions", + "scope" + ], + "properties": { + "instructions": { + "type": "array", + "items": { + "type": "string" + }, + "description": "User instructions for natural language processing." + }, + "scope": { + "type": "string", + "enum": [ + "WORKSHEET_USER", + "GLOBAL" + ], + "description": "Scope of the instruction." + } + } + }, "RiseGQLArgWrapper": { "type": "object", "required": [ @@ -23280,6 +23471,43 @@ } } }, + "NLInstructionsInfoInput": { + "type": "object", + "required": [ + "instructions" + ], + "properties": { + "instructions": { + "type": "array", + "items": { + "type": "string" + }, + "description": "User instructions for natural language processing." + }, + "scope": { + "type": "string", + "enum": [ + "WORKSHEET_USER", + "GLOBAL" + ], + "default": "GLOBAL", + "description": "Scope of the instruction (USER or GLOBAL). Defaults to GLOBAL.", + "nullable": true + } + } + }, + "SetNLInstructionsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean", + "description": "Success status of the operation." + } + } + }, "VariableUpdateAssignmentInput": { "type": "object", "required": [ @@ -23775,4 +24003,4 @@ } } ] -} \ No newline at end of file +}