Table of Contents

Class ExternalApi

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

Retrieve from data source powered by external API for grounding. The external API is not owned by Google, but need to follow the pre-defined API spec. This data type is not supported in Gemini API.

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

Properties

ApiAuth

The authentication config to access the API. Deprecated. Please use auth_config instead.

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

Property Value

ApiAuth

ApiSpec

The API spec that the external API implements.

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

Property Value

ApiSpec?

AuthConfig

The authentication config to access the API.

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

Property Value

AuthConfig

ElasticSearchParams

Parameters for the elastic search API.

[JsonPropertyName("elasticSearchParams")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ExternalApiElasticSearchParams? ElasticSearchParams { get; set; }

Property Value

ExternalApiElasticSearchParams

Endpoint

The endpoint of the external API. The system will call the API at this endpoint to retrieve the data for grounding. Example: https://acme.com:443/search

[JsonPropertyName("endpoint")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Endpoint { get; set; }

Property Value

string

SimpleSearchParams

Parameters for the simple search API.

[JsonPropertyName("simpleSearchParams")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ExternalApiSimpleSearchParams? SimpleSearchParams { get; set; }

Property Value

ExternalApiSimpleSearchParams

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a ExternalApi object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

ExternalApi

The deserialized ExternalApi object, or null if deserialization fails.