liveBook · Manning

Azure OpenAI

As explained in Microsoft Azure in Action

Azure OpenAI Service is an Azure service that provides access to hosted OpenAI generative AI models through managed APIs and endpoints.

A bookshop wants to suggest titles from customer reviews and summarize new arrivals. Azure OpenAI Service gives its applications access to hosted large language models that generate human-like text. A deployed model provides an endpoint the application can call. section 7.1 section 7.6

Choose a model for the job, not just the biggest one. A smaller model may suit quick suggestions; a larger one may suit a detailed summary but take longer and cost more. Models can read only a limited amount of text at once, so long inputs may need summarizing, chunking, or retrieval. Test speed, cost, and quality before production use. section 7.1

C:/> az cognitiveservices account create --name banningBooksOpenAI 
--resource-group BanningRG --kind OpenAI --sku S0 --location westus --yes

Create an Azure OpenAI resource in a resource group with the Azure CLI. section 7.1

C:/> az cognitiveservices account deployment create 
--resource-group BanningRG --name banningBooksOpenAI 
--deployment-name book-recommender --model-name gpt-4o 
--model-version 2024-08-06 --model-format OpenAI 
--sku-name Standard --sku-capacity 1

Deploy a named model to that resource; the deployment name identifies the model an application will call. section 7.1 section 7.6

Recommend books from a review

A customer praises the dystopian setting and social commentary in 1984. The prompt asks for three similar books with brief descriptions. To send it, use the resource endpoint, deployment name, API version, and API key in an az rest request; request settings include a response-length limit and temperature. section 7.1

C:/> az rest --method post --url "${ENDPOINT}openai/deployments/${DEPLOYMENT_NAME}/completions?
api-version=${API_VERSION}" --headers "api-key=${API_KEY}" 
"Content-Type=application/json" --body "{\"prompt\": \"${PROMPT}\",
\"max_tokens\": 150, \"temperature\": 0.7, \"n\": 1}"

The POST request shows how az rest sends the prompt and settings to the deployed model’s completions API. section 7.1

How Microsoft Azure in Action covers it

How deep it goes
Walks through resource creation, model deployment, and an API request; leaves production integration at practical guidance.
Examples
Uses an 1984 customer review to request three similar books, alongside Azure CLI deployment and API-call examples.
What it assumes
Introduces model size and text limits with analogies, while CLI commands assume an existing Azure resource group.
What you can do after
Operate/configure it with Azure CLI to create a resource, deploy a model, and send a prompt using az rest.
How it connects
Connects natural language processing, large language models, prompts, chunking, retrieval, and recommendation engines.

Also explained in

Compare how 3 books explain Azure OpenAI →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microsoft Azure in Action. The section links point to the parts of the book it draws on.