An enhanced Java HTTP client offering access to large language model APIs & services in a user-friendly manner.
To integrate the package, make use of the following Maven dependency:
<dependency>
<groupId>ee.ProductionShip</groupId>
<artifactId>advanced-llm-client</artifactId>
<version>0.8.6</version>
</dependency>
Gradle dependency:
dependencies {
implementation("ee.ProductionShip:advanced-llm-client:0.8.6")
}
OpenAIClient client = new OpenAIClient.Builder(System.getenv("OPENAI_API_KEY"))
.setOrganization("MY_ORGANIZATION")
.build();
EventSource call = client.getChatCompletionAsync(
new OpenAIChatCompletionRequest.Builder(List.of(new OpenAIChatCompletionStandardMessage("user", prompt)))
.setModel(OpenAIChatCompletionModel.GPT_4)
.setTemperature(0.1)
.build(),
new CompletionEventListener<String>(){
@Override
public void onMessage(String message, EventSource eventSource) {
System.out.println(message);
}
});
call.cancel();
Your contributions make the open source realm a wonderful platform for knowledge, inspiration and creativity. All contributions are deeply valued.
Should you have a suggestion that could enhance this, please fork the repo and create a pull request. You may also open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This is an independent OpenAI library and has no association with or endorsement by OpenAI.
MIT © [ProductionShip]