{"id":3611,"date":"2023-11-23T14:48:20","date_gmt":"2023-11-23T22:48:20","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/surface-duo\/?p=3611"},"modified":"2024-01-03T16:04:54","modified_gmt":"2024-01-04T00:04:54","slug":"android-openai-chatgpt-26","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/surface-duo\/android-openai-chatgpt-26\/","title":{"rendered":"Test the latest AI features in Kotlin"},"content":{"rendered":"<p>\n  Hello prompt engineers,\n<\/p>\n<p>\n  <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/openai-assistants\/\">Last week<\/a> we looked at one of the new OpenAI features \u2013 Assistants \u2013 in the web playground, but good news: <i>the OpenAI Kotlin library is already being updated with the new APIs<\/i> and you can start to try them out right now in your Android codebase with snapshot package builds. With a few minor configuration changes you can start testing the latest AI features and get ready for a supported package release.\n<\/p>\n<h2>Use OpenAI Kotlin library snapshots<\/h2>\n<p>\n  While new features are being added to the Kotlin library, you can track progress from this <a href=\"https:\/\/github.com\/aallam\/openai-kotlin\/issues\/252\">GitHub issue<\/a> and the related PRs including support for the updated Images API as well as the Assistants API. Not all features will be complete (at the time of writing).\n<\/p>\n<p>\n  The owner (<a href=\"https:\/\/github.com\/aallam\/\">aallam<\/a>) of the  <a href=\"https:\/\/github.com\/aallam\/openai-kotlin\/\">openai-kotlin repo<\/a> is publishing pre-release snapshot builds of these features for developers to play with prior to an official release. You can see the changes required to test the snapshot in this <a href=\"https:\/\/github.com\/conceptdev\/droidcon-sf-23\/pull\/22\/files\">JetchatAI pull request<\/a>:\n<\/p>\n<ol>\n<li>Add the snapshot package source to the <strong>settings.gradle.kts<\/strong> file:\n<pre>maven { url = uri(\"https:\/\/oss.sonatype.org\/content\/repositories\/snapshots\/\") }<\/pre>\n<\/li>\n<li>\n  Update the <code>openai<\/code> package version reference to <code>3.6.0-SNAPSHOT<\/code> (in <strong>gradle\/libs.versions.toml<\/strong>):<\/p>\n<pre>openai = \"com.aallam.openai:openai-client:3.6.0-SNAPSHOT\"<\/pre>\n<\/li>\n<li>\n  You can now start working with the &#8220;beta&#8221; API implementations (such as the DALL\u00b7E 3 image support)\n<\/li>\n<\/ol>\n<p>\n  Once the completed 3.6.0 release is available, don\u2019t forget to remove the snapshots package source and update the version reference to a stable number.\n<\/p>\n<h2>Test with DALL\u00b7E 3<\/h2>\n<p>\n  One of the new features <a href=\"https:\/\/openai.com\/blog\/new-models-and-developer-products-announced-at-devday\">announced at OpenAI Dev Day<\/a> is DALL\u00b7E 3 support in the Image generation API. You can read more in the  <a href=\"https:\/\/platform.openai.com\/docs\/guides\/images?context=node\">FAQs<\/a> and <a href=\"https:\/\/help.openai.com\/en\/articles\/8555480-dall-e-3-api\">documentation<\/a>.\n<\/p>\n<p>\n  To use the updated API, first reference the snapshot builds as described above, and then add the new model declaration to the <code>ImageCreation<\/code> constructor:\n<\/p>\n<pre>val imageRequest = ImageCreation(prompt = prompt, model = ModelId(\"dall-e-3\"))<\/pre>\n<p>\n  Note that the <code>model<\/code> parameter did not exist in previous builds of the OpenAI Kotlin library, so if you see any compile errors then re-check your gradle changes to ensure you\u2019re referencing the latest snapshot.\n<\/p>\n<p>\n  The images in Figure 1 compare the same prompt being run on DALL\u00b7E 2 and DALL\u00b7E 3 in the <em>JetchatAI<\/em> demo:\n<\/p>\n<p>\n  <img decoding=\"async\" width=\"1600\" height=\"969\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/11\/screens-screenshots-of-a-phone-description-automa.png\" class=\"wp-image-3612\" alt=\"Screenshots of two JetchatAI chats, the left showing an image from DALL-E2 and the right showing an image from DALL-E 3. The DALLE-E 3 image is hyper-real and looks more impressive.\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/11\/screens-screenshots-of-a-phone-description-automa.png 1600w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/11\/screens-screenshots-of-a-phone-description-automa-300x182.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/11\/screens-screenshots-of-a-phone-description-automa-1024x620.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/11\/screens-screenshots-of-a-phone-description-automa-768x465.png 768w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/11\/screens-screenshots-of-a-phone-description-automa-1536x930.png 1536w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><br\/><em>Figure 1: image response from DALL\u00b7E 2 and DALL\u00b7E 3 for the prompt \u201ca bucolic image\u201d<\/em>\n<\/p>\n<p>\n  Have fun playing with DALL\u00b7E 3 and the other new APIs!\n<\/p>\n<h2>Resources and feedback<\/h2>\n<p>\n  Refer to the <a href=\"https:\/\/openai.com\/blog\/new-models-and-developer-products-announced-at-devday\" target=\"_blank\" rel=\"noopener\">OpenAI blog<\/a> for more details on the Dev Day announcements, and the <a href=\"https:\/\/github.com\/aallam\/openai-kotlin\/\">openai-kotlin repo<\/a> for updates on support for the new features.\u00a0\n<\/p>\n<p>\n  We\u2019d love your feedback on this post, including any tips or tricks you\u2019ve learned from playing around with ChatGPT prompts.\u00a0\n<\/p>\n<p>\n  If you have any thoughts or questions, use the <a href=\"http:\/\/aka.ms\/SurfaceDuoSDK-Feedback\" target=\"_blank\" rel=\"noopener\">feedback forum<\/a> or message us on <a href=\"https:\/\/twitter.com\/surfaceduodev\" target=\"_blank\" rel=\"noopener\">Twitter @surfaceduodev<\/a>.\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello prompt engineers, Last week we looked at one of the new OpenAI features \u2013 Assistants \u2013 in the web playground, but good news: the OpenAI Kotlin library is already being updated with the new APIs and you can start to try them out right now in your Android codebase with snapshot package builds. With [&hellip;]<\/p>\n","protected":false},"author":570,"featured_media":3612,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[741],"tags":[734,733],"class_list":["post-3611","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","tag-chatgpt","tag-openai"],"acf":[],"blog_post_summary":"<p>Hello prompt engineers, Last week we looked at one of the new OpenAI features \u2013 Assistants \u2013 in the web playground, but good news: the OpenAI Kotlin library is already being updated with the new APIs and you can start to try them out right now in your Android codebase with snapshot package builds. With [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/3611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/users\/570"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/comments?post=3611"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/3611\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media\/3612"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media?parent=3611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/categories?post=3611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/tags?post=3611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}