@pairsystems/goodmem 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -0
- package/dist/index.d.ts +5434 -0
- package/dist/index.js +4358 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# GoodMem TypeScript SDK
|
|
2
|
+
|
|
3
|
+
Generated v2 TypeScript SDK for the GoodMem API.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { Goodmem } from "@pairsystems/goodmem";
|
|
7
|
+
|
|
8
|
+
const client = new Goodmem({
|
|
9
|
+
baseUrl: "http://localhost:8080",
|
|
10
|
+
apiKey: process.env.GOODMEM_API_KEY,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const embedder = await client.embedders.create(
|
|
14
|
+
{
|
|
15
|
+
displayName: "OpenAI Small",
|
|
16
|
+
modelIdentifier: "text-embedding-3-small",
|
|
17
|
+
},
|
|
18
|
+
{ apiKey: process.env.OPENAI_API_KEY },
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const spaces = await client.spaces.list();
|
|
22
|
+
|
|
23
|
+
await client.memories.create({
|
|
24
|
+
spaceId: "space-id",
|
|
25
|
+
originalContent: "hello", // contentType defaults to text/plain.
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
await client.memories.createFromFile({
|
|
29
|
+
spaceId: "space-id",
|
|
30
|
+
file: new Blob(["hello"], { type: "text/plain" }),
|
|
31
|
+
filename: "note.txt",
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
await client.memories.createFromBytes({
|
|
35
|
+
spaceId: "space-id",
|
|
36
|
+
bytes: new Uint8Array([1, 2, 3]),
|
|
37
|
+
contentType: "application/octet-stream",
|
|
38
|
+
filename: "payload.bin",
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
await client.memories.createFromPath({
|
|
42
|
+
spaceId: "space-id",
|
|
43
|
+
path: "./notes.txt", // contentType inferred as text/plain; explicit contentType overrides.
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const ocr = await client.ocr.documentFromFile({
|
|
47
|
+
file: new Blob([pdfBytes], { type: "application/pdf" }),
|
|
48
|
+
format: "PDF",
|
|
49
|
+
includeMarkdown: true,
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The provider, endpoint, dimensionality, distribution type, and supported modalities
|
|
54
|
+
for known embedders, LLMs, and rerankers are inferred from the bundled model
|
|
55
|
+
registry. Pass explicit fields to override registry defaults or to use a custom
|
|
56
|
+
model.
|
|
57
|
+
|
|
58
|
+
For file ingestion, `createFromFile` sends multipart form data and infers
|
|
59
|
+
`contentType` from `Blob.type`/`File.type` when available. `createFromBytes`
|
|
60
|
+
accepts `Uint8Array` or `ArrayBuffer` and requires an explicit `contentType`.
|
|
61
|
+
In Node.js, `createFromPath` uses `fs.openAsBlob` when available, falls back to
|
|
62
|
+
`fs.promises.readFile`, and infers `contentType` from common file extensions.
|
|
63
|
+
Unknown or extensionless paths default to `application/octet-stream`; pass
|
|
64
|
+
`contentType` explicitly to override inference.
|
|
65
|
+
|
|
66
|
+
JSON model fields that represent raw API `bytes`, such as
|
|
67
|
+
`Memory.originalContent`, are base64-encoded strings on the JSON wire.
|
|
68
|
+
|
|
69
|
+
For OCR, `documentFromFile`, `documentFromBytes`, and Node-only
|
|
70
|
+
`documentFromPath` base64-encode bytes into the existing JSON OCR endpoint; OCR
|
|
71
|
+
does not use multipart upload.
|
|
72
|
+
|
|
73
|
+
Runtime support: Node.js 20+ is supported. Browser and worker runtimes must
|
|
74
|
+
provide `fetch`, `Headers`, `Response`, `ReadableStream`, `Blob`, `FormData`, and
|
|
75
|
+
`TextEncoder`. `memories.createFromPath` and `ocr.documentFromPath` are Node-only
|
|
76
|
+
because they use `node:fs`.
|
|
77
|
+
|
|
78
|
+
This package is generated from `clients/v2/python/goodmem/api_ir.json`.
|
|
79
|
+
Do not edit generated files under `src/` manually; run `../clients_gen.sh`.
|