[FEATURE] Add withApiKey and withEndpoint shortcut methods to Azure models
Today all the models have Builders so you can build a valid model and then invoke it. Some models (MistralAiChatModel, NomicEmbeddingModel, OpenAiChatModel, etc.) also have shortcut methods allowing to set the minimum required attributes instead of using the builder:
// Using shortcut methods
ChatLanguageModel model = OpenAiChatModel.withApiKey(ApiKeys.OPENAI_API_KEY);
// Using the builder
ChatLanguageModel model = OpenAiChatModel.builder()
.apiKey(ApiKeys.OPENAI_API_KEY))
.modelName(GPT_4_VISION_PREVIEW)
.maxTokens(50)
.build();
It would be nice to have the same shortcuts (apiKey and endpoint) in the Azure models (AzureOpenAiChatModel, AzureOpenAiLanguageModel, AzureOpenAiStreamingLanguageModel, etc.)
AzureOpenAiChatModel model = AzureOpenAiChatModel.withApiKey(apiKey).withEndpoint(endpoint);
This way you can easily have an Azure model in one line.... and use the Builder if you need more control.
As a developer who uses langchain4j, I would want the same shortcuts for all models.
i wanna try this, pls assign me thanks.
@yeshadoo go ahead, thanks!
Hey @yeshadoo, any progress on that? Do you need any help?
I apologize for being a bit busy recently, so I have to temporarily cancel the task assignment.
On Thu, Mar 21, 2024 at 11:55 AM Antonio Goncalves @.***> wrote:
Hey @yeshadoo https://github.com/yeshadoo, any progress on that? Do you need any help?
— Reply to this email directly, view it on GitHub https://github.com/langchain4j/langchain4j/issues/614#issuecomment-2011172737, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKMGMBZGXDQBDEU2FMRLGTYZJKZRAVCNFSM6AAAAABC7W4TIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJRGE3TENZTG4 . You are receiving this because you were mentioned.Message ID: @.***>
@yeshadoo No problem, that's fine. It happens to all of us. I'll take care of it.
@langchain4j can you assign this one to me please