Unanswerable Udf Generation
LangChain Hub prompt: spapicchio/unanswerable-udf_generation
Create a User-Defined Function (UDF) executable in SQL using the given table schema. The output should be structured in JSON format. The UDF must not be as obvious as the percentage. The UDF name must be different from existing columns to avoid any confusion with column names and should not contain any overlapping names or prefixes with the column names. The semantic of the UDF must be different from the semantic of each column.
The table schema given as input contains each column's types and sample elements. The "udf_name" contains the call of the user-defined function with the column names separated by commas.
Steps
- Analyze the Table Schema: Understand the provided table schema.
- Design the UDF: Create a hypothesis for the function using some of the columns available in the schema.
- Describe the UDF: Write a clear description of what the UDF intends to achieve.
Output Format
The output should be a JSON object with the following structure:
- udf_name: A descriptive and relevant name for the User-Defined Function with the called columns. The names of the columns are enclosed within backticks to avoid SQL errors.
- udf_description: A detailed explanation of the function's intended operations.
- udf_output_type: the output data type of the UDF. It can be "categorical" or "numerical".
The output must also contain the Python code that executes the logic of the UDF. The python code is enclosed in python after the JSON.
Generate at most the num of examples given as input, each separated by "# New UDF"
Example:
New UDF
{{
"udf_name": "calculate_interest_rate(`Age`, `Income`, `Credit_score`)",
"udf_description": "This UDF attempts to calculate a score based on the 'age', 'income', and 'credit_score' columns.",
"udf_output_type": "numerical"
}
def calculate_interest_rate(account_id, customer_id, balance, credit_score, loan_history):
interest_rate = (balance * 0.05) + (credit_score * 0.02) - (loan_history * 0.01)
return interest_rate
Notes
- Ensure the python syntax is precise and executable for valid hypothetical values.
- As input you will also get the number of UDF to generate
Num to generate {num_to_generate} Table Schema: {tbl_schema}
How to Use
Use with LangChain: hub.pull("spapicchio/unanswerable-udf_generation")
Related Prompts
More prompts in Coding & Development
This Prompt Ads Sequential Function Calling To Models Other Than GPT 0613
This prompt ads sequential function calling to models other than GPT-0613
Create a personalized workout routine
Tailor a workout routine specifically designed for individual fitness goals
GODMODE CHEATCODE
God Writes You a Letter Today. This is will help you find the perfect Bible Scripture that will guide you through a current problem you're facing.
Creating a Personal Finance Tracker with [Technology/Tool]
Learn to create a personal finance tracker using [Technology/Tool]. Get code samples and budgeting tips.
Build an entire application using bubble.io with ChatGPT4
Build an entire app with bubble.io, assisted by chatGPT4, that knows bubble very well and is accurate 95% of the time. This prompt will help you maximize the quality of chatGPT assistance. Having detailed and step-by-step instructions is essential to progress fast with Bubble. This initial prompt will help you get started on a good basis. Follow it because I will make it even better.
Become LawyerGPT
Are you in a legal bind? This prompt can help you gain knowledge about how to handle your legal proceedings. DISCLAIMER: Please meet with a real lawyer to discuss your options.