UiPath Documentation
activities
latest
false

Integration Service activities

Last updated May 8, 2026

Generate Chat Completion

Description

Given a user prompt, this activity generates a chat completion response. The prompt can include both system instructions and user instructions, as well as task-specific parameters depending on the model setup in the NVIDIA NIM API.

How to use the activity in an agentic process

To use this activity in a Maestro agentic process, follow these steps:

  1. Open a new or existing agentic process.
  2. Add a service task element to the canvas and open the task's Properties panel.
  3. Name the service task Nvidia NIM Hello World.
  4. In the Implementation section, from the Action dropdown list, select Execute connector activity.
  5. Select the Nvidia NIM connector.
  6. Select an existing connection or create a new one. For more information, see Nvidia NIM authentication.
  7. From Activity, select Generate Chat Completion.
  8. For Model version, choose a model from the list of models available in the API endpoint provided under URL when the connector was created. The model version can be changed during the build and debug, and will be fixed to a process version when the automation is published.
  9. For Prompt text, use the expression editor to compose a prompt that includes both system instructions and the variables from your process that are needed for the model's task. For a brief connectivity check, a simple prompt such as "What can you do" is a good start.
  10. Connect the start event to the service task, and the service task to an end event node in the canvas.
  11. Select Debug to run this process. After a successful run, review the Global variables and look for the {:} response from the source: NVIDIA NIM hello world. Take note of the structure of the reply.

The agent's output must be assigned to a process variable so it can influence the progress of the Maestro process, for example to make a decision based on a boolean evaluation, or to use the answer from a classification task.

  1. In Design mode, select the agent from the design canvas.
  2. Select Properties.
  3. Under Output. Select + Add new
  4. Under Output, select Add new and add a variable of type String with the name agent_reponse.
  5. For Value: select Variable and examine the available output variables from the NIM agent. This is likely a string variable containing the complete model response.

Evaluating the output

Output that is aimed at humans, for example the reasons for an escalation, can be easily passed as natural text for the human. Output that is expected for an API/robot action must be strictly composed. Here is an example system / user prompt that yields a specific output from an agent. Use the Expression editor within Studio to add variables as needed.

"What is the quantity on inventory of Order ID " + vars.orderId_1 + "respond only with a JSON object with the quantity in the key Order_Quantity. No explanations, only JSON"
"What is the quantity on inventory of Order ID " + vars.orderId_1 + "respond only with a JSON object with the quantity in the key Order_Quantity. No explanations, only JSON"

The agent will reply with:

{"Order_Quantity":"100"}
{"Order_Quantity":"100"}

Pay special attention to types in your request to the agent and in the actual response. Even if the response looks like type JSON, it may actually be of type string.

  • Description
  • How to use the activity in an agentic process
  • Evaluating the output

Was this page helpful?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated