JsonInstructions
Namespace: Vercel.AI.ProviderUtils
public static class JsonInstructionsAppends a JSON schema instruction to a prompt or to the first system message.
Inheritance: object
Methods
Section titled “Methods”Inject(string?, JsonNode?, string?, string?, bool, bool)
Section titled “Inject(string?, JsonNode?, string?, string?, bool, bool)”public static string Inject(string? prompt, JsonNode? schema, string? schemaPrefix = null, string? schemaSuffix = null, bool prefixSpecified = false, bool suffixSpecified = false)Joins an optional prompt with a JSON schema instruction.
Parameters
| Name | Type | Description |
|---|---|---|
prompt |
string | |
schema |
JsonNode | |
schemaPrefix |
string | |
schemaSuffix |
string | |
prefixSpecified |
bool | |
suffixSpecified |
bool |
Returns: string
InjectIntoMessages(IReadOnlyList<ModelMessage>, JsonNode?, string?, string?, bool, bool)
Section titled “InjectIntoMessages(IReadOnlyList<ModelMessage>, JsonNode?, string?, string?, bool, bool)”public static IReadOnlyList<ModelMessage> InjectIntoMessages(IReadOnlyList<ModelMessage> messages, JsonNode? schema = null, string? schemaPrefix = null, string? schemaSuffix = null, bool prefixSpecified = false, bool suffixSpecified = false)Writes the instruction into the first system message, or inserts one.
Parameters
| Name | Type | Description |
|---|---|---|
messages |
IReadOnlyList<ModelMessage> | |
schema |
JsonNode | |
schemaPrefix |
string | |
schemaSuffix |
string | |
prefixSpecified |
bool | |
suffixSpecified |
bool |
Returns: IReadOnlyList<ModelMessage>
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product