{"id":3381,"date":"2024-05-20T15:56:48","date_gmt":"2024-05-20T10:26:48","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=3381"},"modified":"2024-05-20T15:56:48","modified_gmt":"2024-05-20T10:26:48","slug":"using-openai-from-mathematica","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2024\/05\/20\/using-openai-from-mathematica\/","title":{"rendered":"Using OpenAI from Mathematica"},"content":{"rendered":"<p><em><strong>Mathematica<\/strong><\/em> was among the first to integrate with <em><strong>OpenAI<\/strong><\/em>. The functionality is nicely exposed in terms of a few pre-defined functions. Let us explore some of the functionality in today\u2019s article.<\/p>\n<p>The simplest way to get started is to use <em><strong>LLMSynthesize<\/strong><\/em>\u00a0function:<\/p>\n<figure id=\"attachment_3382\" aria-describedby=\"caption-attachment-3382\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example1.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"3382\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/05\/20\/using-openai-from-mathematica\/example1-34\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example1.png\" data-orig-size=\"1558,138\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"LLMSynthesize Function\" data-image-description=\"&lt;p&gt;LLMSynthesize Function&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;LLMSynthesize Function&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example1-1024x91.png\" class=\"wp-image-3382\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example1.png?resize=600%2C53&#038;ssl=1\" alt=\"LLMSynthesize Function\" width=\"600\" height=\"53\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example1.png?resize=300%2C27&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example1.png?resize=1024%2C91&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example1.png?resize=768%2C68&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example1.png?resize=1536%2C136&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example1.png?w=1558&amp;ssl=1 1558w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-3382\" class=\"wp-caption-text\"><strong>LLMSynthesize Function<\/strong><\/figcaption><\/figure>\n<p>It can take a few seconds before you get the answer.<\/p>\n<p>If this is the first time you are trying to access <em><strong>OpenAI<\/strong><\/em> functionality from <em><strong>Mathematica<\/strong><\/em>, you will be prompted to enter your access key:<\/p>\n<figure id=\"attachment_3383\" aria-describedby=\"caption-attachment-3383\" style=\"width: 450px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Authorization.png?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"3383\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/05\/20\/using-openai-from-mathematica\/authorization\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Authorization.png\" data-orig-size=\"988,870\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"OpenAI Authorization\" data-image-description=\"&lt;p&gt;OpenAI Authorization&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;OpenAI Authorization&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Authorization.png\" class=\"wp-image-3383\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Authorization.png?resize=450%2C396&#038;ssl=1\" alt=\"OpenAI Authorization\" width=\"450\" height=\"396\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Authorization.png?resize=300%2C264&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Authorization.png?resize=768%2C676&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Authorization.png?w=988&amp;ssl=1 988w\" sizes=\"(max-width: 450px) 100vw, 450px\" \/><\/a><figcaption id=\"caption-attachment-3383\" class=\"wp-caption-text\"><strong>OpenAI Authorization<\/strong><\/figcaption><\/figure>\n<p>The entered information can be saved for future use as well and you won\u2019t be prompted again.<\/p>\n<p>Here is another interaction with LLM:<\/p>\n<figure id=\"attachment_3384\" aria-describedby=\"caption-attachment-3384\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example2.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"3384\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/05\/20\/using-openai-from-mathematica\/example2-29\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example2.png\" data-orig-size=\"1560,908\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Another Example\" data-image-description=\"&lt;p&gt;Another Example&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Another Example&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example2-1024x596.png\" class=\"wp-image-3384\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example2.png?resize=550%2C320&#038;ssl=1\" alt=\"Another Example\" width=\"550\" height=\"320\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example2.png?resize=300%2C175&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example2.png?resize=1024%2C596&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example2.png?resize=768%2C447&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example2.png?resize=1536%2C894&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example2.png?w=1560&amp;ssl=1 1560w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-3384\" class=\"wp-caption-text\"><strong>Another Example<\/strong><\/figcaption><\/figure>\n<p>If you wish to restrict the number of generated tokens, it is easy to do that:<\/p>\n<figure id=\"attachment_3385\" aria-describedby=\"caption-attachment-3385\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example3.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3385\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/05\/20\/using-openai-from-mathematica\/example3-26\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example3.png\" data-orig-size=\"1550,154\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Controlling Generated Tokens\" data-image-description=\"&lt;p&gt;Controlling Generated Tokens&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Controlling Generated Tokens&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example3-1024x102.png\" class=\"wp-image-3385\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example3.png?resize=550%2C55&#038;ssl=1\" alt=\"Controlling Generated Tokens\" width=\"550\" height=\"55\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example3.png?resize=300%2C30&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example3.png?resize=1024%2C102&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example3.png?resize=768%2C76&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example3.png?resize=1536%2C153&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example3.png?w=1550&amp;ssl=1 1550w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-3385\" class=\"wp-caption-text\"><strong>Controlling Generated Tokens<\/strong><\/figcaption><\/figure>\n<p>Sometimes we want to experiment with different models. We can even specify a specific model to use:<\/p>\n<figure id=\"attachment_3386\" aria-describedby=\"caption-attachment-3386\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example4.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3386\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/05\/20\/using-openai-from-mathematica\/example4-18\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example4.png\" data-orig-size=\"1562,238\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Specifying the Model\" data-image-description=\"&lt;p&gt;Specifying the Model&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Specifying the Model&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example4-1024x156.png\" class=\"wp-image-3386\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example4.png?resize=550%2C84&#038;ssl=1\" alt=\"Specifying the Model\" width=\"550\" height=\"84\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example4.png?resize=300%2C46&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example4.png?resize=1024%2C156&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example4.png?resize=768%2C117&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example4.png?resize=1536%2C234&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example4.png?w=1562&amp;ssl=1 1562w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-3386\" class=\"wp-caption-text\"><strong>Specifying the Model<\/strong><\/figcaption><\/figure>\n<p>I could specify the recently released <em><strong>GPT-4o<\/strong><\/em> model too!<\/p>\n<figure id=\"attachment_3387\" aria-describedby=\"caption-attachment-3387\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example5.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3387\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/05\/20\/using-openai-from-mathematica\/example5-14\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example5.png\" data-orig-size=\"1560,236\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Using the Latest Model\" data-image-description=\"&lt;p&gt;Using the Latest Model&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Using the Latest Model&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example5-1024x155.png\" class=\"wp-image-3387\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example5.png?resize=550%2C83&#038;ssl=1\" alt=\"Using the Latest Model\" width=\"550\" height=\"83\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example5.png?resize=300%2C45&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example5.png?resize=1024%2C155&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example5.png?resize=768%2C116&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example5.png?resize=1536%2C232&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example5.png?w=1560&amp;ssl=1 1560w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-3387\" class=\"wp-caption-text\"><strong>Using the Latest Model<\/strong><\/figcaption><\/figure>\n<p>The above interactions show that we can use the <em><strong>LLMSynthesize<\/strong><\/em> function to talk directly to the LLM. What is nice, but not surprising, is that we can build other functions on top of <em><strong>LLMSynthesize<\/strong><\/em>. Here is an example:<\/p>\n<figure id=\"attachment_3388\" aria-describedby=\"caption-attachment-3388\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example6.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3388\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/05\/20\/using-openai-from-mathematica\/example6-8\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example6.png\" data-orig-size=\"1576,560\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Building on LLMSynthesize\" data-image-description=\"&lt;p&gt;Building on LLMSynthesize&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Building on LLMSynthesize&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example6-1024x364.png\" class=\"wp-image-3388\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example6.png?resize=550%2C195&#038;ssl=1\" alt=\"Building on LLMSynthesize\" width=\"550\" height=\"195\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example6.png?resize=300%2C107&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example6.png?resize=1024%2C364&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example6.png?resize=768%2C273&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example6.png?resize=1536%2C546&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example6.png?resize=675%2C240&amp;ssl=1 675w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/05\/Example6.png?w=1576&amp;ssl=1 1576w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-3388\" class=\"wp-caption-text\"><strong>Building on LLMSynthesize<\/strong><\/figcaption><\/figure>\n<p>This means we can write <em><strong>Mathematica<\/strong><\/em> functions that can take advantage of <em><strong>Gen-AI<\/strong><\/em> where necessary without directly exposing the problem solving logic!<\/p>\n<p><em><strong>Mathematica<\/strong><\/em> also allows us to create <em><strong>Chat-Enabled<\/strong><\/em> and <em><strong>Chat-Driven<\/strong><\/em>\u00a0Notebooks, instead of the traditional Notebook. I haven\u2019t explored these, but will do so in the coming weeks.<\/p>\n<p>I hope <em><strong>Wolfram<\/strong><\/em> expands the scope of <em><strong>Gen-AI<\/strong><\/em> integration by supporting other models as well, including open source ones.<\/p>\n<p>The above examples have been tested in <em><strong>Mathematica<\/strong><\/em><em><strong>\u00a014.0.<\/strong><\/em><\/p>\n<p>Have a nice week ahead!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mathematica was among the first to integrate with OpenAI. The functionality is nicely exposed in terms of a few pre-defined functions. Let us explore some of the functionality in today\u2019s article. The simplest way to get started is to use LLMSynthesize\u00a0function: It can take a few seconds before you get the answer. If this is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[72,388,17],"tags":[],"class_list":["post-3381","post","type-post","status-publish","format-standard","hentry","category-mathematica","category-openai","category-programming"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-Sx","jetpack-related-posts":[{"id":3514,"url":"https:\/\/www.rangakrish.com\/index.php\/2024\/10\/02\/using-openai-from-mathematica-part-2\/","url_meta":{"origin":3381,"position":0},"title":"Using OpenAI from Mathematica: Part-2","author":"admin","date":"October 2, 2024","format":false,"excerpt":"I had written an earlier article\u00a0showing how to use OpenAI models from Mathematica ver 14.0.\u00a0 Wolfram Mathematica ver 14.1 was released recently, with several improvements in the area of LLMs. Of course, there are many other core additions as well, but our focus is on LLMs in this article. This\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"LLMSynthesize Function","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/10\/image1-300x71.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/10\/image1-300x71.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/10\/image1-300x71.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3626,"url":"https:\/\/www.rangakrish.com\/index.php\/2025\/02\/21\/using-openai-from-mathematica-part-3\/","url_meta":{"origin":3381,"position":1},"title":"Using OpenAI from Mathematica: Part-3","author":"admin","date":"February 21, 2025","format":false,"excerpt":"Let us continue our discussion on using Mathematica to interact with OpenAI (you may want to go through the earlier article as well). The simplest function to interact with the LLM is LLMSynthesize[]. As you might have guessed, this is a \u201csync\u201d (non-streaming) call. What if you expect a long\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Basic LLMSynthesize","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2025\/02\/fig1-300x21.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2025\/02\/fig1-300x21.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2025\/02\/fig1-300x21.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3545,"url":"https:\/\/www.rangakrish.com\/index.php\/2024\/11\/09\/semantic-search-in-wolfram-mathematica\/","url_meta":{"origin":3381,"position":2},"title":"Semantic Search in Wolfram Mathematica","author":"admin","date":"November 9, 2024","format":false,"excerpt":"In an earlier article, I explained how to use OpenAI from Wolfram Mathematica ver 14.1. This latest release of Wolfram supports Semantic Search as well. In today\u2019s article, let me discuss this feature. As in the case of using LLMs, using Semantic Search requires an account with one of the\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Remedy Description","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/image1-300x225.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/image1-300x225.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/image1-300x225.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3050,"url":"https:\/\/www.rangakrish.com\/index.php\/2023\/03\/16\/building-a-xojo-app-to-interact-with-openai-api\/","url_meta":{"origin":3381,"position":3},"title":"Building a Xojo App to Interact with OpenAI API","author":"admin","date":"March 16, 2023","format":false,"excerpt":"A few weeks ago I registered with OpenAI to access its services through API and created a secret Key for my use. I then decided to build a simple application to try out the \u201cChat\u201d and \u201cCompletion\u201d models. Since I have several tools at my disposal (RAD Studio, LispWorks, Allegro\u2026","rel":"","context":"In &quot;OpenAI&quot;","block_context":{"text":"OpenAI","link":"https:\/\/www.rangakrish.com\/index.php\/category\/openai\/"},"img":{"alt_text":"Initial Screen","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/03\/Initial-Screen-300x232.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":348,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/09\/26\/computer-vision-with-mathematica\/","url_meta":{"origin":3381,"position":4},"title":"Computer Vision with Mathematica","author":"admin","date":"September 26, 2016","format":false,"excerpt":"Over the past several weeks, I have been discussing many interesting features of Mathematica. As a continuation, today, I would like to show some cool functionality in the domain of computer vision and machine learning. The function ImageIdentify[] tries to identify the object in the given image. According to the\u2026","rel":"","context":"In &quot;Machine Learning&quot;","block_context":{"text":"Machine Learning","link":"https:\/\/www.rangakrish.com\/index.php\/category\/machine-learning\/"},"img":{"alt_text":"A Truck","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/09\/truck-fig.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1541,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/04\/21\/textcontents-function-in-mathematica-12\/","url_meta":{"origin":3381,"position":5},"title":"TextContents[ ] Function in Mathematica 12","author":"admin","date":"April 21, 2019","format":false,"excerpt":"Mathematica 12 was released a few days ago.\u00a0 It has been over a year since version 11.3 came out in March 2018. The long wait appears justified since the new release boasts of numerous improvements and new features across several areas. You may want to read this blog post\u00a0by Stephen\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Importing Text File","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/04\/FileImport.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/04\/FileImport.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/04\/FileImport.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/3381","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=3381"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/3381\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=3381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=3381"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=3381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}