Generative Development Framework
GDF.ai
  • Intro to GDF-FSE
    • Generative AI, Large Language Models, ChatGPT?
    • Knowledge Areas
    • Access a Chat Based LLM
    • Why GDF?
    • Expectations
  • Limitations
  • Prompting
    • Prompt Patterns
    • Prompt Context
    • Prompt Stores
    • Prompt Operators
    • Prompt Chaining
  • Security
    • Protecting Data
    • Protecting Application Security
    • Protecting Intellectual Property
    • Protection Stores
    • AI Security Assessments and Penetration Testing
    • Social Engineering Testing with AI
  • Subject Knowledge Areas
    • Ideation
      • Identifying a Problem Statement
      • Plan and Prioritize Features
      • Develop User Stories
      • Requirement Gathering
      • Ideation Prompting
      • Ideation Template
    • Specification
      • Specifying Languages
      • Specifying Libraries
      • Specifying Project Structures
      • Specify Schemas
      • Specifying Elements
      • Specifying API Specs
    • Generation
      • Generating UI Elements
      • Generating Mock Data
      • Generating Schemas
      • Generating Parsers
      • Generating Databases
      • Generate Functions
      • Generate APIs
      • Generate Diagrams
      • Generating Documentation
    • Transformation
      • Converting Languages
      • Converting Libraries
    • Replacement
      • Replacing Functions
      • Replacing Data Types
    • Integration
      • Connecting UI Components
      • Connecting UI to Backend
      • Connecting Multiple Services Together
      • Connecting Cloud Infrastructure (AWS)
    • Separation
      • Abstraction
      • Model View Controller (MVC)
    • Consolidation
      • Combining UI Elements
      • Deduplicating Code Fragments
    • Templating
      • Layouts
      • Schemas
      • Project Structures
      • Content Management Systems
    • Visualization
      • General Styling
      • Visual Referencing
      • Visual Variations
    • Verification
      • Test Classes
      • Logging and Monitoring
      • Automated Testing
      • Synthetic Monitoring
    • Implementation
      • Infrastructure
      • DevOps / Deployment
    • Optimization
      • General Optimization
      • Performance Monitoring
      • Code Review
  • Guidance
    • Business Process
    • Regulatory Guidance
  • Generative Pipelines
  • Troubleshooting
    • Client Side Troubleshooting
    • Server Side Troubleshooting
    • Troubleshooting with AI
    • Documentation
    • Infrastructure Engineering
  • Terminology
Powered by GitBook
On this page

Was this helpful?

Export as PDF

Generative Pipelines

What generative pipelines are and how they used AI to automate processes

PreviousRegulatory GuidanceNextTroubleshooting

Last updated 3 months ago

Was this helpful?

The concept of generative pipelines references the integration of generative services with other inputs and outputs, including application services, hardware, human beings, or just about anything you can think of. For example, let's review a customer complaint process within our bicycle rental application. Where a customer tried to withdraw funds, but the customer is reporting there was a system outage for a week, called customer 12 times, and was still unable to withdraw their money. A generative pipeline could automate that review process to:

  • Consume your of which customer communications qualify as a complaint

  • Analyze the customer complaint and return a recommendation based actions you permit your AI to perform on your behalf.

  • Use that recommendation to update other systems in your organization through APIs.

  • Use APIs to communicate out to the customer the status of their complaint.

can make your prompts much more efficient.

Here's a sample implementation that connects ChatGPT, Salesforce, and Twilio as part of the complaint resolution process:

const axios = require("axios");
const fs = require("fs");

// ChatGPT: Get AI-generated response and recommended action
async function getChatGptResponse(complaintText) {
  const rules = "your_business_logic(best provided in if/then format)";
  const acceptableActions = "refund, apologize, escalate"
  const apiKey = "your_openai_api_key";
  const prompt = `Analyze the following customer complaint based on the rules provided and provide a recommended action of the one of the following actions: "${acceptableActions}". Complaint: "${complaintText}". Only return recommended action.`;

  const response = await axios.post(
    "https://api.openai.com/v1/engines/davinci-codex/completions",
    {
      prompt: prompt,
      max_tokens: 100,
      n: 1,
      stop: null,
      temperature: 0.7,
    },
    {
      headers: {
        "Content-Type": "application/json",
        Authorization: `Bearer ${apiKey}`,
      },
    }
  );

  const aiResponse = response.data.choices[0].text.trim();
  const recommendedAction = parseRecommendedAction(aiResponse);
  return { aiResponse, recommendedAction };
}

// Parse the recommended action from the AI-generated response
function parseRecommendedAction(aiResponse) {
  const possibleActions = ["refund", "apologize, escalate"];
  let recommendedAction = "";

  possibleActions.forEach((action) => {
    if (aiResponse.toLowerCase().includes(action)) {
      recommendedAction = action;
    }
  });

  return recommendedAction;
}

// Main complaint resolution process
async function resolveComplaint(complaintText, customerId, chargeId) {
  const { aiResponse, recommendedAction } = await getChatGptResponse(complaintText);
  const caseId = await createSalesforceCase({ Subject: complaintText, CustomerId: customerId });
  const emailContent = aiResponse;

  if (recommendedAction === "refund") {
    const refundAmount = calculateRefundAmount(chargeId);
    await issueRefund(chargeId, refundAmount);
    emailContent += `\n\nWe have issued a refund of ${refundAmount} to your account.`;
  }

  await sendEmail(customerId, "Complaint Resolution", emailContent);
}

In this example, we first call the getChatGptResponse function, which sends the customer complaint text to the ChatGPT API and receives an AI-generated response and recommended action. Based on the recommended action, we can create a case in Salesforce using the createSalesforceCase function, issue a refund with the issueRefund function (if necessary), and finally send an email to the customer using the sendEmail function.

Please note that you'll need to replace the placeholders like "your_openai_api_key" with your actual API keys, and implement the parseRecommendedAction function to extract the recommended action from the AI-generated response according to your specific use case.

business logic
Prompt stores