StringExtensionsToModelId Method

Converts a model name string into a standardized model identifier.

Definition

Namespace: GenerativeAI
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
public static string ToModelId(
	this string modelName
)

Parameters

modelName  String
The input model name. If the string contains a forward slash ('/'), it must start with "models/" (case-insensitive). Otherwise, the method will prefix the provided name with "models/".

Return Value

String
A string formatted as a valid model identifier. If the input string already starts with "models/" and contains a '/', it will be returned in lowercase.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentException Thrown if the input string contains a '/' but does not start with "models/".

See Also