# Query content using AI assistant with vector store access Performs intelligent queries on content using OpenAI's assistant with vector store access. Query Process: 1. Agent Selection: Uses the specified agent's instructions as the system prompt, or defaults to research assistant instructions 2. Content Filtering: Uses the provided filters to select relevant content items from the dataspace 3. Vector Store Access: Retrieves the dataspace's vector store containing document embeddings 4. AI Assistant Creation: Creates a temporary OpenAI assistant with access to the vector store 5. Query Execution: Processes the user's query against the filtered content using the AI assistant 6. Citation Parsing: Extracts file IDs from the AI response citations 7. Content Retrieval: Fetches full content objects for all cited documents Agent System: - Optional Agent ID: Provide an agentId to use custom agent instructions as the system prompt - Default Behavior: Without an agent ID, uses built-in research assistant instructions - Agent Instructions: The agent's instructions field becomes the system prompt for the AI assistant - Research Agent: Look for an agent named "Research Assistant Agent" for the default research experience Request Body: - filters: Advanced filtering options to select specific content (uses unified ContentFiltersSchema) - query: The question or query to ask about the filtered content - agentId: (Optional) UUID of the agent whose instructions to use as system prompt Response Fields: - query: The original user query - response: AI assistant's response with citations in simplified format - analyzedDocumentCount: Number of documents that were analyzed and available for querying - citedContent: Array of full content objects that were actually cited in the AI response Citation Format: The AI response includes citations in simplified format: 【0】, 【1】, etc., where numbers reference the citedContent array indices. Performance Notes: - Creates and destroys a temporary OpenAI assistant for each query - Processes up to 9999 content items for analysis - Response time depends on query complexity and document count - Agent lookup adds minimal overhead when agent ID is provided Endpoint: POST /content/{dataspaceId}/query Version: 1.0.0 Security: bearerAuth ## Path parameters: - `dataspaceId` (string, required) Short dataspace ID with sds- prefix Example: "sds-abc12345" ## Request fields (application/json): - `query` (string, required) The question or query to ask about the filtered content Example: "What are the main themes discussed in these documents?" - `agentId` (string) Optional agent ID to use for the query. If provided, the agent's instructions will be used as the system prompt. Example: "01234567-89ab-cdef-0123-456789abcdef" - `context` (object) Optional context configuration for content sources and filters - `context.contentFilters` (object) Filters to apply when selecting content for querying - `context.contentFilters.contentId` (any) Filter by content ID - `context.contentFilters.categoryId` (any) Filter by category ID - `context.contentFilters.fileName` (any) Filter by file name - `context.contentFilters.fileFormat` (any) Filter by file format/MIME type - `context.contentFilters.createdAt` (any) Filter by creation date - `context.contentFilters.updatedAt` (any) Filter by last update date - `context.contentFilters.metadata` (object) Filter by metadata fields - key-value pairs where values can use advanced operators - `context.libraries` (array) Array of library IDs to include in search context Example: ["01234567-89ab-cdef-0123-456789abcdef"] - `context.includeWebSearchResults` (boolean) Whether to include web search results in addition to local document search. Default is false. ## Response 200 fields (application/json): - `query` (string, required) The original query that was asked Example: "What are the main themes discussed in these documents?" - `response` (string, required) The AI assistant's response to the query Example: "Based on the documents in your collection, the main themes include..." - `analyzedDocumentCount` (integer, required) Number of documents that were analyzed and available for querying Example: 15 - `citedContent` (array, required) Array of content items that were cited in the AI response, including citation numbers Example: [] - `citedContent.contentId` (string, required) Unique identifier for the content item Example: "123e4567-e89b-12d3-a456-426614174000" - `citedContent.dataspaceId` (string, required) Short dataspace ID with sds- prefix Example: "sds-abc12345" - `citedContent.fileName` (string, required) Name of the uploaded file Example: "document.pdf" - `citedContent.fileFormat` (string, required) MIME type of the file Example: "application/pdf" - `citedContent.createdAt` (string, required) ISO timestamp when the content was created Example: "2024-01-15T10:30:00Z" - `citedContent.updatedAt` (string, required) ISO timestamp when the content was last updated Example: "2024-01-15T14:30:00Z" - `citedContent.categoryId` (string,null) UUID of the category this content belongs to Example: "123e4567-e89b-12d3-a456-426614174001" - `citedContent.metadata` (object,null) Optional metadata for the content item Example: {"author":"John Doe","version":1,"published":true} - `citedContent.inferenceTaskExecutions` (object,null) Record of inference task executions that modified this content, mapping inference type to task execution ID Example: {"categoryId":"789e0123-e89b-12d3-a456-426614174002"} - `citedContent.versionString` (string,null) Version identifier based on category and unique metadata Example: "research_v2_final" - `citedContent.fileUrl` (string,null) Public URL to access the file Example: "https://api.example.com/files/sds-abc12345/content/123e4567-e89b-12d3-a456-426614174000/document.pdf" - `citedContent.fileSize` (integer,null) Size of the file in bytes Example: 2048576 - `citedContent.taskExecutionDetails` (object,null) Detailed information about task executions Example: {"categoryId":{"status":"completed","confidence":"high"}} - `citedContent.relatedVersions` (array,null) Related content items with the same version string Example: [] - `citedContent.citationNumber` (integer) Citation number used in the AI response (e.g., [1], [2], etc.) Example: 1 - `webSearchResults` (array, required) Array of web search results that were included in the AI response Example: [] - `webSearchResults.title` (string, required) Title of the web search result Example: "Sample Article Title" - `webSearchResults.url` (string, required) URL of the web search result Example: "https://example.com/article" - `webSearchResults.snippet` (string, required) Snippet/preview text from the web search result Example: "This article discusses..." - `webSearchResults.relevanceScore` (number, required) Relevance score from 0 to 1 Example: 0.85 - `webSearchResults.citationNumber` (integer) Citation number used in the AI response (e.g., [100], [101], etc.) Example: 100 - `citedLibraryPages` (array, required) Array of library pages that were cited in the AI response Example: [] - `citedLibraryPages.id` (string, required) Unique identifier for the source file Example: "01234567-89ab-cdef-0123-456789abcdef" - `citedLibraryPages.libraryId` (string, required) ID of the library this page belongs to Example: "01234567-89ab-cdef-0123-456789abcdef" - `citedLibraryPages.url` (string, required) URL of the original web page Example: "https://example.com/page" - `citedLibraryPages.title` (string) Title of the web page Example: "Example Page Title" - `citedLibraryPages.domain` (string) Domain of the web page Example: "example.com" - `citedLibraryPages.contentType` (string) Content type of the page Example: "text/html" - `citedLibraryPages.scrapedAt` (string) When the page was scraped Example: "2024-01-01T00:00:00Z" - `citedLibraryPages.relevanceScore` (number) Relevance score for this citation Example: 0.92 - `citedLibraryPages.citationNumber` (integer) Citation number used in the AI response Example: 2 ## Response 400 fields ## Response 404 fields ## Response 500 fields