Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
## Quickstart

```sh
npm install extractkit ai zod
npm install @ratchaw/extractkit ai zod
```

`ai` (Vercel AI SDK v7) and `zod` (v4) are peer dependencies. Bring any AI SDK provider — `@ai-sdk/anthropic`, `@ai-sdk/openai`, `@ai-sdk/google`, … — and pass its model to `extract`:

```ts
import { anthropic } from '@ai-sdk/anthropic';
import { extract } from 'extractkit';
import { extract } from '@ratchaw/extractkit';
import { readFile } from 'node:fs/promises';
import { z } from 'zod';

Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Live-provider path validated via the playground and the first Phase 2 eval run (

- [x] README final: pitch, benchmark table, demo GIF, quickstart
- [x] MIT license (repo root + shipped in the npm package)
- [ ] Publish `extractkit` to npm — package is publish-ready (tarball verified: dist + README + LICENSE, 13.5 kB); blocked on `npm login`, then `pnpm --filter extractkit publish` (human action)
- [ ] Publish `@ratchaw/extractkit` to npm — package is publish-ready (tarball verified: dist + README + LICENSE; scoped, `publishConfig.access: public`); blocked on `npm login`, then `pnpm --filter @ratchaw/extractkit publish` (human action)

## Non-goals for v1

Expand Down
2 changes: 1 addition & 1 deletion apps/playground/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ From the repo root (the core library must be built once so the server can import

```sh
pnpm install
pnpm --filter extractkit build
pnpm --filter @ratchaw/extractkit build
```

Set at least one provider key — copy `.env.example` to `.env` and fill one in, or export it:
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@ai-sdk/openai": "^4.0.11",
"@hono/node-server": "^2.0.8",
"ai": "^7.0.16",
"extractkit": "workspace:*",
"@ratchaw/extractkit": "workspace:*",
"hono": "^4.12.29",
"pdfjs-dist": "^6.1.200",
"react": "^19.2.7",
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/src/client/components/DocumentViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DragEvent } from 'react';
import { GlobalWorkerOptions, Util, getDocument } from 'pdfjs-dist';
import type { PDFDocumentLoadingTask, PDFPageProxy } from 'pdfjs-dist';
import workerSrc from 'pdfjs-dist/build/pdf.worker.min.mjs?url';
import type { BBox as BBoxRect } from 'extractkit';
import type { BBox as BBoxRect } from '@ratchaw/extractkit';
import type { FieldEntry } from '../lib/fields';
import { formatPath, formatValue } from '../lib/fields';
import { bboxToStyle } from '../lib/geometry';
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/src/client/components/ResultPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ApiError, SerializedResult } from '../../shared/api';
import type { Phase } from '../App';
import type { AnyField, FieldEntry } from '../lib/fields';
import { formatPath, formatValue, isField, leafLabel, pathKey } from '../lib/fields';
import type { FieldPath } from 'extractkit';
import type { FieldPath } from '@ratchaw/extractkit';

interface ResultPanelProps {
phase: Phase;
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/src/client/lib/fields.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ExtractedField, FieldPath } from 'extractkit';
import type { ExtractedField, FieldPath } from '@ratchaw/extractkit';

export type AnyField = ExtractedField<unknown>;

Expand Down
2 changes: 1 addition & 1 deletion apps/playground/src/client/lib/geometry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BBox } from 'extractkit';
import type { BBox } from '@ratchaw/extractkit';

export interface BoxStyle {
left: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/src/client/lib/snap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BBox } from 'extractkit';
import type { BBox } from '@ratchaw/extractkit';

/** A positioned text run from the PDF text layer, normalized 0–1, origin top-left. */
export interface TextSpan {
Expand Down
4 changes: 2 additions & 2 deletions apps/playground/src/server/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExtractKitError, MissingRequiredFieldsError, streamExtract } from 'extractkit';
import type { ExtractResult } from 'extractkit';
import { ExtractKitError, MissingRequiredFieldsError, streamExtract } from '@ratchaw/extractkit';
import type { ExtractResult } from '@ratchaw/extractkit';
import { Hono } from 'hono';
import { bodyLimit } from 'hono/body-limit';
import { streamSSE } from 'hono/streaming';
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/src/server/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { anthropic } from '@ai-sdk/anthropic';
import { google } from '@ai-sdk/google';
import { openai } from '@ai-sdk/openai';
import type { LanguageModel } from 'ai';
import type { Pricing } from 'extractkit';
import type { Pricing } from '@ratchaw/extractkit';
import type { ModelInfo } from '../shared/api';

/** A model the playground can run, plus how to build it and price it. */
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/src/shared/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ExtractedField, ExtractUsage, FieldPath } from 'extractkit';
import type { ExtractedField, ExtractUsage, FieldPath } from '@ratchaw/extractkit';

/** A single extracted leaf with its provenance, as sent over the wire. */
export type WireField = ExtractedField<unknown>;
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/test/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MockLanguageModelV4, simulateReadableStream } from 'ai/test';
import type { LanguageModel } from 'ai';
import type { Pricing } from 'extractkit';
import type { Pricing } from '@ratchaw/extractkit';
import type { PlaygroundModel } from '../src/server/models';

/** A 12-byte buffer with a valid PNG signature — enough for normalizeDocument. */
Expand Down
6 changes: 3 additions & 3 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Install

```sh
npm install extractkit ai zod
npm install @ratchaw/extractkit ai zod
```

`ai` (Vercel AI SDK v7) and `zod` (v4) are peer dependencies. Bring any AI SDK provider — e.g. `@ai-sdk/anthropic`, `@ai-sdk/openai`, or `@ai-sdk/google` — and pass its model to `extract`.
Expand All @@ -16,7 +16,7 @@ npm install extractkit ai zod

```ts
import { anthropic } from '@ai-sdk/anthropic';
import { extract } from 'extractkit';
import { extract } from '@ratchaw/extractkit';
import { readFile } from 'node:fs/promises';
import { z } from 'zod';

Expand Down Expand Up @@ -57,7 +57,7 @@ Every leaf of your schema comes back twice: the plain value in `data` (validated
## Streaming

```ts
import { streamExtract } from 'extractkit';
import { streamExtract } from '@ratchaw/extractkit';

const stream = streamExtract({ schema: invoice, document, model });

Expand Down
5 changes: 4 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"name": "extractkit",
"name": "@ratchaw/extractkit",
"publishConfig": {
"access": "public"
},
"version": "0.1.0",
"description": "Schema-first document extraction with per-field provenance: Zod schema + PDF/image in, validated JSON with page, bbox, and confidence out.",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/evals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@ai-sdk/google": "^4.0.12",
"@ai-sdk/openai": "^4.0.11",
"ai": "^7.0.16",
"extractkit": "workspace:*",
"@ratchaw/extractkit": "workspace:*",
"hyparquet": "^1.14.0",
"zod": "^4.4.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/evals/src/datasets/cord-source.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { asyncBufferFromFile, parquetMetadataAsync, parquetReadObjects } from 'hyparquet';
import { sniffMediaType } from 'extractkit';
import { sniffMediaType } from '@ratchaw/extractkit';
import { sha256Hex, type CordPin, type Manifest } from '../manifest.js';
import { cordToGroundTruth, type CordGroundTruth } from './cord.js';
import type { EvalDocument } from '../types.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/evals/src/datasets/cord.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BBox } from 'extractkit';
import type { BBox } from '@ratchaw/extractkit';
import { valuesMatch } from '../normalize.js';
import type { CompareKind, GroundTruthField, GroundTruthRegion } from '../types.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/evals/src/datasets/docile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BBox } from 'extractkit';
import type { BBox } from '@ratchaw/extractkit';
import { normalizeValue } from '../normalize.js';
import type { CompareKind, GroundTruthField, GroundTruthRegion } from '../types.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/evals/src/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BBox, ExtractedField } from 'extractkit';
import type { BBox, ExtractedField } from '@ratchaw/extractkit';
import { valuesMatch } from './normalize.js';
import type { DocResult, EvalDocument, FieldResult, GroundTruthField, ModelRun, SchemaId } from './types.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/evals/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { anthropic } from '@ai-sdk/anthropic';
import { google } from '@ai-sdk/google';
import { openai } from '@ai-sdk/openai';
import type { LanguageModel } from 'ai';
import type { Pricing } from 'extractkit';
import type { Pricing } from '@ratchaw/extractkit';
import type { EvalModel } from './types.js';

export type Provider = 'anthropic' | 'openai' | 'google';
Expand Down
4 changes: 2 additions & 2 deletions packages/evals/src/runner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extract, ExtractKitError, MissingRequiredFieldsError } from 'extractkit';
import type { ExtractUsage } from 'extractkit';
import { extract, ExtractKitError, MissingRequiredFieldsError } from '@ratchaw/extractkit';
import type { ExtractUsage } from '@ratchaw/extractkit';
import { scoreExtraction, scoreFailure } from './metrics.js';
import { schemas } from './schemas.js';
import type { DocResult, EvalDocument, EvalModel, ModelRun } from './types.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/evals/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BBox, Pricing, SupportedMediaType } from 'extractkit';
import type { BBox, Pricing, SupportedMediaType } from '@ratchaw/extractkit';
import type { LanguageModel } from 'ai';

export type DatasetId = 'cord' | 'docile';
Expand Down
2 changes: 1 addition & 1 deletion packages/evals/test/metrics.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ExtractedField } from 'extractkit';
import type { ExtractedField } from '@ratchaw/extractkit';
import { describe, expect, it } from 'vitest';
import { iou, scoreExtraction, scoreFailure, summarizeRun } from '../src/metrics.js';
import type { EvalDocument, GroundTruthField, ModelRun } from '../src/types.js';
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading