Call a text generation large model

Updated at:

1. Introduction

Note

Prerequisites: None

This component lets you call text generation large models, such as those from OpenAI, to perform single-turn conversation tasks.

2. Inputs

Note

See the help text for each input in the component panel of the visual editor.

3. Outputs

Note

See the help text for each output in the component panel of the visual editor.

4. Usage example

4.1. Configuration

  1. For api_key, enter the model invocation key. You can get this key from the model's platform. We recommend storing it as a variable.

  2. For base_url, enter the model service endpoint. For example, the endpoint for the Qwen series of large models is https://dashscope.aliyuncs.com/compatible-mode/v1.

  3. For model, enter the name of the model to use. For example, to use qwen-plus, enter qwen-plus.

  4. For System Prompt, define the model's overall behavior by assigning it a role, a task, or a required output format. For example: "You are a math expert. Provide the solution steps and the result in the correct format."

  5. For User Prompt, enter the specific question or instruction for the model, such as "Calculate 1+1."

  6. For Input Content Format, select the format of your input content.

  7. For Streaming Output, this component does not currently support streaming output.

  8. Keep the default values for Advanced Options.

4.2. Execution result

image

5. Flow example

5.1. Build the flow

  1. Use the Read Asset Variable component to read the value of the api_key variable set in Asset Management in the RPA Console.

  2. Use the Get Project Parameter Panel Information component to get the value of the msg_to parameter. This flow uses the parameter to send an AI-generated New Year's greeting to specified contacts on DingTalk.

    image

  3. Use the Split String to List component to split the parameter value into a list of recipients, using a comma as the delimiter.

  4. Use the Get Window component to get the DingTalk window object.

  5. Use the Activate Window component to activate the DingTalk window.

  6. Use the Loop List Content component to iterate through the recipient list.

  7. Use the Input Hotkey component to press Ctrl+Shift+F to open the search box in DingTalk.

  8. Use the (Simulate) Type Text component to enter the recipient's name.

  9. Use the Delay component to add a 1-second delay.

  10. Use the Input Hotkey component to press Enter.

  11. Use the Call Text Generation Large Model component to generate a greeting for the recipient.

  12. Use the Get Element Count (CV) component to get the number of UI elements captured by Computer Vision (CV).image

  13. Use the Conditional Branch component to check if the output of the Get Element Count (CV) component is 1. If so, the flow sends the message; otherwise, it skips to the next recipient in the list.

  14. Use the Click Element (CV) component to click the message input box in the contact's chat window.

    image

  15. Use the (Simulate) Type Text component to type the content generated by the large model.

  16. Use the Delay component to add a 2-second delay.

  17. Use the Click Element (CV) component to click the Send button.

    image

image

5.2. Execution result

The flow sends an AI-generated message to the specified contacts in DingTalk, as shown below.

imageimage