@xsai/generate-object 0.0.18 → 0.0.20

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/dist/index.d.ts CHANGED
@@ -10,8 +10,7 @@ interface GenerateObjectResult<T extends Schema> extends Omit<GenerateTextResult
10
10
  object: Infer<T>;
11
11
  }
12
12
  /**
13
- * @experimental
14
- * WIP, test failed
13
+ * @experimental WIP
15
14
  * @remarks Ollama doesn't support this, see {@link https://github.com/ollama/ollama/issues/6473}
16
15
  */
17
16
  declare const generateObject: <T extends Schema>(options: GenerateObjectOptions<T>) => Promise<GenerateObjectResult<T>>;
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@ import { clean } from '@xsai/shared';
4
4
 
5
5
  const generateObject = async (options) => await generateText(clean({
6
6
  ...options,
7
- responseFormat: {
8
- jsonSchema: {
7
+ response_format: {
8
+ json_schema: {
9
9
  description: options.schemaDescription,
10
10
  name: options.schemaName ?? "json_schema",
11
11
  schema: await toJSONSchema(options.schema).then((json) => clean({
@@ -19,10 +19,11 @@ const generateObject = async (options) => await generateText(clean({
19
19
  schema: void 0,
20
20
  schemaDescription: void 0,
21
21
  schemaName: void 0
22
- })).then(({ finishReason, text, usage }) => ({
22
+ })).then(({ finishReason, steps, text, usage }) => ({
23
23
  finishReason,
24
24
  // TODO: import { validate } from '@typeschema/main'
25
25
  object: JSON.parse(text || "{}"),
26
+ steps,
26
27
  usage
27
28
  }));
28
29
 
package/package.json CHANGED
@@ -1,16 +1,23 @@
1
1
  {
2
2
  "name": "@xsai/generate-object",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "author": "Moeru AI",
6
6
  "license": "MIT",
7
7
  "homepage": "https://xsai.js.org",
8
+ "description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
9
+ "keywords": [
10
+ "xsai",
11
+ "openai",
12
+ "ai"
13
+ ],
8
14
  "repository": {
9
15
  "type": "git",
10
16
  "url": "git+https://github.com/moeru-ai/xsai.git",
11
17
  "directory": "packages/generate-object"
12
18
  },
13
19
  "bugs": "https://github.com/moeru-ai/xsai/issues",
20
+ "sideEffects": false,
14
21
  "main": "./dist/index.js",
15
22
  "types": "./dist/index.d.ts",
16
23
  "exports": {
@@ -29,10 +36,13 @@
29
36
  },
30
37
  "devDependencies": {
31
38
  "@gcornut/valibot-json-schema": "^0.42.0",
39
+ "@xsai/providers": "",
32
40
  "valibot": "^0.42.1"
33
41
  },
34
42
  "scripts": {
35
43
  "build": "pkgroll",
36
- "build:watch": "pkgroll --watch"
44
+ "build:watch": "pkgroll --watch",
45
+ "test": "vitest run",
46
+ "test:watch": "vitest"
37
47
  }
38
48
  }