Class GenerateContentRequestExtensions
- Namespace
- GenerativeAI
- Assembly
- GenerativeAI.dll
Provides extension methods for enhancing the functionality of the GenerateContentRequest class.
public static class GenerateContentRequestExtensions
- Inheritance
-
GenerateContentRequestExtensions
- Inherited Members
Methods
AddTool(GenerateContentRequest, Tool, ToolConfig?)
Adds a Tool to the GenerateContentRequest with an optional ToolConfig.
public static void AddTool(this GenerateContentRequest request, Tool tool, ToolConfig? config = null)
Parameters
requestGenerateContentRequestThe GenerateContentRequest instance to which the Tool will be added.
toolToolThe Tool to add.
configToolConfigOptional ToolConfig for configuring the Tool.
UseEnumMode<T>(GenerateContentRequest, JsonSerializerOptions?)
Configures the GenerateContentRequest to use JSON mode for responses of the specified type T.
public static void UseEnumMode<T>(this GenerateContentRequest request, JsonSerializerOptions? options = null) where T : Enum
Parameters
requestGenerateContentRequestThe GenerateContentRequest on which JSON mode will be applied.
optionsJsonSerializerOptionsOptional JsonSerializerOptions for customizing the serialization process.
Type Parameters
TThe type that defines the response schema for the JSON. Must be a class.
Remarks
For NativeAOT/Trimming JsonSerializerOptions are required, you can ignore it if you have already specified a resolver in
UseJsonMode<T>(GenerateContentRequest, JsonSerializerOptions?)
Configures the GenerateContentRequest to use JSON mode for responses of the specified type T.
public static void UseJsonMode<T>(this GenerateContentRequest request, JsonSerializerOptions? options = null) where T : class
Parameters
requestGenerateContentRequestThe GenerateContentRequest on which JSON mode will be applied.
optionsJsonSerializerOptionsOptional JsonSerializerOptions for customizing the serialization process.
Type Parameters
TThe type that defines the response schema for the JSON. Must be a class.
Remarks
For NativeAOT/Trimming JsonSerializerOptions are required, you can ignore it if you have already specified a resolver in