StringExtensionsToCorpusId Method

Converts a content name or path string into a standardized corpora content identifier.

Definition

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

Parameters

corporaName  String
The input corpora content name or path. If the string contains a forward slash ('/'), it must start with "corpora/" (case-insensitive). Otherwise, the method will prefix the provided name with "corpora/".

Return Value

String
A string formatted as a valid corpora content identifier. If the input string already starts with "corpora/" 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 "corpora/".

See Also