KtorHuggingFaceGenerationApi

class KtorHuggingFaceGenerationApi(val httpClient: HttpClient, val apiBaseUrl: String, val inferenceBaseUrl: String, val json: Json = defaultNetworkJson) : HuggingFaceGenerationApi(source)

Ktor implementation of Hugging Face generation requests with counted inference traffic.

Author

Dmitriy Moroz

Parameters

httpClient

Configured Ktor client used to send provider requests.

apiBaseUrl

Hugging Face API base URL used for model validation.

inferenceBaseUrl

Hugging Face inference base URL used for generation requests.

json

JSON codec used for counted request/response payloads.

Constructors

Link copied to clipboard
constructor(httpClient: HttpClient, apiBaseUrl: String, inferenceBaseUrl: String, json: Json = defaultNetworkJson)
constructor(apiBaseUrl: String, inferenceBaseUrl: String)

Types

Link copied to clipboard
private object Companion

Properties

Link copied to clipboard
private val apiBaseUrl: String

Exposes the apiBaseUrl value used by the SDAI network layer.

Link copied to clipboard
private val httpClient: HttpClient

Exposes the httpClient value used by the SDAI network layer.

Link copied to clipboard

Exposes the inferenceBaseUrl value used by the SDAI network layer.

Link copied to clipboard
private val json: Json

Exposes the json value used by the SDAI network layer.

Functions

Link copied to clipboard
open suspend override fun generate(apiKey: String, model: String, request: HuggingFaceGenerationRequest): ByteArray

Executes the generate step in the SDAI network layer.

Link copied to clipboard
private suspend fun <T> retryServiceUnavailable(block: suspend () -> T): T
Link copied to clipboard
open suspend override fun validateBearerToken(apiKey: String)

Executes the validateBearerToken step in the SDAI network layer.