@hypermode/models-as
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -118,2 +118,5 @@ import { Model } from "../.."; | ||
* | ||
* If set to `ResponseFormat.JsonSchema`, the response will be a JSON object | ||
* that conforms to the provided JSON schema. | ||
* | ||
* @default ResponseFormat.Text | ||
@@ -290,2 +293,4 @@ */ | ||
type JsonSchemaFunction = (jsonSchema: string) => ResponseFormat; | ||
/** | ||
@@ -302,2 +307,9 @@ * An object specifying the format that the model must output. | ||
/** | ||
* The JSON schema to use for the response format. | ||
*/ | ||
@omitnull() | ||
@alias("json_schema") | ||
readonly jsonSchema: JSON.Raw | null = null; | ||
/** | ||
* Instructs the model to output the response as a JSON object. | ||
@@ -314,2 +326,16 @@ * | ||
/** | ||
* Enables Structured Outputs which guarantees the model will match your supplied JSON schema. | ||
* | ||
* See https://platform.openai.com/docs/guides/structured-outputs | ||
*/ | ||
static JsonSchema: JsonSchemaFunction = ( | ||
jsonSchema: string, | ||
): ResponseFormat => { | ||
return { | ||
type: "json_schema", | ||
jsonSchema: jsonSchema, | ||
}; | ||
}; | ||
/** | ||
* Instructs the model to output the response as a plain text string. | ||
@@ -346,3 +372,3 @@ * | ||
*/ | ||
function: FunctionDefinition = new FunctionDefinition(); | ||
function!: FunctionDefinition; | ||
} | ||
@@ -369,2 +395,19 @@ | ||
/** | ||
* Whether to enable strict schema adherence when generating the function call. | ||
* If set to true, the model will follow the exact schema defined in the parameters field. | ||
* | ||
* See https://platform.openai.com/docs/guides/function-calling | ||
* | ||
* @remarks | ||
* In order to guarantee strict schema adherence, disable parallel function calls | ||
* by setting {@link OpenAIChatInput.parallelToolCalls}=false. | ||
* | ||
* See https://platform.openai.com/docs/guides/function-calling/parallel-function-calling-and-structured-outputs | ||
* | ||
* @default false | ||
*/ | ||
@omitif("this.strict == false") | ||
strict: bool = false; | ||
/** | ||
* The parameters the functions accepts, described as a JSON Schema object. | ||
@@ -375,3 +418,3 @@ * | ||
@omitnull() | ||
parameters: JSON.Raw | null = null; // TODO: verify this works | ||
parameters: JSON.Raw | null = null; | ||
} | ||
@@ -692,2 +735,7 @@ | ||
/** | ||
* The refusal message generated by the model. | ||
*/ | ||
refusal: string | null = null; | ||
/** | ||
* The tool calls generated by the model, such as function calls. | ||
@@ -694,0 +742,0 @@ */ |
{ | ||
"name": "@hypermode/models-as", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Hypermode Model Interface Library for AssemblyScript", | ||
@@ -9,22 +9,23 @@ "author": "Hypermode, Inc.", | ||
"scripts": { | ||
"pretest": "as-test build", | ||
"test": "as-test run", | ||
"test": "ast run", | ||
"pretest": "ast build && tsc -p ./tests", | ||
"lint": "eslint .", | ||
"pretty": "prettier --write .", | ||
"pretty:check": "prettier --check .", | ||
"lint": "eslint --ext .ts .", | ||
"lint:fix": "eslint --ext .ts --fix ." | ||
"pretty:check": "prettier --check ." | ||
}, | ||
"dependencies": { | ||
"json-as": "^0.9.20" | ||
"json-as": "^0.9.21" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.14.12", | ||
"@typescript-eslint/eslint-plugin": "^7.17.0", | ||
"@typescript-eslint/parser": "^7.17.0", | ||
"as-test": "^0.3.1", | ||
"@types/node": "^20.14.14", | ||
"@eslint/js": "^9.8.0", | ||
"@types/eslint__js": "^8.42.3", | ||
"@typescript-eslint/parser": "^8.0.1", | ||
"as-test": "^0.3.3", | ||
"assemblyscript": "^0.27.29", | ||
"assemblyscript-prettier": "^3.0.1", | ||
"eslint": "^8.57.0", | ||
"eslint": "^9.8.0", | ||
"prettier": "^3.3.3", | ||
"typescript": "^5.5.4", | ||
"typescript-eslint": "^8.0.1", | ||
"visitor-as": "^0.11.4" | ||
@@ -31,0 +32,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54945
13
1905
12
Updatedjson-as@^0.9.21