import fetch from 'node-fetch';
const payload = {
"input_prompt": "Your job is to categorize chat conversations with an AI assistant into JSON structured data about the user and message. \n\nBased on the user\u2019s response, categorize the conversation into the following fields:\n1. user - information about the user such as their name, organization, field, orgsize (organization size) and industry. \n2. ai_use_cases - their use cases for A.I.\n3. ai_concerns - their concerns around A.I. \n\nExample JSON format: \n{\n \"user\": {\n \"name\": \"Ravi\",\n \"organization\": \"Gooey.ai\",\n \"field\": \"Programmer\",\n \"orgsize\": \"10\u201d,\n \u201cindustry\u201d:\u201dtechnology\u201d\n },\n \"ai_use_cases\": \"Data Insights\",\n \"ai_concerns\": \"Bias in AI\"\n}\n\n[Guidelines] \nLimit values for user.industry to: \n1. Education\n2. Healthcare\n3. Agriculture\n4. Climate\n5. Technology\n6. eCommerce\n7. Government\n8. Consulting\n9. Social Impact\n10. Other\n\nLimit values for ai_use_cases to:\nTaskAutomation\nCustomerSupport\nDataInsights\nOther\n\nLimit values for ai_concerns to:\nJobLoss\nDataPrivacy\nBiasInAI\nOther\n\nFocus solely on the user's input messages for categorization and information extraction, not on the assistant\u2019s response. \n\nIf the user\u2019s input message is a greeting such as \u201cHi\u201d or \u201cHello\u201d, return: \n{ \"message\": \"greeting\" }\n\nIf the user's messages do not fit into any predefined categories or don\u2019t contain any relevant information mentioned above, return:\n{ \"message\": \"no_meta_data\" }\n\n[Example Conversation + Analysis pairs]\nConversation: \n\"\"\"\nassistant: Hello! I'm the People+AI bot. At People+AI, our mission is to bring together a diverse group of people and ideas to shape the future of AI that benefits all people. Can you please share your name? \nuser: Hi\t\n\"\"\"\nAnalysis: { \"message\": \"greeting\" }\n\nConversation: \"\"\"\n\tassistant: Hello! I'm the People Plus A.I. bot. Our mission is to bring together a diverse group of people and ideas to shape the future of A.I. that benefits all people.Can you please share your name?\n\tuser: Tanvi\n\"\"\"\nAnalysis: {\"user\": {\u201cname\u201d:\u201dTanvi\u201d}}\n\nConversation: \"\"\"\n assistant: Hi Ravi, it's great to connect! Can you please share your field of work and the organization that you are associated with?\n\tuser: I work at Gooey.AI as a programmer\n\"\"\"\nAnalysis: {\"user\": {\u201corganization\u201d: \u201cGooey.AI\u201d, \u201cfield\u201d:\u201dprogrammer\u201d}}\n\nConversation: \"\"\"\n assistant: What sector does Gooey.AI fall under?\n\tuser: We fall under Technology sector\n\"\"\"\nAnalysis: {\"user\": {\u201cindustry\u201d:\u201dtechnology\u201d}}\n\nConversation: \"\"\"\n\tassistant: Thanks, Sean. Let's brainstorm together! What's a use case or persona at your workplace that will benefit from an A.I. solution?\n\tuser: To answer user questions in my website.\n\"\"\"\nAnalysis: {\u201cai_use_cases\u201d:\u201dCustomerSupport\u201d}\n\nConversation: \"\"\"\n\tassistant: Thanks for your answer, Ravi. Next, What's do you think is the use case at your workplace that will benefit from an A.I. solution?\n\tuser: We want to AI to remove our daily manual tasks like attendance logging\n\"\"\"\nAnalysis: {\u201cai_use_cases\u201d:\u201dTaskAutomation\u201d}\n\nConversation: \"\"\"\n \tassistant: That sounds exciting! AI chatbots indeed have the potential to revolutionize customer service by providing instant responses and 24/7 support. But, what are your concerns about AI in your field of work as a programmer?\n\tuser: I don\u2019t want to give out private information on what I\u2019m working on.\n\"\"\"\nAnalysis: {\u201cai_concerns\u201d:\u201dDataPrivacy\u201d}\n\nConversation: \"\"\"\n\tassistant: {{ assistant_msg }}\n \tuser: {{ user_msg }}\n\"\"\"\nAnalysis:",
"selected_models": [
"gpt_3_5_turbo"
]
};
async function gooeyAPI() {
const response = await fetch("https://api.gooey.ai/v2/CompareLLM?example_id=5uj1kli6", {
method: "POST",
headers: {
"Authorization": "bearer " + process.env["GOOEY_API_KEY"],
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
if (!response.ok) {
throw new Error(response.status);
}
const result = await response.json();
console.log(response.status, result);
}
gooeyAPI();