ResponseFormat - TypeScript SDK

ResponseFormat type definition

The TypeScript SDK and docs are currently in beta. Report issues on GitHub.

Response format configuration

Supported Types

models.ChatFormatGrammarConfig

1const value: models.ChatFormatGrammarConfig = {
2 grammar: "root ::= \"yes\" | \"no\"",
3 type: "grammar",
4};

models.FormatJsonObjectConfig

1const value: models.FormatJsonObjectConfig = {
2 type: "json_object",
3};

models.ChatFormatJsonSchemaConfig

1const value: models.ChatFormatJsonSchemaConfig = {
2 jsonSchema: {
3 name: "math_response",
4 },
5 type: "json_schema",
6};

models.ChatFormatPythonConfig

1const value: models.ChatFormatPythonConfig = {
2 type: "python",
3};

models.ChatFormatTextConfig

1const value: models.ChatFormatTextConfig = {
2 type: "text",
3};