View as Markdown
Cohere icon

Cohere ACTION

Classify Text

This action makes a prediction about which label fits the specified text inputs best. See the documentation
  • Action
  • Writes data
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Cohere account once, then configure and run Classify Text from your backend or agent.

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: "cohere_platform-classify-text",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    cohere_platform: { authProvisionId: "apn_xxxxxxx" },
    inputs: ["Inputs"],
    model: "Model",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Classify Text inputs
Property Type Description
inputs Inputs string[]
Represents a list of queries to be classified, each entry must not be empty. The maximum is 96 inputs.
Required
model Model string
The identifier of the model. Currently available models are embed-multilingual-v2.0, embed-english-light-v2.0, and embed-english-v2.0 (default). Smaller light models are faster, while larger models will perform better. Fine-tuned models can also be supplied with their full ID.
Optional
preset Preset string
The ID of a custom playground preset. You can create presets in the playground. If you use a preset, all other parameters become optional, and any included parameters will override the preset's parameters.
Optional
truncate Truncate string
One of NONE|START|END to specify how the API will handle inputs longer than the maximum token length. Passing START will discard the start of the input. END will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. If NONE is selected, when the input exceeds the maximum input token length an error will be returned.
Optional
numExamples Number of Examples integer
To make a prediction, Classify uses provided examples of text + label pairs. Specify the number of examples to provide. Each example is a text string and its associated label/class. At least 2 unique labels must be provided and each label should have at least 2 different examples.
Required

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
cohere_platform-classify-text
Version
0.1.1
App
Cohere
Authentication
API key
Read-only
No
Destructive
No
Open world
Yes