Skip to content

Java: Naming conventions in Builder interface #2437

@agoncal

Description

@agoncal

The Builder interface has two methods, one starting with with and the other one with set:

interface Builder extends SemanticKernelBuilder<ChatCompletion> {
  Builder withOpenAIClient(OpenAIAsyncClient client);
  Builder setModelId(String modelId);
}

This is confusing because most of the build methods start with with and not set. For example withDefaultAIService, withOpenAIClient but setModelId:

Kernel kernel = SKBuilders.kernel()
  .withDefaultAIService(SKBuilders.textCompletionService()
    .setModelId("text-davinci-003")
    .withOpenAIClient(client)
    .build())
  .build();

It will feel more natural to have with on both methods. WDYT?

interface Builder extends SemanticKernelBuilder<ChatCompletion> {
  Builder withOpenAIClient(OpenAIAsyncClient client);
  Builder withModelId(String modelId);
}

PS: somehow related to #2436

Metadata

Metadata

Assignees

Labels

javaIssue or PR regarding Java codesk team issueA tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions