Class RequestExtensions
- Namespace
- GenerativeAI
- Assembly
- GenerativeAI.dll
A static class providing extension methods for formatting request contents used in generative AI models.
public static class RequestExtensions
- Inheritance
-
RequestExtensions
- Inherited Members
Methods
FormatGenerateContentInput(IEnumerable<Part>, string)
public static Content FormatGenerateContentInput(IEnumerable<Part> request, string role = "user")
Parameters
requestIEnumerable<Part>A collection of Part objects representing the content components.
rolestringThe role associated with the content. Defaults to "user".
Returns
FormatGenerateContentInput(IEnumerable<string>, string)
Creates a Content object using the specified parts of a request and role.
public static Content FormatGenerateContentInput(IEnumerable<string> request, string role = "user")
Parameters
requestIEnumerable<string>A collection of strings representing individual parts of the request.
rolestringThe role associated with the content. Defaults to "user".
Returns
FormatGenerateContentInput(string, string)
Creates a Content object based on the specified input text and role.
public static Content FormatGenerateContentInput(string @params, string role = "user")
Parameters
paramsstringThe input text to be formatted into the content object.
rolestringThe role associated with the content. Defaults to "user".
Returns
FormatSystemInstruction(string?)
Creates a Content object for system instructions based on the specified input string.
public static Content? FormatSystemInstruction(string? @params)
Parameters
paramsstringThe system instruction text to be formatted into the content object. If null or empty, returns null.