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


