UiPath Documentation
activities
latest
false
Integration Service activities

Generate Message

Generate Message activity in the Anthropic Claude connector.

Description​

Given a prompt, generates a message response using the Anthropic Claude Messages API (/v1/messages). Supports plain text, multi-turn conversations, and multimodal inputs.

Project compatibility​

Windows | Cross-platform

Configuration​

  • Connection - The connection established in Integration Service. Access the dropdown menu to choose, add, or manage connections.
  • Model - The Claude model to use for generating the response.
  • Prompt - The prompt for Claude to use when generating the response.
  • Max Tokens - The maximum number of tokens allowed for the generated response. Maximum value is 100,000. Default value is 256.

Advanced​

Options​

  • System prompt - A system prompt provides context and instructions to Claude, such as specifying a particular goal or role. This is an optional field.
  • Top P - A number between 0 and 1. The lower the number, the fewer tokens are considered. Defaults to 0.7.
  • Top K - Used to remove "long tail low probability responses". Only sample from the top K options for each subsequent token.
  • Temperature - The amount of randomness injected into the response. Accepted values are between 0 and 1.

Output​

  • Response - The full message object returned by the API.
  • Generated text - The text of the top-choice response generated by Claude.

Frequently asked questions​

What prompt formats are supported?​

In addition to plain text, the Generate Message activity supports structured conversational and multimodal inputs.

Multiple conversational turns​

Pass an array of messages to simulate a multi-turn conversation:

[
  {"role": "user", "content": "Hello, Claude"},
  {"role": "assistant", "content": "Hello!"},
  {"role": "user", "content": "Can you describe LLMs to me?"}
]
[
  {"role": "user", "content": "Hello, Claude"},
  {"role": "assistant", "content": "Hello!"},
  {"role": "user", "content": "Can you describe LLMs to me?"}
]
Putting words in Claude's mouth​

Pre-fill the assistant's reply to guide the response format:

[
  {
    "role": "user",
    "content": "What is latin for Ant? (A) Apoidea, (B) Rhopalocera, (C) Formicidae"
  },
  {
    "role": "assistant",
    "content": "The answer is ("
  }
]
[
  {
    "role": "user",
    "content": "What is latin for Ant? (A) Apoidea, (B) Rhopalocera, (C) Formicidae"
  },
  {
    "role": "assistant",
    "content": "The answer is ("
  }
]
Multimodal input (image + text)​

Option 1: Base64-encoded image

"messages": [
  {
    "role": "user",
    "content": [
      {
        "type": "image",
        "source": {
          "type": "base64",
          "media_type": "<IMAGE_MEDIA_TYPE>",
          "data": "<IMAGE_BASE64>"
        }
      },
      {
        "type": "text",
        "text": "What is in the above image?"
      }
    ]
  }
]
"messages": [
  {
    "role": "user",
    "content": [
      {
        "type": "image",
        "source": {
          "type": "base64",
          "media_type": "<IMAGE_MEDIA_TYPE>",
          "data": "<IMAGE_BASE64>"
        }
      },
      {
        "type": "text",
        "text": "What is in the above image?"
      }
    ]
  }
]

Option 2: URL-referenced image

{
  "role": "user",
  "content": [
    {
      "type": "image",
      "source": {
        "type": "url",
        "url": "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg"
      }
    },
    {
      "type": "text",
      "text": "What is in the above image?"
    }
  ]
}
{
  "role": "user",
  "content": [
    {
      "type": "image",
      "source": {
        "type": "url",
        "url": "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg"
      }
    },
    {
      "type": "text",
      "text": "What is in the above image?"
    }
  ]
}

For more details, refer to the Anthropic Messages API documentation.

  • Description​
  • Project compatibility​
  • Configuration​
  • Advanced​
  • Options​
  • Output​
  • Frequently asked questions​
  • What prompt formats are supported?​

Was this page helpful?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated