Develop AI apps with Java

This article contains an organized list of the best learning resources for Java developers who are getting started building AI apps. Resources include popular quickstart articles, reference samples, documentation, training courses, and so on.

Resources for Azure OpenAI Service

Azure OpenAI Service provides REST API access to OpenAI's powerful language models. These models can be easily adapted to your specific task including but not limited to content generation, summarization, image understanding, semantic search, and natural language to code translation. Users can access the service through REST APIs, the langchain4j-azure-open-ai package, or via the Azure AI Foundry portal.

Libraries and samples

Link Description
langchain4j-azure-open-ai Releases Maven package
langchain4j-azure-ai-search Releases Maven
langchain4j-document-loader-azure-storage-blob Releases Maven
Get started using GPT-35-Turbo and GPT-4 An article that walks you through creating a chat completion sample.
Completions A simple example demonstrating how to get completions for the provided prompt.
Streaming Chat Completions A simple example demonstrating how to use  streaming chat completions.
Switch from OpenAI to Azure OpenAI An article with guidance on the small changes you need to make to your code in order to swap back and forth between OpenAI and the Azure OpenAI Service.
OpenAI with Microsoft Entra ID Role based access control An article that looks at authentication using Microsoft Entra ID.
OpenAI with Managed Identities An article detailing more complex security scenarios that require Azure role-based access control (Azure RBAC). This document covers how to authenticate to your OpenAI resource using Microsoft Entra ID.
More Samples The Azure OpenAI service samples are a set of self-contained Java programs that demonstrate interacting with Azure OpenAI service using the client library. Each sample focuses on a specific scenario and can be executed independently.

Documentation

Link Description
Azure OpenAI Service Documentation The hub page for Azure OpenAI Service documentation.
Quickstart: Get started generating text using Azure OpenAI Service A quick set of instructions to set up the services you need and code you must write to prompt a model using Java.
Quickstart: Get started using GPT-35-Turbo and GPT-4 with Azure OpenAI Service Similar to the previous quickstart, but provides an example of system, assistant and user roles to tailor the content when asked certain questions.
Quickstart: Get started using GPT-35-Turbo and GPT-4 with Azure OpenAI Service in IntelliJ Similar to the first quickstart, but provides an example of system, assistant and user roles to tailor the content when asked certain questions using IntelliJ.
Quickstart: Chat with Azure OpenAI models using your own data Similar to the first quickstart, but this time you add your own data (like a PDF or other document).
Quickstart: Get started using Azure OpenAI Assistants (Preview) Similar to the first quickstart in this list, but this time you tell the model to use the built-in Python code interpreter to solve math problems step by step. This is a starting point to using your own AI assistants accessed through custom instructions.
Quickstart: Use images in your AI chats How to programmatically ask the model to describe the contents of an image.
Quickstart: Generate images with Azure OpenAI Service Programmatically generate images using Dall-E based on a prompt.

Resources for other Azure AI services

In addition to Azure OpenAI Service, there are many other Azure AI services that help developers and organizations rapidly create intelligent, market-ready, and responsible applications with out-of-the-box and prebuilt customizable APIs and models. Example applications include natural language processing for conversations, search, monitoring, translation, speech, vision, and decision-making.

Samples

Link Description
Integrate Speech into your apps with Speech SDK Samples A collection of samples for the Azure Cognitive Services Speech SDK. Links to samples for speech recognition, translation, speech synthesis, and more.
Extract structured data from forms, receipts, invoices, and cards using Form Recognizer in Java A collection of samples for the Azure.AI.FormRecognizer client library.
Extract, classify, and understand text within documents using Text Analytics in Java The client Library for Text Analytics is part of the Azure AI Language service, which provides Natural Language Processing (NLP) features for understanding and analyzing text.
Document Translation in Java A quickstart article that explains how to use Document Translation to translate a source document into a target language while preserving structure and text formatting.
Analyze images Sample code and setup documents for the Microsoft Azure AI Image Analysis SDK

Documentation

AI service Description API reference Quickstart
Content Safety An AI service that detects unwanted content. Content Safety API reference Quickstart
Document Intelligence Turn documents into intelligent data-driven solutions. Document Intelligence API reference Quickstart
Language Build apps with industry-leading natural language understanding capabilities. Language API reference Quickstart
Search Bring AI-powered cloud search to your applications. Search API reference Quickstart
Speech Speech to text, text to speech, translation, and speaker recognition. Speech API reference Quickstart
Translator Use AI-powered translation to translate more than 100 in-use, at-risk and endangered languages and dialects. Translator API reference Quickstart
Vision Analyze content in images and videos. Vision API reference Quickstart

Training

Link Description
Generative AI for Beginners Workshop Learn the fundamentals of building Generative AI apps with our 18-lesson comprehensive course by Microsoft Cloud Advocates.
Get started with Azure AI Services Azure AI Services is a collection of services that are building blocks of AI functionality you can integrate into your applications. In this learning path, you learn how to provision, secure, monitor, and deploy Azure AI Services resources and use them to build intelligent solutions.
Microsoft Azure AI Fundamentals: Generative AI Training path to help you understand how large language models form the foundation of generative AI: how Azure OpenAI Service provides access to the latest generative AI technology, how prompts and responses can be fine-tuned and how Microsoft's responsible AI principles drive ethical AI advancements.
Develop Generative AI solutions with Azure OpenAI Service Azure OpenAI Service provides access to OpenAI's powerful large language models such as ChatGPT, GPT, Codex, and Embeddings models. This learning path teaches developers how to generate code, images, and text using the Azure OpenAI SDK and other Azure services.

AI app templates

AI app templates provide you with well-maintained, easy to deploy reference implementations that provide a high-quality starting point for your AI apps.

There are two categories of AI app templates, building blocks and end-to-end solutions. Building blocks are smaller-scale samples that focus on specific scenarios and tasks. End-to-end solutions are comprehensive reference samples including documentation, source code, and deployment to allow you to take and extend for your own purposes.

To review a list of key templates available for each programming language, see AI app templates. To browse all available templates, see the AI app templates on the AI App Template gallery.