extrait 0.1.0 → 0.1.1
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 +12 -2
- package/dist/format.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Structured JSON extraction from LLMs with validation, repair, and streaming.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p align="left">
|
|
6
|
+
<a href="https://www.npmjs.com/package/extrait">
|
|
7
|
+
<img src="https://img.shields.io/npm/v/extrait?logo=npm&style=plastic" alt="npm package">
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
**Features:**
|
|
6
12
|
- Multi-candidate JSON extraction from LLM responses
|
|
7
13
|
- Automatic repair with jsonrepair
|
|
8
14
|
- Zod schema validation and coercion
|
|
@@ -13,7 +19,11 @@ Features:
|
|
|
13
19
|
## Installation
|
|
14
20
|
|
|
15
21
|
```bash
|
|
16
|
-
bun
|
|
22
|
+
bun add extrait
|
|
23
|
+
# or
|
|
24
|
+
npm install extrait
|
|
25
|
+
# or
|
|
26
|
+
deno add npm:extrait
|
|
17
27
|
```
|
|
18
28
|
|
|
19
29
|
## Quick Start
|
package/dist/format.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { z } from "zod";
|
|
|
2
2
|
export interface WithFormatOptions {
|
|
3
3
|
schemaInstruction?: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const DEFAULT_SCHEMA_INSTRUCTION = "Strictly follow this schema:";
|
|
5
|
+
export declare const DEFAULT_SCHEMA_INSTRUCTION = "Strictly follow this JSON schema:";
|
|
6
6
|
export declare function withFormat(schema: z.ZodTypeAny, options?: WithFormatOptions): string;
|
|
7
7
|
export declare function formatPrompt(schema: z.ZodTypeAny, task: string, options?: WithFormatOptions): string;
|
|
8
8
|
export declare function resolveSchemaInstruction(instruction: string | undefined): string;
|
package/dist/index.cjs
CHANGED
|
@@ -976,7 +976,7 @@ function sanitizeDescription(value) {
|
|
|
976
976
|
}
|
|
977
977
|
|
|
978
978
|
// src/format.ts
|
|
979
|
-
var DEFAULT_SCHEMA_INSTRUCTION = "Strictly follow this schema:";
|
|
979
|
+
var DEFAULT_SCHEMA_INSTRUCTION = "Strictly follow this JSON schema:";
|
|
980
980
|
function withFormat(schema, options = {}) {
|
|
981
981
|
const schemaType = formatZodSchemaLikeTypeScript(schema);
|
|
982
982
|
const instruction = resolveSchemaInstruction(options.schemaInstruction);
|
package/dist/index.js
CHANGED
|
@@ -897,7 +897,7 @@ function sanitizeDescription(value) {
|
|
|
897
897
|
}
|
|
898
898
|
|
|
899
899
|
// src/format.ts
|
|
900
|
-
var DEFAULT_SCHEMA_INSTRUCTION = "Strictly follow this schema:";
|
|
900
|
+
var DEFAULT_SCHEMA_INSTRUCTION = "Strictly follow this JSON schema:";
|
|
901
901
|
function withFormat(schema, options = {}) {
|
|
902
902
|
const schemaType = formatZodSchemaLikeTypeScript(schema);
|
|
903
903
|
const instruction = resolveSchemaInstruction(options.schemaInstruction);
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extrait",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/tterrasson/extrait.git"
|
|
8
|
+
},
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/tterrasson/extrait/issues"
|
|
11
|
+
},
|
|
5
12
|
"main": "./dist/index.cjs",
|
|
6
13
|
"module": "./dist/index.js",
|
|
7
14
|
"types": "./dist/index.d.ts",
|