aallam / openai-kotlin

OpenAI API client for Kotlin with multiplatform and coroutines capabilities.
MIT License
1.5k stars 180 forks source link

Is it possible to add a header for each request? #295

Closed ooyamatakehisa closed 10 months ago

ooyamatakehisa commented 10 months ago

Feature Description / Problem it Solves

I know we can specify headers now when we initialize OpenAIConfig, but as far as I try to look it up, I couldn't find the way to specify a header for each request.

For example, I'd like to specify different header values for each time calling opneAI.chatCompletion(). It would be great if we could specify a header for each method.

Possible solutions

There are request classes such as ChatCompletionRequest or CompletionRequest, so creating a base class for those request classes that have a field for headers and inherit it?