GeminiApiService

Provides a clean interface for making HTTP calls to the GeminiApiEndpoints using a KtorClient and handles Data Structure (DS) conversions between domain and HTTP bodies. The methods receive DSs from data.domains.gemini, and use DSs from data.sources.cloud.gemini to use with KtorClient and then converts them back to DS from data.domains.gemini See "gemini test2.sh" in docs/gemini-api-curl-test for reference.

Constructors

Link copied to clipboard
constructor(apiKey: String)

Properties

Link copied to clipboard
Link copied to clipboard
private val http: KtorClient

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard

Performs a POST request to Gemini given a prompt as the body

Link copied to clipboard
Link copied to clipboard
private suspend fun HttpResponse.toDomainError(): GeminiResponse

To improve the text, I could have defined the possible JSON formats of the errors

Link copied to clipboard