Skip to content

Commit e0959bf

Browse files
committed
refactor: increment version to 1.2.2, update build script, and enhance README with new usage examples
1 parent 590e541 commit e0959bf

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,18 @@ Requires Node.js ≥ 18 or a modern browser for WASM.
4141
## ⚡ Quick Start
4242

4343
```typescript
44-
import { initEmbedder, embed, search } from 'ai-embed-search';
44+
import {embed, search, createEmbedder, initEmbedder} from 'ai-embed-search';
4545

46-
await initEmbedder();
46+
const embedder = await createEmbedder();
47+
await initEmbedder({ embedder });
4748

4849
await embed([
4950
{ id: '1', text: 'iPhone 15 Pro Max', meta: { brand: 'Apple', type: 'phone' } },
5051
{ id: '2', text: 'Samsung Galaxy S24 Ultra', meta: { brand: 'Samsung', type: 'phone' } },
5152
{ id: '3', text: 'Apple MacBook Pro', meta: { brand: 'Apple', type: 'laptop' } }
5253
]);
5354

54-
const results = await search('apple phone', 2);
55+
const results = await search('apple phone', 2).exec();
5556
console.log(results);
5657
```
5758
Result:
@@ -64,9 +65,10 @@ Result:
6465

6566
### 🧠 1. Initialize the Embedding Model
6667
```typescript
67-
import { initEmbedder } from 'ai-embed-search';
68+
import { createEmbedder, initEmbedder } from 'ai-embed-search';
6869

69-
await initEmbedder();
70+
const embedder = await createEmbedder();
71+
await initEmbedder({ embedder });
7072
```
7173
Loads the MiniLM model via @xenova/transformers. Required once at startup.
7274

@@ -85,7 +87,7 @@ Embeds and stores vector representations of the given items.
8587
```typescript
8688
import { search } from 'ai-embed-search';
8789

88-
const results = await search('fast electric car', 3);
90+
const results = await search('fast electric car', 3).exec();
8991
```
9092
Returns:
9193
```typescript

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ai-embed-search",
3-
"version": "1.2.0",
3+
"version": "1.2.2",
44
"type": "module",
55
"description": "Smart. Simple. Local. AI-powered semantic search in TypeScript using transformer embeddings. No cloud, no API keys — 100% offline.",
66
"author": "Peter Sibirtsev <sibirtsev.peter@gmail.com>",
@@ -16,9 +16,9 @@
1616
}
1717
},
1818
"scripts": {
19-
"build": "tsup src/index.ts --dts",
19+
"build": "tsup",
20+
"dev": "tsup --watch",
2021
"test": "vitest",
21-
"dev": "tsup src/index.ts --watch",
2222
"dev:embed": "node --loader ts-node/esm examples/testEmbed.ts"
2323
},
2424
"repository": {

tsup.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// tsup.config.ts
2+
import { defineConfig } from 'tsup';
3+
4+
export default defineConfig({
5+
entry: ['src/index.ts'],
6+
outDir: 'dist',
7+
format: ['esm'],
8+
dts: true,
9+
clean: true,
10+
});

0 commit comments

Comments
 (0)