練習:試用已部署的模型
在此練習中,您會使用自然語言,在完成遊樂場中與 Azure OpenAI 部署進行互動。
您可能熟悉使用自然語言生成式 AI 的 ChatGPT 之類的應用程式,但您可以針對聊天機器人以外使用這些模型。 讓我們探索這些模型的其他實用應用程式。
注意
若要完成此練習,您需要下列各項:
- Azure 訂用帳戶。 免費建立一個。
- 在所需的 Azure 訂用帳戶中存取 Azure OpenAI。 目前,只會透過應用程式授與此服務的存取權。 完成此表單以申請 Azure OpenAI 的存取權:https://aka.ms/oai/access。
- 已部署模型的 Azure OpenAI 資源。 如需模型部署的詳細資訊,請參閱 建立和部署 Azure OpenAI 服務資源。
讓我們開始吧,開啟 Azure OpenAI 補全測試平台,然後選取模型部署。
擷取資訊
在此範例中,您將了解如何使用包含範例文字和指令的提示來擷取資訊。
將下列文字複製並貼到 [完成] 文字方塊中:
Extract the person's name, company name, location, and phone number from the text below. Hello. My name is Robert Smith. I'm calling from Contoso Insurance, Delaware. My colleague mentioned that you are interested in learning about our comprehensive benefits policy. Could you give me a call back at (555) 346-9322 when you get a chance so we can go over the benefits?選取 [產生]。 您的輸出應該類似於下列文字:
Person: Robert Smith Company: Contoso Insurance Location: Delaware Phone: (555) 346-9322
在此範例中,您已結合提示與資料,以使用自然語言指示擷取資訊。 模型會從文字中擷取名稱、公司、位置和電話號碼。
注意
您可以修改提示和來源資料,以擷取不同的資訊。
擷取輸入並格式化輸出
在下一個練習中,您會要求大型語言模型 (LLM) 將文字組織成資料表,其中顯示 LLM 能夠產生並格式化文字。
清除完成文字方塊。 然後貼上下列文字:
There are many fruits that were found on the recently discovered planet Goocrux. There are neoskizzles that grow there, which are purple and taste like candy. There are also loheckles, which are a grayish blue fruit and are very tart, a little bit like a lemon. Pounits are a bright green color and are more savory than sweet. There are also plenty of loopnovas which are a neon pink flavor and taste like cotton candy. Finally, there are fruits called glowls, which have a very sour and bitter taste which is acidic and caustic, and a pale orange tinge to them. Please make a table summarizing the fruits from Goocrux | Fruit | Color | Flavor | | Neoskizzles | Purple | Sweet | | Loheckles | Grayish blue | Tart |選取 [產生]。 您的輸出應該類似於下列文字:
| Fruit | Color | Flavor | | Neoskizzles | Purple | Sweet | | Loheckles | Grayish blue | Tart | | Pounits | Bright green | Savory | | Loopnovas | Neon pink | Cotton candy | | Glowls | Pale orange | Sour/Bitter |
在此範例中,模型會以所需的輸出格式進行準備:標頭資料列和幾個範例。
請嘗試不同的格式設定:JSON
如果您提供一些文字,LLM 可以產生資料表,但您也可以要求 LLM 以 JSON 格式傳回資料。
清除完成文字方塊。 然後貼上下列文字:
There are many fruits that were found on the recently discovered planet Goocrux. There are neoskizzles that grow there, which are purple and taste like candy. There are also loheckles, which are a grayish blue fruit and are very tart, a little bit like a lemon. Pounits are a bright green color and are more savory than sweet. There are also plenty of loopnovas which are a neon pink flavor and taste like cotton candy. Finally, there are fruits called glowls, which have a very sour and bitter taste which is acidic and caustic, and a pale orange tinge to them. Please make a table summarizing the fruits from Goocrux, Also make a JSON array summarizing the fruits from Goocrux. | Fruit | Color | Flavor | | Neoskizzles | Purple | Sweet | | Loheckles | Grayish blue | Tart |選取 [產生]。 您的輸出應該類似於下列文字:
| Loopnovas | Neon pink | Cotton candy | | Glowls | Pale orange | Sour/Bitter | ` { "fruits": [ { "fruit": "Neoskizzles", "color": "Purple", "flavor": "Sweet" }, { "fruit": "Loheckles", "color": "Grayish blue", "flavor": "Tart" }, { "fruit": "Pounits", "color": "Bright green", "flavor": "Savory" }, { "fruit": "Loopnovas", "color": "Neon pink", "flavor": "Cotton candy" }, { "fruit": "Glowls", "color": "Pale orange", "flavor": "Sour/Bitter" } ]
在此範例中,模型會以 JSON 格式傳回水果的 JSON 陣列及其屬性。 請記住,LLM 可以同時提供您想要的「內容」和想要的「方式」。
分類內容
在此練習中,您會使用 LLM 將內容排序為不同的類別。
清除完成文字方塊。 然後貼上下列文字:
Classify the following news headline into 1 of the following categories: Business, Tech, Politics, Sport, Entertainment Headline 1: Donna Steffensen Is Cooking Up a New Kind of Perfection. The internet's most beloved cooking guru has a buzzy new book and a fresh new perspective. Category: Entertainment Headline 2: Major Retailer Announces Plans to Close Over 100 Stores. Category:選取 [產生]。 您的輸出應該類似於下列文字:
Headline 2: Major Retailer Announces Plans to Close Over 100 Stores Category: Business
您提供了標題和類別的一個範例,並要求模型分類第二個範例。 此範例示範單次學習。 只要有一個範例,模型就可以進行一般化來分類新的範例。
注意
您可以變更第二個標題以產生不同的類別。 以下是您可以嘗試的一些範例標題:
- Jets 又輸了!
- 歐巴馬宣布競選連任
- Microsoft 股價在盤後交易中上漲
- 20 奈米製程提供更高密度和更好的功率值
摘要內容
如果您想要快速理解較長文字區塊的意義,則摘要內容可能會很有幫助。 這項功能內建於 LLM 中。
清除完成文字方塊。 然後貼上下列文字:
At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there's magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks. TL;DR選取 [產生]。 您的輸出應該類似於下列文字:
At the intersection of monolingual text, audio or visual sensory signals, and multilingual capabilities lies the "XYZ-code," a joint representation allowing for the transfer of learning in AI systems, according to Microsoft's Xuedong Huang. The CTO of Azure AI Services said the company's aim is to create pre-trained models that will enable machines to jointly learn representations and support a broad range of downstream AI tasks.
在此範例中,您已使用 TL;DR (太長;未讀取) 讓模型建立較大文字片段的簡短摘要。
產生新內容
即使輸出是根據定型資料中類似內容的頻率來產生,但生成式 AI 模型仍能產生不存在的新內容。
清除完成文字方塊。 然後貼上下列文字:
Write a limerick about the Python programming language選取 [產生]。 您的輸出應該類似於下列文字:
There once was a language named Python Whose syntax was easy and quite fun It could handle big data And was used by NASA So learn it and you'll be second to none!
打油詩如何? 如果您不喜歡它,您隨時都可以使用藍色圓形箭號圖示來要求完成遊樂場產生新的打油詩。