# Chat — Google PaLM

> Chat using Google PaLM. See the docs here

- Key: `google_palm_api-chat`
- Type: Action (Write)
- Version: 0.0.3
- App: Google PaLM (`google_palm_api`) — https://pipedream.com/apps/google-palm-api.md
- This page (HTML): https://pipedream.com/apps/google-palm-api/actions/chat
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/google_palm_api/actions/chat/chat.mjs

## Description

Chat using Google PaLM. [See the docs here](https://developers.generativeai.google/api/python/google/generativeai/chat)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `promptText` | `string` | Yes | The text to be used as a prompt for the chat |
| `previousMessages` | `string[]` | No | The previous messages in the chat. If provided, will override the chat history |
| `temperature` | `string` | No | The temperature to use for the chat. Values can range from [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied and creative, while a value closer to 0.0 will typically result in more straightforward responses from the model. Defaults to 0.5 |
| `context` | `string` | No | Text that should be provided to the model first, to ground the response |
| `candidateCount` | `integer` | No | The maximum number of generated response messages to return. This value must be between [1, 8], inclusive. If unset, this will default to 1. Note: Only unique candidates are returned. Higher temperatures are more likely to produce unique candidates. Setting temperature=0.0 will always return 1 candidate regardless of the candidate_count. |
| `topK` | `string` | No | The API uses combined nucleus and top-k sampling. top_k sets the maximum number of tokens to sample from on each step. |
| `topP` | `string` | No | The API uses combined nucleus and top-k sampling. top_p configures the nucleus sampling. It sets the maximum cumulative probability of tokens to sample from. For example, if the sorted probabilities are [0.5, 0.2, 0.1, 0.1, 0.05, 0.05] a top_p of 0.8 will sample as [0.625, 0.25, 0.125, 0, 0, 0]. Typical values are in the [0.9, 1.0] range. |
| `maxOutputTokens` | `integer` | No | Maximum number of tokens to include in a candidate. Must be greater than zero. If unset, will default to 64. |
| `stopSequences` | `string` | No | A set of up to 5 character sequences that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. |
| `harmCategories` | `string[]` | No | To set safety settings, select the harm categories to set a threshold for Options are loaded from the connected account. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "google_palm_api",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "google_palm_api-chat",
  arguments: {
    promptText: "Prompt Text",
    previousMessages: ["Previous Messages"],
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "google_palm_api-chat",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_palm_api: { authProvisionId: "apn_xxxxxxx" },
    promptText: "Prompt Text",
    previousMessages: ["Previous Messages"],
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "google_palm_api-chat",
    "configured_props": {
      "google_palm_api": { "authProvisionId": "apn_xxxxxxx" },
      "promptText": "Prompt Text",
      "previousMessages": ["Previous Messages"]
    }
  }'
```

---

- App: https://pipedream.com/apps/google-palm-api.md · All apps: https://pipedream.com/apps
