Office Documents Support
NeuroLink provides seamless Office document support as a multimodal input type - attach DOCX, PPTX, and XLSX documents directly to your AI prompts for document analysis, data extraction, and content processing.
Overview
Office document support in NeuroLink works as a native multimodal input - the system automatically processes Office files and passes them to the AI provider's document understanding capabilities. The system:
- Validates Office files using magic byte detection and format verification
- Checks provider compatibility (Bedrock, Vertex AI, Anthropic)
- Verifies file size limits per provider
- Passes documents directly to the provider's native document API
- Works with providers that support native Office document processing
Key Difference from PDF: Similar to PDF files, Office documents are sent as binary documents to providers with native document support. This enables analysis of formatted text, tables, charts, and embedded content within Office files.
Supported File Types
| Format | Extension | MIME Type | Description |
|---|---|---|---|
| Word Document | .docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | Microsoft Word documents with text, images, tables |
| PowerPoint | .pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation | Presentations with slides, charts, images |
| Excel Spreadsheet | .xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | Spreadsheets with data, formulas, charts |
Legacy Formats:
| Format | Extension | MIME Type | Support |
|---|---|---|---|
| Word (Legacy) | .doc | application/msword | Provider-dependent |
| Excel (Legacy) | .xls | application/vnd.ms-excel | Provider-dependent |
Quick Start
SDK Usage
import { NeuroLink } from "@juspay/neurolink";
const neurolink = new NeuroLink();
// Basic Word document analysis
const result = await neurolink.generate({
input: {
text: "Summarize the key points from this document",
officeFiles: ["report.docx"],
},
provider: "bedrock",
});
// PowerPoint presentation analysis
const presentation = await neurolink.generate({
input: {
text: "Extract the main topics from each slide in this presentation",
officeFiles: ["quarterly-review.pptx"],
},
provider: "bedrock",
});
// Excel spreadsheet analysis
const spreadsheet = await neurolink.generate({
input: {
text: "What are the top 5 products by revenue in this spreadsheet?",
officeFiles: ["sales-data.xlsx"],
},
provider: "bedrock",
});
// Multiple document comparison
const comparison = await neurolink.generate({
input: {
text: "Compare the revenue figures between Q1 and Q2 reports",
officeFiles: ["q1-report.docx", "q2-report.docx"],
},
provider: "bedrock",
});
// Auto-detect file types (mix Office, PDF, CSV, and images)
const multimodal = await neurolink.generate({
input: {
text: "Analyze all documents and provide a comprehensive summary",
files: ["report.docx", "data.xlsx", "chart.png", "notes.pdf"],
},
provider: "bedrock",
});
// Streaming with Office documents
const stream = await neurolink.stream({
input: {
text: "Provide a detailed analysis of this contract document",
officeFiles: ["contract.docx"],
},
provider: "bedrock",
});
for await (const chunk of stream) {
process.stdout.write(chunk.content);
}
CLI Usage
# Attach Office files to your prompt
neurolink generate "Summarize this document" --file report.docx --provider bedrock
# Multiple Office files
neurolink generate "Compare these reports" --file q1.docx --file q2.docx --provider bedrock
# Excel spreadsheet analysis
neurolink generate "Analyze sales trends" --file sales.xlsx --provider bedrock
# PowerPoint presentation
neurolink generate "Extract key points from slides" --file presentation.pptx --provider bedrock
# Auto-detect file types
neurolink generate "Analyze all documents" --file report.docx --file data.xlsx --provider bedrock
# Stream mode with Office documents
neurolink stream "Explain this document in detail" --file document.docx --provider bedrock
# Note: `batch` does NOT accept --file. The flag is deliberately unregistered
# there because it would collide with the prompts-file positional, so Office
# attachments are only available on `generate` and `stream`.
API Reference
GenerateOptions
type GenerateOptions = {
input: {
text: string;
images?: Array<Buffer | string>; // Image files
csvFiles?: Array<Buffer | string>; // CSV files (converted to text)
pdfFiles?: Array<Buffer | string>; // PDF files (native binary)
officeFiles?: Array<Buffer | string>; // Office files (native binary)
files?: Array<Buffer | string>; // Auto-detect file types
};
// Provider selection (REQUIRED for Office files)
provider: "bedrock" | "vertex" | "anthropic";
// Office processing options
officeOptions?: OfficeProcessorOptions;
// Standard options
model?: string;
maxTokens?: number;
temperature?: number;
// ... other options
};
StreamOptions
type StreamOptions = {
input: {
text: string;
officeFiles?: Array<Buffer | string>; // Same as GenerateOptions
files?: Array<Buffer | string>;
};
provider: "bedrock" | "vertex" | "anthropic";
// ... other options
};
OfficeProcessorOptions
type OfficeProcessorOptions = {
/**
* Provider to use for document processing
* @default "bedrock"
*/
provider?: string;
/**
* Maximum file size in MB
* @default 5 (provider-dependent)
*/
maxSizeMB?: number;
/**
* Whether to extract embedded images
* @default true
*/
extractImages?: boolean;
/**
* Whether to preserve document structure in output
* @default true
*/
preserveStructure?: boolean;
};
File Input Formats
// String path (relative or absolute)
officeFiles: ["./documents/report.docx"];
officeFiles: ["/absolute/path/to/data.xlsx"];
// Buffer (from fs.readFile or other source)
import { readFile } from "fs/promises";
const docxBuffer = await readFile("document.docx");
officeFiles: [docxBuffer];
// Mixed types
officeFiles: ["report.docx", docxBuffer, "./presentation.pptx"];
Provider Support
Supported Providers
| Provider | Max Size | DOCX | PPTX | XLSX | DOC | XLS | Notes |
|---|---|---|---|---|---|---|---|
| AWS Bedrock | 5 MB | ✅ | ✅ | ✅ | ✅ | ✅ | Full native support via Converse API |
| Google Vertex AI | 5 MB | ✅ | ⚠️ | ✅ | ⚠️ | ⚠️ | Best for DOCX and XLSX |
| Anthropic Claude | 5 MB | ✅ | ⚠️ | ✅ | ⚠️ | ⚠️ | Via document API |
Unsupported Providers
The following providers do not currently support native Office document processing:
- OpenAI (GPT-4o)
- Google AI Studio
- Azure OpenAI
- Ollama (local models)
- LiteLLM
- Mistral AI
- Hugging Face
Error Message for Unsupported Providers:
Office files are not currently supported with openai provider.
Supported providers: AWS Bedrock, Google Vertex AI, Anthropic
Current provider: openai
Options:
1. Switch to a supported provider (--provider bedrock or --provider vertex)
2. Convert your Office document to PDF first
3. Extract text content manually before processing