structured-outputs 0.1.0-beta.4 → 0.1.0-beta.6

Sign up to get free protection for your applications and to get access to all the features.
package/esm/F.d.ts CHANGED
@@ -7,7 +7,8 @@ export type F = {
7
7
  /** The description of the function. */
8
8
  description: string;
9
9
  /** Parameters of the function in JSON Schema. */
10
- parameters: unknown;
10
+ parameters?: unknown;
11
11
  };
12
+ export declare function F(name: string, description: string): F;
12
13
  export declare function F<M extends Record<string, Ty>>(name: string, description: string, models: M, rootKey: ValidRootKey<M>): F;
13
14
  //# sourceMappingURL=F.d.ts.map
package/esm/F.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"F.d.ts","sourceRoot":"","sources":["../src/F.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,MAAM,MAAM,CAAC,GAAG;IACd,IAAI,EAAE,UAAU,CAAA;IAChB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,wBAAgB,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAC5C,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GACvB,CAAC,CAOH"}
1
+ {"version":3,"file":"F.d.ts","sourceRoot":"","sources":["../src/F.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,MAAM,MAAM,CAAC,GAAG;IACd,IAAI,EAAE,UAAU,CAAA;IAChB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,wBAAgB,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC,CAAA;AACvD,wBAAgB,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAC5C,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GACvB,CAAC,CAAA"}
package/esm/F.js CHANGED
@@ -4,7 +4,7 @@ export function F(name, description, models, rootKey) {
4
4
  type: "function",
5
5
  name,
6
6
  description,
7
- parameters: schema(models, rootKey),
7
+ parameters: models ? schema(models, rootKey) : undefined,
8
8
  };
9
9
  }
10
10
  //# sourceMappingURL=F.js.map
package/esm/F.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"F.js","sourceRoot":"","sources":["../src/F.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAYpC,MAAM,UAAU,CAAC,CACf,IAAY,EACZ,WAAmB,EACnB,MAAS,EACT,OAAwB;IAExB,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,IAAI;QACJ,WAAW;QACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;KACpC,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"F.js","sourceRoot":"","sources":["../src/F.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAmBpC,MAAM,UAAU,CAAC,CACf,IAAY,EACZ,WAAmB,EACnB,MAAU,EACV,OAAyB;IAEzB,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,IAAI;QACJ,WAAW;QACX,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,OAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;KAC1D,CAAA;AACH,CAAC"}
package/esm/mod.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- import type { ArrayTy } from "./array.js";
2
- import type { NumberTy } from "./number.js";
3
- import type { ObjectTy } from "./object.js";
4
- import type { StringTy } from "./string.js";
5
- export type RootTy = NumberTy | StringTy | ObjectTy | ArrayTy;
6
1
  export * from "./array.js";
7
2
  export * from "./common.js";
8
3
  export * from "./F.js";
package/esm/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;AAI7D,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
package/esm/mod.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAOA,+CAA+C;AAE/C,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "structured-outputs",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.6",
4
4
  "description": "Lightweight virtual types for OpenAI structured outputs.",
5
5
  "repository": "github:harrysolovay/structured-outputs.git",
6
6
  "license": "Apache-2.0",
package/src/F.ts CHANGED
@@ -9,19 +9,26 @@ export type F = {
9
9
  /** The description of the function. */
10
10
  description: string
11
11
  /** Parameters of the function in JSON Schema. */
12
- parameters: unknown
12
+ parameters?: unknown
13
13
  }
14
14
 
15
+ export function F(name: string, description: string): F
15
16
  export function F<M extends Record<string, Ty>>(
16
17
  name: string,
17
18
  description: string,
18
19
  models: M,
19
20
  rootKey: ValidRootKey<M>,
21
+ ): F
22
+ export function F<M extends Record<string, Ty>>(
23
+ name: string,
24
+ description: string,
25
+ models?: M,
26
+ rootKey?: ValidRootKey<M>,
20
27
  ): F {
21
28
  return {
22
29
  type: "function",
23
30
  name,
24
31
  description,
25
- parameters: schema(models, rootKey),
32
+ parameters: models ? schema(models, rootKey!) : undefined,
26
33
  }
27
34
  }
package/src/mod.ts CHANGED
@@ -1,10 +1,3 @@
1
- import type { ArrayTy } from "./array.js"
2
- import type { NumberTy } from "./number.js"
3
- import type { ObjectTy } from "./object.js"
4
- import type { StringTy } from "./string.js"
5
-
6
- export type RootTy = NumberTy | StringTy | ObjectTy | ArrayTy
7
-
8
1
  // moderate --exclude _base.ts code_critique.ts
9
2
 
10
3
  export * from "./array.js"