mukand / openai-android

Open AI Android SDK, #ChatGPT, #DALL-E, #ChatGPT Plus, #New Bing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenAI Android

The project for OpenAI official APIs

  • Text Completion
  • Image Generation(DALL-E)
  • Playground
  • ChatGPT Web API(ChatGPT Plus)
  • New Bing AI API

Usages

implementation 'com.yat3s.openai:openai-android:0.0.4'

Text Completion

val response = TextCompletionBuilder(BuildConfig.OPENAI_API_KEY).build().textCompletion("Your prompt)

Advanced Configurations

val response = TextCompletionBuilder(OPENAI_API_KEY)
    .maxTokens(1000) // 1 - 4000, default 500
    .temperature(0.6f) // 0 - 2f, default 1f
    .model("you model") // default "text-davinci-003"
    .build().textCompletion(text)

Please check the definition on Open AI text completion parameters

Image Generation(DALL-E)

val response = ImageGenerationBuilder(BuildConfig.OPENAI_API_KEY).build().imageGeneration("Your prompt")

Advanced Configurations

val response = ImageGenerationBuilder(OPENAI_API_KEY)
    .generateCount(2) // The image count to generate, default 1
    .imageSize("512x512") // "256x256", "512x512", "1024x1024" are supported, default "1024x1024"
    .imageResponseFormat("url") // "url", "b64_json" are supported, default "url"
    .build()
    .imageGeneration("Your prompt")

How to get API KEY

Please go to Open AI API KEY to create your API keys. image

About

Open AI Android SDK, #ChatGPT, #DALL-E, #ChatGPT Plus, #New Bing


Languages

Language:Kotlin 100.0%