Unlock the potential of OpenAI's generative AI models within your Alteryx workflows with the OpenAI Connector. Whether you are looking to automate personalized content creation, analyze customer feedback, or reach international audiences with translated messages, this powerful tool empowers you to seamlessly integrate OpenAI's advanced AI capabilities into your Alteryx processes. Say goodbye to manual tasks and welcome a new era of efficiency and innovation. Join the ranks of forward-thinking professionals who are harnessing the power of the OpenAI Connector to transform their workflows and achieve their goals across various domains.
Note: This is an experimental tool that we would like you to play with and explore, especially if you have never used ChatGPT or OpenAI. It can be found in the Laboratory tool palette, following the installation of the .yxi file. You can download the .yxi file on the Gallery here. See installation instructions below in Appendix A.
The OpenAI Connector empowers Alteryx users to leverage the power of generative AI within Designer, eliminating the need to switch platforms. You can formulate prompts with your data, query the OpenAI API, and integrate the results directly into your workflow. (We recommend that you have your legal team review the OpenAI data usage policy here.)
Before we actually get into how to use the OpenAI Connector, we first need to talk about data prep.
Generative AI models like OpenAI’s ChatGPT are queried through a prompt. This prompt tells the model what kind of response we are targeting. The OpenAI Connector leverages two of the completion modes offered by OpenAI: Text Completion and Chat Completion. Both modes need a prompt in order for a model to generate a response.
With Text Completion, the API completes a given prompt. You provide a text prompt, and AI generates a continuation or completion of the text, making it suitable for tasks like content generation, answering questions, or summarizing text.
Chat Completion is specifically designed for generating human-like conversations. Because of this, and its utilization of newer models when compared with Text Completion, it often generates richer responses. And with current OpenAI pricing, as of July 2023, it can both be cheaper and better than several of the Text Completion models. However, Text Completion is valuable when the smallest and cheapest models like Ada and Babbage are sufficient.
In order to use the OpenAI Connector properly, we need to structure our data in a way that simulates a conversation. For example, below is a picture of some sample customer demographic data.
Given the structure of our data, we can use a Formula tool to construct our prompt that we will send into the OpenAI Connector. Create a field in Designer that creates a single prompt per row. For this example, we are adding context into our existing fields so that the model we choose has context with the data and not just the data itself. For most use cases, you can formulate a prompt as a question or command.
In the above example for row 1, the Formula tool will produce this prompt:
Customize this sale pitch: “Check out our Valentines day sale on Clothes” for a customer whose name is Jack, age is 41, marital status is Married, and is interested in Mountain Biking.
When prompting OpenAI, you should consider these main points:
We also recommend reading up on Prompt Design on OpenAI’s Documentation.
After we have prepared our prompt, we can shift to the Configuration of the tool. The config window is shown below:
To run this tool, you will need to have an OpenAI account as well as your own API Key. Head over to platform.openai.com/signup to create a free account, get access to your free credits, and create your unique API Key. Once you’ve created your API key, be sure to save it in a safe place, as it will be required for you to run the OpenAI Connector.
Next, you will need to store your OpenAI API key in your Alteryx Data Connection Manager. This will ensure that your API key is properly encrypted and handled securely. See Appendix B below for a detailed walk-through of how to set up your DCM Connection.
Please note that in order to run, the OpenAI Connection tool will need to be able to use your OpenAI API key to call the OpenAI API completion endpoints through your organization’s firewall.
First, select the Completion Type you want to run. Aside from the reasons given above to choose Chat Completion or Text Completion, cost must be considered. You will get a handful of free credits upon creating an account, but once you use up your credits, this tool will cause charges to be applied to your account. The summary of pricing can be found here.
The completion mode you select will determine what Algorithm (model) you can select to run your prompt against. As of writing this article, the best models are
gpt-4 for Text Completion and Chat Completion respectively. Since the chat model
gpt-3.5-turbo is 10% the price per token of
text-davinci-003, 30% to 60% the price per token of
gpt-4, and it performs at a similar capability to
text-davinci-003, it is recommended for most cases.
With the speed that OpenAI has been pushing out models, we feel there is a high chance more models may be released under the Chat Completion category. If that happens, you can enter in the new models that come out under the Enter a Different Algorithm field. Be careful though, anything typed into that field will take precedence over the algorithm you select in the dropdown.
Here is a response from the aforementioned models when sent the prompt above:
We know how special this Valentines day is for you and your loved one and wanted to let you know about the special sales we've got going on at our store. You will find a great range of stylish clothes for that perfect touch to a romantic evening. If you crave for adventure, don't forget to check out our great collection of mountain biking apparel and accessories. So make the most of this Valentines day and avail our special discounts. Happy Shopping!”
“Hey Jack! Hope you're doing well. With Valentine's Day right around the corner, we've got the perfect sale for you! Our apparel and clothing line is on sale just in time for the holiday. Being married, you probably want to get something special for your significant other, right? Well, we've got you covered! Our mountain biking clothing line is perfect for adventure-lovers like yourself and your spouse. You can both enjoy new and stylish clothes while hitting the trails. Take advantage of our amazing prices this Valentine's Day and shop now!”
“Hey Jack! As a 41-year-old adventure-loving, mountain biking enthusiast, we know just how important it is to have the right clothing when you're out there conquering those trails. That's why we're so excited to share our special Valentine's Day sale on clothes, perfect for you and your lovely spouse!
Since you appreciate the outdoors with your significant other, we've curated a fantastic collection of clothing that offers style, comfort, and functionality to support your shared hobbies and connect you even further as a couple.
Our variety includes athletic wear, jackets, and accessories that not only cater to your mountain biking passion but can also be worn for those festive Valentine's date nights. Plus, with our sweetheart discounts, you can grab something for both yourself and your spouse without breaking the bank!
Don't miss out on looking great while tackling the slopes together. Check out our Valentine's Day sale on clothes and find the perfect pieces to take your mountain biking experience – and your bond with your spouse – to new heights!”
As we can see, the more recently introduced models like
gpt-4 produce more natural and sophisticated language than the older
text-davinci-003 is still pretty good! For your use case, you will want to experiment with the different models to see where you want to fall on the performance vs. cost tradeoff.”
Use the Temperature Value, Max Tokens, and Advanced Options inputs to make a customized call to OpenAI.
Temperature Value: Dictate how deterministic the responses will be. The lower the value the more focused and conservative the responses will be, while the higher the value the more creative and varied the responses will be. For prompts where there is only one answer, like math problems, a lower Temperature Value is better. For prompts that are more open ended, like “write me a poem,” a higher Temperature Value might be more suitable.
Max Tokens: Maximum number of tokens that should be generated in a request. If you are expecting a lengthy response, it might be wise to increase the Max Tokens parameter. Similarly, decrease the Max Tokens parameter
for a shorter response. However, decreasing it too much may result in a truncated response. Specifying that you want a short response in your prompt would help to prevent that from occurring.
Advanced Options: Modify additional parameters for Text Completion and Chat Completion. Note that you should not use the prompt or model keys as an Advanced Option, as those are already taken care of by the tool configuration.
Our aspiration is to empower you to seamlessly integrate the remarkable capabilities of OpenAI's models into your Designer Desktop workflows, so we have created an accessible and customizable tool for you to experiment with. Give it a whirl and share your experiences using the OpenAI Connector in the comments section below!
Once you have downloaded the ”OpenAI Connector.yxi” installer, double-click the .yxi file, and then select Install.
Once you have installed the tool, please restart Designer Desktop. (This is required for the new DCM Connection schema to be recognized.) You should then see the OpenAI Connector tool in your Laboratory tool palette!
1. Tell Designer to allow SDK tools (such as OpenAI Connector) to use the Data Connection Manager (you should only have to do this once):
a. After restarting Designer Desktop, first go to Options → User Settings → Edit User Settings:
b. Select the DCM tab along the top of the User Settings window. Check the Enable DCM box and then set the SDK Access Mode set to AllowAll:
2. Set up a DCM Connection using your OpenAI API key (you should also only have to do this once, unless your key changes):
a. Choose the “Save/Update API Key in DCM” button in the OpenAI Connector configuration panel:
b. Click the “New” button (in versions of Designer before 23.1, this was called “Add Data Source”):
For Designer before 23.1:
c. Give your Data Source a name you will find helpful in identifying it, and then select Save:
d. Click the + Connect Credential link:
e. Either choose a pre-existing API token or choose Create New Credential and enter your OpenAI API key in the API TOKEN drop down. Then click the Link button.
f. Return to the Data Sources page (link on the left of the window above) to confirm that your Data Source has been created:
3. Now, any time you pull an OpenAI Connector tool onto the Designer Desktop canvas, when you select Save / Update API Key in DCM, you will be able to choose the connection you made:
and then select Connect to tell the tool to use that OpenAI API key for your OpenAI Connector queries to OpenAI:
Your tool should remember this connection unless you re-open the Save/Update API Key in DCM button and change it, or unless you delete the tool.
You are now set up to configure the tool for pinging OpenAI!
Note: Important information regarding the Python SDK v2 has come to our attention. It has been observed that this version may cause errors for users, particularly affecting the OpenAI Connector tool. If you encounter the 'Internal Error: Failed to read port assignment' message, our Python SDK team has provided some guidance for resolving this issue:
1. Firstly, attempt to resolve the problem by removing the .shiv folder from your home directory and then reinstalling the tool the yxi (note that the .shiv folder will be regenerated the first time the tool runs, which may slightly affect performance but should not cause any disruptions).
2. Alternatively, you can try deleting the tool from either C:\Users\YOURUSERNAME\AppData\Roaming\Alteryx\Tools or C:\ProgramData\Alteryx\Tools, depending on whether it was installed for your user account or for all users. Afterward, reinstall the tool from the yxi.
3. If you have administrative permissions, consider installing the tool for all users, not just for yourself. To achieve this, you may need to open Designer in admin mode.
During internal troubleshooting with our team, we have identified that beyond the above steps, the issue might be related to network settings on your computer. Rest assured, we are actively working on finding effective approaches to help you diagnose and resolve such network-related problems.
We apologize for any inconvenience this may have caused and appreciate your understanding as we work to address these issues. Should you need further assistance, please don't hesitate to comment below.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.