Power Query Assistant
Power Query Assistant · GPT 작업
Azure Functions API for AInsights for Get Conversations from Cosmos DB
This API allows interaction with conversations stored in Azure Cosmos DB.
GET /chatRetrieve conversations from Cosmos DB.
원본 API 스키마
{
"openapi": "3.1.0",
"info": {
"title": "Azure Functions API for AInsights for Get Conversations from Cosmos DB",
"description": "This API allows interaction with conversations stored in Azure Cosmos DB.\n",
"version": "1.3.1"
},
"servers": [
{
"url": "https://ainsights.azurewebsites.net/api",
"description": "Main production server"
}
],
"paths": {
"/chat": {
"get": {
"operationId": "getConversations",
"summary": "Retrieve conversations from Cosmos DB.",
"parameters": [
{
"name": "conversation_id",
"in": "query",
"description": "Unique identifier for a specific conversation.",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "user_id",
"in": "query",
"description": "Identifier for a specific user.",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "search_string",
"in": "query",
"description": "String to search for in conversation title or content (case-insensitive). If '### Optimized Content' is provided in the search string, the query filters for documents where the type is 'message', the role is 'assistant', and the content contains '### Optimized Content'. You can also combine this with the role filter.\n",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "role",
"in": "query",
"description": "Role of the message sender (e.g., 'assistant', 'user'). If provided, the API will filter conversations where the message sender matches the specified role. This can be combined with the search_string filter.\n",
"required": false,
"schema": {
"type": "string",
"enum": [
"assistant",
"user"
]
}
},
{
"name": "start_date",
"in": "query",
"description": "Start date for filtering conversations (ISO 8601 format).",
"required": false,
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "end_date",
"in": "query",
"description": "End date for filtering conversations (ISO 8601 format).",
"required": false,
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "tags",
"in": "query",
"description": "Comma-separated list of tags to filter conversations.",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "conversation_type",
"in": "query",
"description": "Type of conversation to filter.",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "sort_by",
"in": "query",
"description": "Field to sort the results by (default: createdAt).",
"required": false,
"schema": {
"type": "string",
"default": "createdAt"
}
},
{
"name": "sort_order",
"in": "query",
"description": "Sort order for the results ('ASC' or 'DESC').",
"required": false,
"schema": {
"type": "string",
"enum": [
"ASC",
"DESC"
],
"default": "ASC"
}
},
{
"name": "page",
"in": "query",
"description": "Page number for pagination (default: 1).",
"required": false,
"schema": {
"type": "integer",
"default": 1,
"minimum": 1
}
},
{
"name": "page_size",
"in": "query",
"description": "Number of items per page (default: 10, max: 100).",
"required": false,
"schema": {
"type": "integer",
"default": 10,
"minimum": 1,
"maximum": 100
}
},
{
"name": "truncate_content",
"in": "query",
"description": "Flag to truncate content (true by default).",
"required": false,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Successfully retrieved the conversations.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"description": "Total number of conversations returned."
},
"page": {
"type": "integer",
"description": "Current page number."
},
"pageSize": {
"type": "integer",
"description": "Number of items per page."
},
"nextPage": {
"type": "integer",
"nullable": true,
"description": "Next page number, if applicable."
},
"prevPage": {
"type": "integer",
"nullable": true,
"description": "Previous page number, if applicable."
},
"conversations": {
"type": "array",
"description": "List of conversations matching the query.",
"items": {
"$ref": "#/components/schemas/Conversation"
}
}
}
}
}
}
},
"400": {
"description": "Validation error, such as invalid date format.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"errorCode": {
"type": "string",
"description": "Error code for easier debugging."
},
"message": {
"type": "string",
"description": "Detailed error message."
}
}
}
}
}
},
"500": {
"description": "Unexpected server error, including Cosmos DB issues.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"errorCode": {
"type": "string",
"description": "Error code for debugging."
},
"message": {
"type": "string",
"description": "Detailed error message."
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Conversation": {
"type": "object",
"description": "A conversation document.",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the conversation."
},
"type": {
"type": "string",
"description": "Type of the document (e.g., 'conversation' or 'message')."
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the conversation was created."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the conversation was last updated."
},
"userId": {
"type": "string",
"description": "Identifier for the user who initiated the conversation."
},
"title": {
"type": "string",
"description": "Title or subject of the conversation."
},
"content": {
"type": "string",
"description": "Content of the conversation, possibly truncated."
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of tags associated with the conversation."
},
"role": {
"type": "string",
"description": "Role of the message sender (e.g., 'user', 'assistant')."
},
"highlightedKeywords": {
"type": "array",
"items": {
"type": "string"
},
"description": "Keywords from the search_string found in the content."
}
}
}
}
},
"securitySchemes": {
"ApiKeyAuth": {
"type": "apiKey",
"in": "header",
"name": "x-functions-key"
}
},
"security": [
{
"ApiKeyAuth": []
}
]
}