SDK for continuous ChatGPT conversations and streaming outputs
Top 98.8% on sourcepulse
This project provides a Java SDK for interacting with the OpenAI API, specifically designed for continuous conversation and streaming output. It targets Java developers looking to integrate ChatGPT capabilities into their Spring Boot applications or standalone Java projects, offering features like chat completion, image generation, text embeddings, audio transcription/translation, and account billing queries.
How It Works
The library leverages Spring Boot and Vue.js for its web-based demos, abstracting OpenAI API calls through a OpenAiUtils
class and a configurable OpenAiProxyService
. It supports continuous conversation by managing session expiration times and allows for custom OkHttpClient
configurations, including proxy authentication and connection pooling. Streaming output is handled by passing an OutputStream
to the relevant methods, enabling real-time responses in web applications.
Quick Start & Requirements
<dependency>
<groupId>io.github.asleepyfish</groupId>
<artifactId>chatgpt</artifactId>
<version>Latest Version</version>
</dependency>
application.yml
with your OpenAI API token and optional proxy settings. For Spring Boot integration, add @EnableChatGPT
to your main application class.Highlighted Details
baseUrl
, OkHttpClient
, and token management strategies.Maintenance & Community
The project is actively maintained, with recent updates adding features like model listing, file management, fine-tuning capabilities, and improved token strategies. Links to demos and example usage are provided.
Licensing & Compatibility
The README does not explicitly state a license. Compatibility for commercial use or closed-source linking is not specified.
Limitations & Caveats
The project requires users to have an OpenAI API key. Some features, like audio transcription and translation, may have specific format requirements. The README mentions that mainland China users often need to configure proxy settings.
1 year ago
1 day