You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

function-json-schema

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

function-json-schema - npm Package Compare versions

Comparing version

to
1.0.3

15

package.json
{
"name": "function-json-schema",
"version": "1.0.1",
"version": "1.0.3",
"description": "Function json schema for function calling.",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"scripts": {

@@ -22,8 +23,8 @@ "build": "tsup",

"type": "git",
"url": "git+https://github.com/iudexai/fnjson-node-module.git"
"url": "git+https://github.com/iudexai/function-json-schema-node.git"
},
"bugs": {
"url": "https://github.com/iudexai/fnjson-node-module/issues"
"url": "https://github.com/iudexai/function-json-schema-node/issues"
},
"homepage": "https://github.com/iudexai/fnjson-node-module#readme",
"homepage": "https://github.com/iudexai/function-json-schema-node#readme",
"devDependencies": {

@@ -39,3 +40,3 @@ "@babel/preset-env": "^7.24.0",

"tsup": "^8.0.1",
"typescript": "^5.3.3"
"typescript": "5.4.3"
},

@@ -42,0 +43,0 @@ "dependencies": {

@@ -20,3 +20,3 @@ # Function JSON Schema

OpenAI slightly modified JSON schema because the original [JSON schema specification](https://json-schema.org/specification) does not include functions because functions are not serializable into JSON. Our function JSON schema codies roughly what OpenAI uses in their examples but includes additional restrictions and flexibility for better LLM results.
OpenAI slightly modified JSON schema because the original [JSON schema specification](https://json-schema.org/specification) does not include functions because functions are not serializable into JSON. Our function JSON schema copies roughly what OpenAI uses in their examples but includes additional restrictions and flexibility for better LLM results.

@@ -42,3 +42,3 @@ ```typescript

Keen eyes will notice the inclusion a few extra type changes:
Keen eyes will notice the inclusion of a few extra type changes:

@@ -53,4 +53,4 @@ - `description` is mandatory.

We encourage filling these out as best practice for your functions.
However, the loose type can still be extracted with the `coerceFunctionJsonSchema` validator.
We encourage filling these out as a best practice for your functions.
However, the loose type can still be extracted with the `coerceFunctionJsonSchema` validator to provide sane defaults.

@@ -159,2 +159,2 @@ Additionally, we have added some new types:

console.log('Loose parse result:', coercedJsonSchema.success);
```
```

@@ -148,2 +148,20 @@ import { z } from 'zod';

/**
* Simplified function json schema
*/
export const simpleFunctionJsonSchema = z.object({
name: z.string(),
description: z.string(),
parameters: z.object({
type: z.literal('object'),
properties: z.record(z.any()),
description: z.string().optional(),
required: z.array(z.string()).optional(),
}),
returns: z.object({
type: z.string(),
description: z.string().optional(),
}),
});
/**
* Set of schemas that coerce values into a valid json schema.

@@ -261,3 +279,2 @@ */

// Expect CoercedFunctionJson to fit into FunctionJson
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type Test1 = Expect<Extends<CoercedFunctionJson, FunctionJson>>;