aboutsummaryrefslogtreecommitdiff
path: root/apps/docs/concepts/content-types.mdx
blob: 473fad676dff1fafbbe1f446f61ae171bff41a5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
---
title: "Supported Content Types"
sidebarTitle: "Content Types"
description: "All the content formats Supermemory can ingest and process"
icon: "file-stack"
---

Supermemory automatically extracts and indexes content from various formats. Just send it—we handle the rest. See [Add Memories](/add-memories) to learn how to ingest content via the API.

## Text Content

Raw text, conversations, notes, or any string content.

```typescript
await client.add({
  content: "User prefers dark mode and uses vim keybindings",
  containerTags: ["user_123"]
});
```

**Best for:** Chat messages, user preferences, notes, logs, transcripts.

---

## URLs & Web Pages

Send a URL and Supermemory fetches, extracts, and indexes the content.

```typescript
await client.add({
  content: "https://docs.example.com/api-reference",
  containerTags: ["documentation"]
});
```

**Extracts:** Article text, headings, metadata. Strips navigation, ads, boilerplate.

---

## Documents

### PDF

```typescript
await client.add({
  content: pdfBase64,
  contentType: "pdf",
  title: "Q4 Financial Report"
});
```

**Extracts:** Text, tables, headers. OCR for scanned documents.

### Microsoft Office

| Format | Extension | Content Type |
|--------|-----------|--------------|
| Word | `.docx` | `docx` |
| Excel | `.xlsx` | `xlsx` |
| PowerPoint | `.pptx` | `pptx` |

```typescript
await client.add({
  content: docxBase64,
  contentType: "docx",
  title: "Product Roadmap"
});
```

### Google Workspace

Automatically handled via [Google Drive connector](/connectors/google-drive):
- Google Docs
- Google Sheets
- Google Slides

---

## Code & Markdown

```typescript
// Markdown
await client.add({
  content: markdownContent,
  contentType: "md",
  title: "README.md"
});

// Code files (auto-detected language)
await client.add({
  content: codeContent,
  contentType: "code",
  metadata: { language: "typescript" }
});
```

**Extracts:** Structure, headings, code blocks with syntax awareness.

Code is chunked using [code-chunk](https://github.com/supermemoryai/code-chunk), which understands AST boundaries to keep functions, classes, and logical blocks intact. See [Super RAG](/concepts/super-rag) for how Supermemory optimizes chunking for each content type.

---

## Images

```typescript
await client.add({
  content: imageBase64,
  contentType: "image",
  title: "Architecture Diagram"
});
```

**Extracts:** OCR text, visual descriptions, diagram interpretations.

**Supported:** PNG, JPG, JPEG, WebP, GIF

---

## Audio & Video

```typescript
// Audio
await client.add({
  content: audioBase64,
  contentType: "audio",
  title: "Customer Call Recording"
});

// Video
await client.add({
  content: videoBase64,
  contentType: "video",
  title: "Product Demo"
});
```

**Extracts:** Transcription, speaker detection, topic segmentation.

**Supported:** MP3, WAV, M4A, MP4, WebM

---

## Structured Data

### JSON

```typescript
await client.add({
  content: JSON.stringify(userData),
  contentType: "json",
  title: "User Profile Data"
});
```

### CSV

```typescript
await client.add({
  content: csvContent,
  contentType: "csv",
  title: "Sales Data Q4"
});
```

---

## File Upload

For binary files, encode as base64:

```typescript
import { readFileSync } from 'fs';

const file = readFileSync('./document.pdf');
const base64 = file.toString('base64');

await client.add({
  content: base64,
  contentType: "pdf",
  title: "document.pdf"
});
```

---

## Auto-Detection

If you don't specify `contentType`, Supermemory auto-detects:

```typescript
// URL detected automatically
await client.add({ content: "https://example.com/page" });

// Plain text detected automatically
await client.add({ content: "User said they prefer email contact" });
```

<Note>
For binary content (files), always specify `contentType` for reliable processing.
</Note>

---

## Content Limits

| Type | Max Size |
|------|----------|
| Text | 1MB |
| Files | 50MB |
| URLs | Fetched content up to 10MB |

<Tip>
For large files, consider chunking or using [connectors](/connectors/overview) for automatic sync.
</Tip>

---

## Next Steps

<CardGroup cols={2}>
  <Card title="Add Memories" icon="plus" href="/add-memories">
    Upload content via the API
  </Card>
  <Card title="Super RAG" icon="bolt" href="/concepts/super-rag">
    How content is chunked and indexed
  </Card>
</CardGroup>