From 240694fa3261da46c1d1a92c254901b105da95cc Mon Sep 17 00:00:00 2001
From: Krista Pratico Both have the end-goal of applying artificial intelligence (AI) to enhance business operations, though how each provides this in the respective offerings is different.. Generally, the audiences are different: \\\\n Use Azure AI services when you: Use other machine-learning solutions when you: Machine learning is a concept where you bring together data and an algorithm to solve a specific need..Once the data and algorithm are trained, the output is a model that you can use again with different data..The trained model provides insights based on the new data.. The process of building a machine learning system requires some knowledge of machine learning or data science.. Machine learning is provided using Azure Machine Learning (AML) products and services.. An Azure AI service provides part or all of the components in a machine learning solution: data, algorithm, and trained model..These services are meant to require general knowledge about your data without needing experience with machine learning or data science..These services provide both REST API(s) and language-based SDKs..As a result, you need to have programming language knowledge to use the services.. title: Azure AI services and Machine Learning\\\\ntitleSuffix: Azure AI services\\\\ndescription: Learn where Azure AI services fits in with other Azure offerings for machine learning.\\\\nservices: cognitive-services\\\\nmanager: nitinme\\\\nauthor: aahill\\\\nms.author: aahi\\\\nms.service: cognitive-services\\\\nms.topic: conceptual\\\\nms.date: 10/28/2021 Azure AI services provides machine learning capabilities to solve general problems such as analyzing text for emotional sentiment or analyzing images to recognize objects or faces..You don't need special machine learning or data science knowledge to use these services../what-are-ai-services.md\\\\\\\">Azure AI services is a group of services, each supporting different, generalized prediction capabilities..The services are divided into different categories to help you find the right service.. How is Azure Cognitive Search related to Azure AI services? Azure Cognitive Search is a separate cloud search service that optionally uses Azure AI services to add image and natural language processing to indexing workloads. Azure AI services is exposed in Azure Cognitive Search through built-in skills that wrap individual APIs. You can use a free resource for walkthroughs, but plan on creating and attaching a billable resource for larger volumes. Each service provides information about your data. You can combine services together to chain solutions such as converting speech (audio) to text, translating the text into many languages, then using the translated languages to get answers from a knowledge base. While Azure AI services can be used to create intelligent solutions on their own, they can also be combined with traditional machine learning projects to supplement models or accelerate the development process. Azure AI services that provide exported models for other machine learning tools: How are Azure AI services different from machine learning?. Azure AI services provide a trained model for you..This brings data and an algorithm together, available from a REST API(s) or SDK..An Azure AI service provides answers to general problems such as key phrases in text or item identification in images.. Machine learning is a process that generally requires a longer period of time to implement successfully..This time is spent on data collection, cleaning, transformation, algorithm selection, model training, and deployment to get to the same level of functionality provided by an Azure AI service..With machine learning, it is possible to provide answers to highly specialized and/or specific problems..Machine learning problems require familiarity with the specific subject matter and data of the problem under consideration, as well as expertise in data science.. Azure AI services, as a group of services, can require none, some, or all custom data for the trained model.. Services that provide a fully-trained model can be treated as a opaque box..You don't need to know how they work or what data was used to train them.. Some services allow you to bring your own data, then train a model..This allows you to extend the model using the Service's data and algorithm with your own data..The output matches your needs..When you bring your own data, you may need to tag the data in a way specific to the service..For example, if you are training a model to identify flowers, you can provide a catalog of flower images along with the location of the flower in each image to train the model..These services process significant amounts of model data.. The following data categorizes each service by which kind of data it allows or requires.. 1 Personalizer only needs training data collected by the service (as it operates in real-time) to evaluate your policy and data.. The services are used in any application that can make REST API(s) or SDK calls..Examples of applications include web sites, bots, virtual or mixed reality, desktop and mobile applications.\\\", \\\"id\\\": null, \\\"title\\\": \\\"Azure AI services and machine learning\\\", \\\"filepath\\\": \\\"cognitive-services-and-machine-learning.md\\\", \\\"url\\\": \\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\", \\\"metadata\\\": {\\\"chunking\\\": \\\"orignal document size=1734. Scores=3.1447978 and None.Org Highlight count=66.Filtering to highlight size=891\\\"}, \\\"chunk_id\\\": \\\"4\\\"}], \\\"intent\\\": \\\"[\\\\\\\"What are the differences between Azure Machine Learning and Azure AI services?\\\\\\\"]\\\"}\",\n",
+ " \"end_turn\": false\n",
+ " }\n",
+ " ]\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ " ]\n",
+ "}\n"
+ ]
+ }
+ ],
+ "source": [
+ "completion = openai.ChatCompletion.create(\n",
+ " messages=[{\"role\": \"user\", \"content\": \"What are the differences between Azure Machine Learning and Azure AI services?\"}],\n",
+ " deployment_id=\"gpt-4\",\n",
+ " dataSources=[ # camelCase is intentional, as this is the format the API expects\n",
+ " {\n",
+ " \"type\": \"AzureCognitiveSearch\",\n",
+ " \"parameters\": {\n",
+ " \"endpoint\": os.environ[\"SEARCH_ENDPOINT\"],\n",
+ " \"key\": os.environ[\"SEARCH_KEY\"],\n",
+ " \"indexName\": os.environ[\"SEARCH_INDEX_NAME\"],\n",
+ " }\n",
+ " }\n",
+ " ]\n",
+ ")\n",
+ "print(completion)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "If you would prefer to stream the response from the model, you can pass the `stream=True` keyword argument:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Context: {\n",
+ " \"messages\": [\n",
+ " {\n",
+ " \"role\": \"tool\",\n",
+ " \"content\": \"{\\\"citations\\\":[{\\\"content\\\":\\\" Both have the end-goal of applying artificial intelligence (AI) to enhance business operations, though how each provides this in the respective offerings is different.. Generally, the audiences are different:How are Azure AI services and Azure Machine Learning (AML) similar?.
\\\\n\\\\n
Convert speech into text and text into natural-sounding speech..Translate from one language to another and enable speaker verification and recognition.. \\\\n\\\\n\\\\n \\\\nVision \\\\nRecognize, identify, caption, index, and moderate your pictures, videos, and digital ink content.. \\\\n\\\\n
\\\\n\\\\n
\\\\nWhat is machine learning?.
\\\\nWhat is an Azure AI service?.
\\\\n
\\\\n
\\\\nAzure AI services and machine learning
\\\\n\\\\n\\\\n
\\\\n \\\\n\\\\n\\\\nService category \\\\nPurpose \\\\n\\\\n \\\\nDecision \\\\nBuild apps that surface recommendations for informed and efficient decision-making.. \\\\n\\\\n \\\\nLanguage \\\\nAllow your apps to process natural language with pre-built scripts, evaluate sentiment and learn how to recognize what users want.. \\\\n\\\\n \\\\nSearch \\\\nAdd Bing Search APIs to your apps and harness the ability to comb billions of webpages, images, videos, and news with a single API call.. \\\\n\\\\n \\\\nSpeech \\\", \\\"id\\\": null, \\\"title\\\": \\\"Azure AI services and machine learning\\\", \\\"filepath\\\": \\\"cognitive-services-and-machine-learning.md\\\", \\\"url\\\": \\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\", \\\"metadata\\\": {\\\"chunking\\\": \\\"orignal document size=1188. Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 0/Highlights=63 of size=526\\\"}, \\\"chunk_id\\\": \\\"0\\\"}, {\\\"content\\\": \\\"How can you use Azure AI services?
\\\\n\\\\n\\\\n
\\\\n\\\\n \\\\n\\\\n\\\\nAzure AI service \\\\nModel information \\\\n\\\\n \\\\n\\\\nCustom Vision \\\\nExport for Tensorflow for Android, CoreML for iOS11, ONNX for Windows ML \\\\nLearn more
\\\\n\\\\n
\\\\nNext steps
\\\\n\\\\n
\\\", \\\"id\\\": null, \\\"title\\\": \\\"Azure AI services and machine learning\\\", \\\"filepath\\\": \\\"cognitive-services-and-machine-learning.md\\\", \\\"url\\\": \\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\", \\\"metadata\\\": {\\\"chunking\\\": \\\"orignal document size=793. Scores=3.3767838 and None.Org Highlight count=69.\\\"}, \\\"chunk_id\\\": \\\"3\\\"}, {\\\"content\\\": \\\"What kind of data do you have?.
\\\\nNo additional training data required
\\\\nSome or all training data required
\\\\nService requirements for the data model
\\\\n\\\\n\\\\n
\\\\n\\\\n \\\\n\\\\n\\\\nAzure AI service \\\\nNo training data required \\\\nYou provide some or all training data \\\\nReal-time or near real-time data collection \\\\n\\\\n \\\\nLanguage Understanding (LUIS) \\\\n\\\\n x \\\\n\\\\n \\\\n \\\\nPersonalizer1 \\\\nx \\\\nx \\\\nx \\\\n\\\\n \\\\n\\\\nVision \\\\nx \\\\n\\\\n \\\\n Where can you use Azure AI services?.
\\\\nHow are Azure AI services and Azure Machine Learning (AML) similar?.
\\\\n\\\\n
Convert speech into text and text into natural-sounding speech..Translate from one language to another and enable speaker verification and recognition.. \\\\n\\\\n \\\\n\\\\nVision \\\\nRecognize, identify, caption, index, and moderate your pictures, videos, and digital ink content.. \\\\n
Use Azure AI services when you:
\\\\nUse other machine-learning solutions when you:
\\\\nMachine learning is a concept where you bring together data and an algorithm to solve a specific need..Once the data and algorithm are trained, the output is a model that you can use again with different data..The trained model provides insights based on the new data..
\\\\nThe process of building a machine learning system requires some knowledge of machine learning or data science..
\\\\nMachine learning is provided using Azure Machine Learning (AML) products and services..
\\\\nAn Azure AI service provides part or all of the components in a machine learning solution: data, algorithm, and trained model..These services are meant to require general knowledge about your data without needing experience with machine learning or data science..These services provide both REST API(s) and language-based SDKs..As a result, you need to have programming language knowledge to use the services..
\\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=1188. Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 1/Highlights=67 of size=506\\\"},\\\"chunk_id\\\":\\\"1\\\"},{\\\"content\\\":\\\"title: Azure AI services and Machine Learning\\\\ntitleSuffix: Azure AI services\\\\ndescription: Learn where Azure AI services fits in with other Azure offerings for machine learning.\\\\nservices: cognitive-services\\\\nmanager: nitinme\\\\nauthor: aahill\\\\nms.author: aahi\\\\nms.service: cognitive-services\\\\nms.topic: conceptual\\\\nms.date: 10/28/2021
\\\\nAzure AI services provides machine learning capabilities to solve general problems such as analyzing text for emotional sentiment or analyzing images to recognize objects or faces..You don't need special machine learning or data science knowledge to use these services../what-are-ai-services.md\\\\\\\">Azure AI services is a group of services, each supporting different, generalized prediction capabilities..The services are divided into different categories to help you find the right service..
\\\\nService category | \\\\nPurpose | \\\\n|||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Decision | \\\\nBuild apps that surface recommendations for informed and efficient decision-making.. | \\\\n|||||||||||||||||||
Language | \\\\nAllow your apps to process natural language with pre-built scripts, evaluate sentiment and learn how to recognize what users want.. | \\\\n|||||||||||||||||||
Search | \\\\nAdd Bing Search APIs to your apps and harness the ability to comb billions of webpages, images, videos, and news with a single API call.. | \\\\n|||||||||||||||||||
Speech | \\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=1188. Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 0/Highlights=63 of size=526\\\"},\\\"chunk_id\\\":\\\"0\\\"},{\\\"content\\\":\\\"
Azure AI service | \\\\nModel information | \\\\n
---|---|
Custom Vision | \\\\nExport for Tensorflow for Android, CoreML for iOS11, ONNX for Windows ML | \\\\n
How are Azure AI services different from machine learning?.
\\\\nAzure AI services provide a trained model for you..This brings data and an algorithm together, available from a REST API(s) or SDK..An Azure AI service provides answers to general problems such as key phrases in text or item identification in images..
\\\\nMachine learning is a process that generally requires a longer period of time to implement successfully..This time is spent on data collection, cleaning, transformation, algorithm selection, model training, and deployment to get to the same level of functionality provided by an Azure AI service..With machine learning, it is possible to provide answers to highly specialized and/or specific problems..Machine learning problems require familiarity with the specific subject matter and data of the problem under consideration, as well as expertise in data science..
\\\\nAzure AI services, as a group of services, can require none, some, or all custom data for the trained model..
\\\\nServices that provide a fully-trained model can be treated as a opaque box..You don't need to know how they work or what data was used to train them..
\\\\nSome services allow you to bring your own data, then train a model..This allows you to extend the model using the Service's data and algorithm with your own data..The output matches your needs..When you bring your own data, you may need to tag the data in a way specific to the service..For example, if you are training a model to identify flowers, you can provide a catalog of flower images along with the location of the flower in each image to train the model..These services process significant amounts of model data..
\\\\nThe following data categorizes each service by which kind of data it allows or requires..
\\\\nAzure AI service | \\\\nNo training data required | \\\\nYou provide some or all training data | \\\\nReal-time or near real-time data collection | \\\\n
---|---|---|---|
Language Understanding (LUIS) | \\\\n\\\\n | x | \\\\n\\\\n |
Personalizer1 | \\\\nx | \\\\nx | \\\\nx | \\\\n
Vision | \\\\nx | \\\\n\\\\n | \\\\n |
1 Personalizer only needs training data collected by the service (as it operates in real-time) to evaluate your policy and data..
\\\\nThe services are used in any application that can make REST API(s) or SDK calls..Examples of applications include web sites, bots, virtual or mixed reality, desktop and mobile applications.\\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=1734. Scores=3.1447978 and None.Org Highlight count=66.Filtering to highlight size=891\\\"},\\\"chunk_id\\\":\\\"4\\\"}],\\\"intent\\\":\\\"[\\\\\\\"What are the differences between Azure Machine Learning and Azure AI services?\\\\\\\"]\\\"}\",\n", + " \"end_turn\": false\n", + " }\n", + " ]\n", + "}\n", + "assistant: Azure AI services and Azure Machine Learning (AML) both aim to apply artificial intelligence (AI) to enhance business operations, but they target different audiences and offer different capabilities [doc1]. \n", + "\n", + "Azure AI services are designed for developers without machine learning experience and provide pre-trained models to solve general problems such as text analysis, image recognition, and natural language processing [doc5]. These services require general knowledge about your data without needing experience with machine learning or data science and provide REST APIs and language-based SDKs [doc2].\n", + "\n", + "On the other hand, Azure Machine Learning is tailored for data scientists and offers a platform to build, train, and deploy custom machine learning models [doc1]. It requires knowledge of machine learning or data science and allows users to choose the algorithm and train on very specific data [doc2].\n", + "\n", + "In summary, Azure AI services offer pre-trained models for developers without machine learning experience, while Azure Machine Learning is a platform for data scientists to build and deploy custom machine learning models." + ] + } + ], + "source": [ + "response = openai.ChatCompletion.create(\n", + " messages=[{\"role\": \"user\", \"content\": \"What are the differences between Azure Machine Learning and Azure AI services?\"}],\n", + " deployment_id=\"gpt-4\",\n", + " dataSources=[\n", + " {\n", + " \"type\": \"AzureCognitiveSearch\",\n", + " \"parameters\": {\n", + " \"endpoint\": os.environ[\"SEARCH_ENDPOINT\"],\n", + " \"key\": os.environ[\"SEARCH_KEY\"],\n", + " \"indexName\": os.environ[\"SEARCH_INDEX_NAME\"],\n", + " }\n", + " }\n", + " ],\n", + " stream=True,\n", + ")\n", + "\n", + "for chunk in response:\n", + " delta = chunk.choices[0].delta\n", + "\n", + " if \"role\" in delta:\n", + " print(\"\\n\"+ delta.role + \": \", end=\"\", flush=True)\n", + " if \"content\" in delta:\n", + " print(delta.content, end=\"\", flush=True)\n", + " if \"context\" in delta:\n", + " print(f\"Context: {delta.context}\", end=\"\", flush=True)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.0" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +}