Releases: mardillu/OpenAI-Client-Android
Releases · mardillu/OpenAI-Client-Android
2.0.0
Changelog
Added
- Assistants API (Beta) - Full support for OpenAI Assistants v2
- Create, retrieve, and list Assistants
- Thread management (create, retrieve, delete)
- Message operations within threads
- Run operations with streaming support
- Vector Store support via
tool_resources - File Search and Code Interpreter v2 capabilities
- Files API - Upload, list, retrieve, and delete files
- Fine-tuning API - Create and manage fine-tuning jobs
- Streaming for Assistants - Server-Sent Events (SSE) support via
createRunStream - Vector Store Support - New models for
ToolResources,FileSearchResources, andVectorStore - Coroutines Support - All API methods now use
suspendfunctions - OpenAiConfig - Configuration class for API key and client settings
Changed
- BREAKING: Replaced callback-based API with Kotlin Coroutines
- All methods now use
suspendfunctions instead of callbacks - Error handling via try-catch instead of error callbacks
- All methods now use
- BREAKING: Removed
OpenAiInitializerstatic initialization- Use
OpenAiConfigconstructor parameter instead
- Use
- Chat Completions - Updated to support GPT-4 and GPT-3.5 Turbo features
- Function calling / Tools support
- JSON mode via
response_format - Added
seed,system_fingerprint, and other modern parameters
- Image Generation - Updated for DALL-E 3 support
- Added
model,quality, andstyleparameters
- Added
- Audio API - Enhanced transcription and translation endpoints
- Added optional parameters:
prompt,response_format,temperature,language
- Added optional parameters:
- Tool Definition - Made
functionnullable to supportfile_searchandcode_interpretertypes - Moderation API - Updated default model to
omni-moderation-latest
Deprecated
- Completions API - Legacy text completions (use Chat Completions instead)
- Edits API - Legacy edits endpoint (use Chat Completions instead)
file_idsinCreateAssistantRequest- Usetool_resourcesfor Assistants v2
Updated
- Gradle Wrapper to 8.6
- Android Gradle Plugin to 8.3.1
- Kotlin to 1.9.23
- AndroidX Core KTX to 1.12.0
- Material Components to 1.11.0
- Retrofit to 2.9.0
- OkHttp Logging Interceptor to 4.12.0
- Added lifecycle-runtime-ktx 2.6.2 for Coroutines support
Migration Guide
From Callbacks to Coroutines
Before:
OpenAiInitializer.initialize("API_KEY")
val client = OpenApiClient()
client.getChatCompletion(messages) { result, error ->
if (error != null) {
// Handle error
} else if (result != null) {
// Use result
}
}After:
val config = OpenAiConfig(apiKey = "API_KEY")
val client = OpenApiClient(config)
lifecycleScope.launch {
try {
val result = client.getChatCompletion(messages)
// Use result
} catch (e: Exception) {
// Handle error
}
}Using Vector Stores
val assistant = CreateAssistantRequest(
model = "gpt-4",
tools = listOf(Tool(type = "file_search")),
tool_resources = ToolResources(
file_search = FileSearchResources(
vector_store_ids = listOf("vs_123")
)
)
)