V4Json
Namespace: Vercel.AI.Gateway
public static class V4JsonSerializes call options and parses results in the Language Model V4 JSON shape the Gateway expects.
Inheritance: object
Methods
Section titled “Methods”CallOptions(LanguageModelCallOptions)
Section titled “CallOptions(LanguageModelCallOptions)”public static string CallOptions(LanguageModelCallOptions options)Serializes <code class=“paramref”>options</code> as a V4 call body.
Parameters
| Name | Type | Description |
|---|---|---|
options |
LanguageModelCallOptions |
Returns: string
ParseGenerate(JsonElement)
Section titled “ParseGenerate(JsonElement)”public static LanguageModelGenerateResult ParseGenerate(JsonElement root)Parses a V4 generate result.
Parameters
| Name | Type | Description |
|---|---|---|
root |
JsonElement |
Returns: LanguageModelGenerateResult
ParseStreamPart(string)
Section titled “ParseStreamPart(string)”public static LanguageModelStreamPart? ParseStreamPart(string json)Parses one SSE JSON object into a stream part.
Parameters
| Name | Type | Description |
|---|---|---|
json |
string |
Returns: LanguageModelStreamPart
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product