IdGenerator
Namespace: Vercel.AI.ProviderUtils
public static class IdGeneratorRandom id generator. The id is not cryptographically secure.
A prefix is joined with separator. The separator must not appear in the alphabet.
Inheritance: object
Fields
Section titled “Fields”DefaultAlphabet
Section titled “DefaultAlphabet”public const string DefaultAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"Default alphabet, letters and digits.
Value: string
Methods
Section titled “Methods”Create(string?, int, string?, string)
Section titled “Create(string?, int, string?, string)”public static Func<string> Create(string? prefix = null, int size = 16, string? alphabet = null, string separator = "-")Creates a generator. <code class=“paramref”>size</code> is the length of the random part.
Parameters
| Name | Type | Description |
|---|---|---|
prefix |
string | |
size |
int | |
alphabet |
string | |
separator |
string |
Returns: Func<string>
Generate()
Section titled “Generate()”public static string Generate()Generates a 16-character id from the default alphabet.
Returns: string
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product