ChatSession Class

[Missing <summary> documentation for "T:GenerativeAI.ChatSession"]

Definition

Namespace: GenerativeAI
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
public class ChatSession : GenerativeModel
Inheritance
Object    ApiBase    BaseClient    BaseModel    GenerativeModel    ChatSession

Constructors

Properties

CachedContent Gets or sets preloaded or previously generated content associated with the generative model. This property allows for the reuse of specific content, bypassing the need for regeneration, while ensuring alignment with the current model configuration and constraints.
(Inherited from GenerativeModel)
CachingClient Gets or sets the client used for managing cached content operations in the generative AI model. This property provides an interface for interacting with caching-related functionalities, such as creating, updating, retrieving, or deleting cached content. It helps manage content efficiently by leveraging the CachingClient within the model's context.
(Inherited from GenerativeModel)
Config Gets or sets the configuration for content generation. This property defines specific parameters, such as temperature and maximum output tokens, that influence the behavior and output of the generative model. It serves as a central customization point for tailoring the content creation process.
(Inherited from GenerativeModel)
FunctionCallingBehaviour
(Inherited from GenerativeModel)
FunctionTools
(Inherited from GenerativeModel)
History Gets or sets the history of the current chat session, representing a collection of user and model interactions recorded throughout the session. Updates to this property will reset both LastRequestContent and LastResponseContent.
HttpClient
(Inherited from ApiBase)
LastRequestContent Gets the content of the last request made in the current chat session, allowing access to the most recently sent message or query. This property is updated each time a request is successfully made within the session.
LastResponseContent Gets the content of the last response received in the current chat session, providing access to the most recently generated reply or output from the model. This property is updated each time a response is successfully received within the session.
Logger
(Inherited from ApiBase)
Model Gets or sets the name or identifier of the model used for generative tasks. This property determines the specific model implementation to be used for content generation and other related operations.
(Inherited from GenerativeModel)
Platform
(Inherited from BaseClient)
SafetySettings Gets or sets the collection of safety settings that define constraints or limits on content generation. This property is used to enforce specified safety rules to ensure the generated content aligns with predetermined guidelines or restrictions.
(Inherited from GenerativeModel)
SerializerOptions JSON serialization options used for API requests and responses.
(Inherited from ApiBase)
SystemInstruction Gets or sets the system instruction used to guide the behavior of the generative model. This property defines the overarching context or guideline for content generation, shaping the responses produced by the model to align with specific requirements or objectives.
(Inherited from GenerativeModel)
ToolConfig
(Inherited from GenerativeModel)
UseCodeExecutionTool Indicates whether the code execution tool is enabled. The code execution tool facilitates the integration of code execution capabilities for processing specific requests and enhancing model functionalities.
(Inherited from GenerativeModel)
UseGoogleSearch Specifies whether the Google Search integration is enabled. This feature allows utilizing the Google Search Tool within the generative model for enhanced search and retrieval capabilities.
(Inherited from GenerativeModel)
UseGrounding Indicates whether grounding is enabled. Grounding integrates external tools, such as Google Search Retrieval, to support specific generative model requests for enhanced content generation.
(Inherited from GenerativeModel)
UseJsonMode Determines whether JSON mode is enabled. JSON mode adjusts the content generation response to specifically produce outputs in JSON format as defined in generation configurations.
(Inherited from GenerativeModel)

Methods

AddAuthorizationHeader
(Inherited from BaseClient)
AddFunctionTool
(Inherited from GenerativeModel)
BatchEmbedContentAsync Embeds a batch of content using the specified Generative AI model.
(Inherited from BaseModel)
CheckAndHandleErrors
(Inherited from ApiBase)
CheckBlockedResponse
(Inherited from BaseModel)
CountTokensAsync(CountTokensRequest) Counts tokens asynchronously based on the provided request.
(Inherited from GenerativeModel)
CountTokensAsync(GenerateContentRequest) Counts the number of tokens in the content based on the provided GenerateContentRequest.
(Inherited from GenerativeModel)
CountTokensAsync(IEnumerableContent) Asynchronously counts the tokens in the given contents.
(Inherited from GenerativeModel)
CountTokensAsync(IEnumerablePart) Asynchronously counts the tokens in the provided collection of parts.
(Inherited from GenerativeModel)
CountTokensAsync(String, CountTokensRequest) Counts the number of tokens in a given input using the provided model and request.
(Inherited from BaseModel)
DeleteAsync Sends a DELETE request to the specified URL.
(Inherited from ApiBase)
DeserializeT(HttpResponseMessage) Deserializes a JSON string into an object of the specified type.
(Inherited from ApiBase)
DeserializeT(String) Deserializes a JSON string into an object of the specified type.
(Inherited from ApiBase)
DisableFunctions Disable Global Functions
(Inherited from GenerativeModel)
EmbedContentAsync Embeds content using the specified Generative AI Model.
(Inherited from BaseModel)
EnableFunctions Enable Global Functions
(Inherited from GenerativeModel)
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GenerateAnswerAsync(GenerateAnswerRequest, CancellationToken) Generates an answer asynchronously based on the provided request.
(Inherited from GenerativeModel)
GenerateAnswerAsync(String, GenerateAnswerRequest, CancellationToken) Generates a grounded answer from the model given an input GenerateAnswerRequest.
(Inherited from BaseModel)
GenerateAnswerAsync(String, AnswerStyle, ICollectionSafetySetting, CancellationToken) Generates an answer asynchronously based on the given prompt and specified parameters.
(Inherited from GenerativeModel)
GenerateContentAsync(GenerateContentRequest, CancellationToken) Generates content asynchronously based on the given input parameters.
(Overrides GenerativeModelGenerateContentAsync(GenerateContentRequest, CancellationToken))
GenerateContentAsync(IEnumerablePart, CancellationToken) Generate content based on a sequence of Part objects.
(Inherited from GenerativeModel)
GenerateContentAsync(String, GenerateContentRequest) Generates a model response given an input GenerateContentRequest.
(Inherited from BaseModel)
GenerateContentAsync(String, CancellationToken) Generates content asynchronously based on the specified text input prompt.
(Inherited from GenerativeModel)
GenerateContentAsync(String, String, String, CancellationToken) Generates content asynchronously based on the provided text prompt and an inline file path.
(Inherited from GenerativeModel)
GenerateContentStreamAsync Streams model responses chunk by chunk given an input GenerateContentRequest.
(Inherited from BaseModel)
GenerateObjectAsyncT(GenerateContentRequest, CancellationToken) Generates content asynchronously using JSON mode based on the given input parameters and converts the resulting JSON into a C# object of type T.
(Inherited from GenerativeModel)
GenerateObjectAsyncT(IEnumerablePart, CancellationToken) Generates content asynchronously using JSON mode based on the specified content generation request parts and converts the resulting JSON into a C# object of type T.
(Inherited from GenerativeModel)
GenerateObjectAsyncT(String, CancellationToken) Generates content asynchronously using JSON mode based on the specified text input prompt and converts the resulting JSON into a C# object of type T.
(Inherited from GenerativeModel)
GetAsyncT Sends a GET request to the specified URL.
(Inherited from ApiBase)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
PrepareRequest
(Overrides GenerativeModelPrepareRequest(GenerateContentRequest))
SendAsyncTRequest, TResponse Sends an HTTP request (e.g., POST, PUT, or PATCH) to the specified URL.
(Inherited from ApiBase)
StartChat Start a Chat Session
(Inherited from GenerativeModel)
StreamAsyncTRequest, TResponse Streams responses by sending an HTTP request with a JSON payload and yielding the deserialized items as they arrive.
(Inherited from ApiBase)
StreamContentAsync(GenerateContentRequest, CancellationToken) Streams content generation results asynchronously based on a given request and optional cancellation token.
(Overrides GenerativeModelStreamContentAsync(GenerateContentRequest, CancellationToken))
StreamContentAsync(IEnumerableContent, CancellationToken) Streams generated content as an asynchronous enumerable based on the provided request.
(Inherited from GenerativeModel)
StreamContentAsync(IEnumerablePart, CancellationToken) Streams content generation based on a GenerateContentRequest asynchronously.
(Inherited from GenerativeModel)
StreamContentAsync(String, CancellationToken) Streams content generation based on a string message.
(Inherited from GenerativeModel)
StreamContentAsync(String, String, String, CancellationToken) Streams content generation asynchronously based on the given input prompt, file URI, and MIME type.
(Inherited from GenerativeModel)
ToStringReturns a string that represents the current object.
(Inherited from Object)
UploadFileWithProgressAsync(String, String, ActionDouble, DictionaryString, String, CancellationToken) Uploads a file to the specified URL with progress reporting.
(Inherited from ApiBase)
UploadFileWithProgressAsync(Stream, String, String, String, ActionDouble, DictionaryString, String, CancellationToken)
(Inherited from ApiBase)
ValidateGenerateContentRequest
(Inherited from GenerativeModel)

Fields

See Also