All Products
Search
Document Center

Alibaba Cloud Model Studio:Plug-in overview

Last Updated:Nov 27, 2024

You can integrate plug-ins with large language model (LLM) applications to enhance their functionality against complex tasks, such as obtaining the latest information, avoiding hallucinations, and perform precise calculations. Alibaba Cloud Model Studio provides the following official plug-ins: calculator, Python code interpreter, and image generation. You can also create custom plug-ins based on your business requirements.

How plug-ins work

After you enable the plug-in feature, the LLM assesses the need to call a plug-in based on the input query, plug-in name, and plug-in description.

  • If one or more plug-ins are needed, the LLM selects and calls the appropriate plug-ins. The output of the plug-ins is then merged with the query and re-entered into the LLM to generate a final response.

  • If no plug-in is needed, the LLM generates a response directly.

Supported models

Model

Name

Qwen-Turbo

qwen-turbo

Qwen-Plus

qwen-plus

Qwen-Max

qwen-max

Qwen2-57B-A14B-Instruct

qwen2-57b-a14b-instruct

Qwen2-72B-Instruct

qwen2-72b-instruct

Note

The Qwen2 models do not support the image generation plug-in. Refer to the actual execution results in the console for the latest compatibility status.

For more information about the models, see List of models.

Plug-ins

Official plug-ins

Name

Description

Billing

Python code interpreter

Allows the LLM to run Python code in tasks such as mathematical calculation, data analysis and visualization, and task processing.

Free

Calculator

Allows the LLM to perform complex mathematical operations, such as "12313 x 13232 = ?".

Free

Image generation

Allows the LLM to generate images from text prompts, such as "Please draw a smiling puppy."

Free for a limited time. You need to apply for the plug-in first.

Custom plug-ins

Apart from official plug-ins, you can also create custom plug-ins in Model Studio. For more information, see Create a custom plug-in.

Use plug-ins in the console

Prerequisites

An LLM application is created. For more information, see Build a private Q&A assistant without coding.

Procedure

  1. In the left-side navigation pane, choose Application Center > My Applications. Click Management of the desired application.image

  2. Click Select Plug-in. On the Select Plug-in panel, select one or more plug-ins on the Official Plug-in or Custom Plug-in tabs.image

    Note

    You can add up to 10 plug-ins for a single application.

  3. After you add one or more plug-ins, you can enter your queries in the input box, and the LLM can call the plug-ins to provide answers. In the following section, an application based on qwen-plus is used to showcase the official plug-ins.

Python code interpreter

Sample Input

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(-2, 2, 100)
y1 = np.sqrt(1 + x**2)
y2 = -np.sqrt(1 + x**2)

plt.plot(x, y1, label='y = sqrt(1 + x^2)')
plt.plot(x, y2, label='y = -sqrt(1 + x^2)')
plt.xlabel('x')
plt.ylabel('y')
plt.title('Hyperbola')
plt.legend()
plt.show()

Without plug-in

Without the plug-in, the application cannot execute Python code and can only offer a description.

python不插.jpeg

With plug-in

With the plug-in, the application can execute Python code and perform visual analytics on data.

python插.jpeg

The Python code interpreter plug-in does not support external network access or uploading local files. Available dependencies include json5~=0.9.6, jupyter_client~=8.1.0, ipykernel~=6.25.0, seaborn, sympy, pydantic~=1.10.8, pillow~=9.4.0, fastapi~=0.101.1, dynaconf~=3.2.1, oss2~=2.18.1, matplotlib, starlette~=0.27.0, uvicorn~=0.23.2, requests~=2.31.0, scipy, html2text, matplotlib, pandas, pdf2image, pdfminer-six, pillow, pypdf, python-pptx, seaborn, sympy, wordcloud.

Calculator

Sample Input

12313 x 13232 = ?

Without plug-in

The application cannot accurately solve the problem and may return incorrect answers. In this case, the correct answer is 162,925,616.

计算器错.jpeg

With plug-in

The application now has robust calculation capability and delivers the correct answer.

image

Image generation

Sample Input

Please draw a smiling puppy.

Without plug-in

The application cannot create visual content and can only provide textual descriptions.

image

With plug-in

The application can now create visual content and generates an image.

图文插.jpeg

Combining plug-ins

Alibaba Cloud Model Studio supports the use of multiple plug-ins within a single task. You can select plug-ins based on your requirements.

Use plug-ins through Assistant API

Alibaba Cloud Model Studio offers the Assistant API to facilitate rapid development of LLM applications by coding. For more information about how to call plug-ins through Assistant API, see Feature overview.