Table of Contents

Class CountTokensConfig

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

Config for the count_tokens method.

public record CountTokensConfig : IEquatable<CountTokensConfig>
Inheritance
CountTokensConfig
Implements
Inherited Members

Properties

GenerationConfig

Configuration that the model uses to generate the response. Not supported by the Gemini Developer API.

[JsonPropertyName("generationConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public GenerationConfig? GenerationConfig { get; set; }

Property Value

GenerationConfig

HttpOptions

Used to override HTTP request options.

[JsonPropertyName("httpOptions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public HttpOptions? HttpOptions { get; set; }

Property Value

HttpOptions

SystemInstruction

Instructions for the model to steer it toward better performance.

[JsonPropertyName("systemInstruction")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Content? SystemInstruction { get; set; }

Property Value

Content

Tools

Code that enables the system to interact with external systems to perform an action outside of the knowledge and scope of the model.

[JsonPropertyName("tools")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<Tool>? Tools { get; set; }

Property Value

List<Tool>

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a CountTokensConfig object.

public static CountTokensConfig? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

CountTokensConfig

The deserialized CountTokensConfig object, or null if deserialization fails.