Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.6 KB
Raw Blame
import { createAction, Property } from "@activepieces/pieces-framework";
import { SiteSpeakAuth } from "../common/auth";
import { makeRequest } from "../common/client";
import { HttpMethod } from "@activepieces/pieces-common";
import { chatbotIdDropdown } from "../common/dropdown";

export const createFinetune = createAction({
  auth: SiteSpeakAuth,
  name: 'create_finetune',
  displayName: 'Create Finetune',
  description: 'Adds a new fine-tune (question + suggested answer) for the specified chatbot in SiteSpeakAI.',
  audience: 'both',
  aiMetadata: {
    description:
      'Creates a fine-tune entry on a SiteSpeakAI chatbot, pairing a question with a suggested answer so the bot responds that way in future. Use to teach a bot a specific Q&A. Not idempotent: each call appends a new fine-tune even if the same question already exists.',
    idempotent: false,
  },
  props: {
    chatbotId: chatbotIdDropdown,
    question: Property.LongText({
      displayName: 'Question',
      required: true,
      description: 'The question text you want the chatbot to be able to answer.',
    }),
    suggestedAnswer: Property.LongText({
      displayName: 'Suggested Answer',
      required: true,
      description: 'The answer you suggest the chatbot use for that question.',
    }),
  },
  async run({ auth, propsValue }) {
    const body = {
      question: propsValue.question,
      suggested_answer: propsValue.suggestedAnswer,
    };

    const response = await makeRequest(
      auth.secret_text,
      HttpMethod.POST,
      `/${propsValue.chatbotId}/finetunes`,
      body
    );

    return response;
  },
});