By JV Roig
Welcome to part 3 in this series of generative AI deployment approaches on Alibaba Cloud.
In part 1 of this series, we tackled IaaS (Infrastructure as a Service) genAI deployments, using Elastic Compute Service (ECS)
In part 2, we tackled PaaS (Platform as a Service) genAI deployments, using Platform for AI (PAI). Compared to the entire journey in part 1, PAI provided a much easier (and faster!) experience getting a usable generative AI endpoint – and immediately production-grade as well.
Today, we’ll tackle the MaaS (Model as a Service) approach, using Alibaba Cloud Model Studio.
Log in to your Alibaba Cloud web console, and then search for Model Studio. Click the result that appears (Alibaba Cloud Model Studio).
If this is your first time, just go ahead and activate Model Studio. Follow the on-screen instructions that will appear when you first enter the Model Studio console.
On the upper right-hand corner, hover over the user icon, then click API-KEY in the pop-up menu that appears:
Click the Create API Key button:
A new API Key will be added to the table. Click View under the Actions column to display the API Key in full in order to copy-paste it to your application or environment variable.
It is good practice to keep your API key secret. If your API key is accidentally leaked (e.g., you left it in public code), you should DELETE that API key and create a new one.
Go back to the Model Studio home page. Click “Model Gallery” on the left sidebar.
The available models will be listed in the Model Gallery. For this example, let’s choose Qwen-Max. Under Qwen-Max, click Try.
The Model Experience page will open. You can add another model to try beside Qwen-Max. For this test, choose Qwen-Plus:
(Above: Qwen-Max and Qwen-Plus both checked)
Type a message into the chat box and press enter. You’ll see both models answer simultaneously, with Qwen-Max being slower (because it is much bigger) than Qwen-Plus:
You will need your API key from earlier.
In the Model Gallery page, there is an API Call Example link under each model, which will display sample code to help you use the model in your own applications:
At the top right you’ll also see an API Call Documentation button that will open the official API documentation for Model Studio models.
Just like that, we’re already ready to start integrating genAI features into our applications through Model Studio.
First, we need to install the Alibaba Cloud Model Studio SDK. We’ll use Python in our example, so let’s install the Alibaba Cloud Model Studio SDK for Python through pip:
pip install dashscope
Here’s sample code I created, also from the samples and documentation directly provided in the Model Studio console:
It’s the same inference example we’ve been using since Part 1! And here’s sample output when I run that Python code:
As we’d expect by now, our LLM responds like a pirate thanks to our system prompt, and is giving us suggestions for our sailing-based vacation thanks to our question.
And that’s it! That’s how easy and simple it is to get started with generative AI using Model Studio.
The best part? Everything is immediately production-grade, and performance and scalability isn’t our problem. All of that is handled by Model Studio for us.
And unique to Model Studio, unlike our IaaS and PaaS genAI deployments, we now enjoy per-token billing. Instead of paying a per-hour rate for the instances we deploy in ECS or PAI, we just pay for the actual tokens we consume. For the actual pricing, consult the official documentation here: https://www.alibabacloud.com/help/en/model-studio/developer-reference/billing-for-tongyiqianwen
ABOUT THE AUTHOR: JV is a Senior Solutions Architect in Alibaba Cloud PH, and leads the team's data and generative AI strategy. If you think anything in this article is relevant to some of your current business problems, please reach out to JV at jv.roig@alibaba-inc.com.
3 posts | 0 followers
FollowRegional Content Hub - September 18, 2024
Daniel Molenaars - April 12, 2024
Alibaba Cloud Community - November 10, 2023
Alibaba Cloud Community - August 30, 2024
Alibaba Cloud Philippines - August 6, 2024
Alibaba Cloud Community - May 9, 2024
3 posts | 0 followers
FollowTop-performance foundation models from Alibaba Cloud
Learn MoreAccelerate innovation with generative AI to create new business success
Learn MoreAccelerate AI-driven business and AI model training and inference with Alibaba Cloud GPU technology
Learn MoreA platform that provides enterprise-level data modeling services based on machine learning algorithms to quickly meet your needs for data-driven operations.
Learn MoreMore Posts by Alibaba Cloud Philippines
Santhakumar Munuswamy August 26, 2024 at 5:11 am
Thank for sharing