Gemini.Types.Response.InlinedEmbedContentResponse (GeminiEx v0.8.4)

View Source

Response for a single request within an async batch.

This is a union type - exactly ONE of response or error will be set.

Union Type - ONE will be set:

  • response: Successful EmbedContentResponse
  • error: Error status if request failed

Fields

  • metadata: Optional metadata from the request
  • response: Successful embedding response (if successful)
  • error: Error details (if failed)

Examples

# Successful response
%InlinedEmbedContentResponse{
  metadata: %{"id" => "123"},
  response: %EmbedContentResponse{...},
  error: nil
}

# Failed response
%InlinedEmbedContentResponse{
  metadata: %{"id" => "456"},
  response: nil,
  error: %{"code" => 400, "message" => "Invalid input"}
}

Summary

Functions

Creates an inlined response from API response data.

Checks if the inlined response is an error.

Checks if the inlined response is successful.

Types

t()

@type t() :: %Gemini.Types.Response.InlinedEmbedContentResponse{
  error: map() | nil,
  metadata: map() | nil,
  response: Gemini.Types.Response.EmbedContentResponse.t() | nil
}

Functions

from_api_response(data)

@spec from_api_response(map()) :: t()

Creates an inlined response from API response data.

Parameters

  • data: Map containing the API response

Examples

InlinedEmbedContentResponse.from_api_response(%{
  "metadata" => %{"id" => "123"},
  "response" => %{"embedding" => %{"values" => [...]}}
})

is_error?(arg1)

@spec is_error?(t()) :: boolean()

Checks if the inlined response is an error.

Examples

InlinedEmbedContentResponse.is_error?(response)
# => false

is_success?(arg1)

@spec is_success?(t()) :: boolean()

Checks if the inlined response is successful.

Examples

InlinedEmbedContentResponse.is_success?(response)
# => true