diff --git a/components/anthropic/actions/chat/chat.mjs b/components/anthropic/actions/chat/chat.mjs index 5a3d1dacf9e3a..64c4084290b68 100644 --- a/components/anthropic/actions/chat/chat.mjs +++ b/components/anthropic/actions/chat/chat.mjs @@ -1,20 +1,18 @@ import anthropic from "../../anthropic.app.mjs"; -import constants from "../common/constants.mjs"; export default { name: "Chat", - version: "0.2.0", + version: "0.2.1", key: "anthropic-chat", description: "The Chat API. [See the documentation](https://docs.anthropic.com/claude/reference/messages_post)", type: "action", props: { anthropic, model: { - label: "Model", - description: "Select the model to use for your query. Defaults to the latest Claude model - [see the documentation](https://docs.anthropic.com/en/docs/about-claude/models/overview) for more information", - type: "string", - options: constants.MESSAGE_MODELS, - default: constants.MESSAGE_MODELS[0].value, + propDefinition: [ + anthropic, + "model", + ], }, userMessage: { label: "User Message", diff --git a/components/anthropic/actions/common/constants.mjs b/components/anthropic/actions/common/constants.mjs deleted file mode 100644 index 954b8824a4c53..0000000000000 --- a/components/anthropic/actions/common/constants.mjs +++ /dev/null @@ -1,44 +0,0 @@ -export default { - MESSAGE_MODELS: [ - { - label: "Claude Opus 4.1", - value: "claude-opus-4-1-20250805", - }, - { - label: "Claude Opus 4", - value: "claude-opus-4-20250514", - }, - { - label: "Claude Sonnet 4", - value: "claude-sonnet-4-20250514", - }, - { - label: "Claude Sonnet 3.7", - value: "claude-3-7-sonnet-20250219", - }, - { - label: "Claude Sonnet 3.5 v2", - value: "claude-3-5-sonnet-20241022", - }, - { - label: "Claude Haiku 3.5", - value: "claude-3-5-haiku-20241022", - }, - { - label: "Claude Sonnet 3.5", - value: "claude-3-5-sonnet-20240620", - }, - { - label: "Claude Opus 3", - value: "claude-3-opus-20240229", - }, - { - label: "Claude Sonnet 3", - value: "claude-3-sonnet-20240229", - }, - { - label: "Claude Haiku 3", - value: "claude-3-haiku-20240307", - }, - ], -}; diff --git a/components/anthropic/anthropic.app.mjs b/components/anthropic/anthropic.app.mjs index 4624117312eb2..4ff937ef50fe0 100644 --- a/components/anthropic/anthropic.app.mjs +++ b/components/anthropic/anthropic.app.mjs @@ -1,9 +1,25 @@ import { axios } from "@pipedream/platform"; +const DEFAULT_MODEL = "claude-sonnet-4-5-20250929"; + export default { type: "app", app: "anthropic", - propDefinitions: {}, + propDefinitions: { + model: { + type: "string", + label: "Model", + description: "Select the model to use. [See the documentation](https://docs.anthropic.com/en/docs/about-claude/models/overview) for more information", + default: DEFAULT_MODEL, + async options() { + const response = await this.listModels(); + return response.data.map((model) => ({ + label: model.display_name, + value: model.id, + })); + }, + }, + }, methods: { _apiKey() { return this.$auth.api_key; @@ -23,6 +39,12 @@ export default { ...args, }); }, + listModels(args = {}) { + return this._makeRequest({ + path: "/models", + ...args, + }); + }, createMessage(args = {}) { return this._makeRequest({ path: "/messages", diff --git a/components/anthropic/package.json b/components/anthropic/package.json index 9f139df2a1452..84800585992ca 100644 --- a/components/anthropic/package.json +++ b/components/anthropic/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/anthropic", - "version": "0.2.0", + "version": "0.2.1", "description": "Pipedream Anthropic (Claude) Components", "main": "anthropic.app.mjs", "keywords": [