Skip to main content
Glama
generate-alt-text.ts1.85 kB
import { createAction, Property } from "@activepieces/pieces-framework"; import { altTextAiAuth } from "../common/auth"; import { httpClient, HttpMethod } from "@activepieces/pieces-common"; import { BASE_URL } from "../common/constants"; export const generateAltTextAction = createAction({ name: 'generate-alt-text', auth: altTextAiAuth, displayName: 'Generate Alt Text', description: 'Generates a descriptive alt text for a given image.', props: { image: Property.File({ displayName: 'Image', required: true }), keywords: Property.Array({ displayName: 'Keywords', required: false, description: 'keywords / phrases to be considered when generating the alt text.' }), negativeKeywords: Property.Array({ displayName: 'Negative Keywords', required: false, description: 'negative keywords / phrases to be removed from any generated alt text.' }), keywordSource: Property.LongText({ displayName: 'Keyword Source', required: false, description: 'Text to use as the source of keywords for the alt text.' }) }, async run(context) { const { image, keywords, keywordSource, negativeKeywords } = context.propsValue; const response = await httpClient.sendRequest({ method: HttpMethod.POST, url: BASE_URL + '/images', headers: { 'X-API-Key': context.auth.secret_text }, body: { image: { raw: image.base64 }, keywords, keyword_source: keywordSource, negative_keywords: negativeKeywords } }) return response.body; } })

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/activepieces/activepieces'

If you have feedback or need assistance with the MCP directory API, please join our Discord server