ai-for-java / openai4j

Java client library for OpenAI API
Apache License 2.0
85 stars 35 forks source link

Add a method to customize the User Agent #17

Closed jdubois closed 8 months ago

jdubois commented 8 months ago

Allow the customization of the "User-Agent" sent as a header by okhttp3.

My goal is to use it in LangChain4J OpenAI at https://github.com/langchain4j/langchain4j/tree/main/langchain4j-open-ai to have something similar to what we have in LangChain4J Azure OpenAI (see https://github.com/langchain4j/langchain4j/blob/200522f558509a67e940ae4c82284b85caaebef8/langchain4j-azure-open-ai/src/main/java/dev/langchain4j/model/azure/InternalAzureOpenAiHelper.java#L77 ).

This is important as this allows Azure OpenAI (and probably also OpenAI) to see which tool or library people are using, which is important to get support from them.