structured-outputs 0.1.0-beta.5 → 0.1.0-beta.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "structured-outputs",
3
- "version": "0.1.0-beta.5",
3
+ "version": "0.1.0-beta.7",
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
  }