Need help - How to train openAI to create mapping rules?

Is there a way to train openAI with mapping rules and generate mapping rules for new fields?
#mapping

Welcome to the forum!

Can you give some examples of what you would like to do?

Thanks Foxabilo for the response.

Here is my input data, I would like to train openAI

Fields Mapping Rule
City New York, Atlanta, Orlondo, Seattle
Country USA
Language English
Currency Dollars

when I give this prompt: Create data mapping for New York

Expected Output:

City New York
Country USA
Language English
Currency Dollars

Is there a way to do this using via openai API in python?

Thanks,
Rahul

Yes, but this would be a bad use of AI, this can be done with traditional code and data manipulation methods for far less compute.

Is there a reason you wanted to use AI for this task?

You could ask ChatGPT to write the python to do exactly this and it should work fine.

This is the code ChatGPT created to solve your use case

# Define the data mapping
data_mapping = {
    "City": ["New York", "Atlanta", "Orlando", "Seattle"],
    "Country": "USA",
    "Language": "English",
    "Currency": "Dollars",
}

# Function to create data mapping for a given city
def create_data_mapping(city):
    if city in data_mapping["City"]:
        return {
            "City": city,
            "Country": data_mapping["Country"],
            "Language": data_mapping["Language"],
            "Currency": data_mapping["Currency"],
        }
    else:
        return "City not found in the data mapping."

# Test the function
print(create_data_mapping("New York"))

You should also note that it will not hallucinate an answer.

1 Like

Thanks Foxabilo for the inputs.

I understand we can solve this using traditional code in Python

The objective is to train model so that we can extract mapping rules using a text prompt ? This is for a data migration process which consists about 200 fields for 10 different databases.

We would like openai to train mapping rules for 1st database (e.g for New York) and when promopted generate mapping rules for other databases.

Thanks again

You could certainly show it examples of a mapping function as you did in your example for me and the AI would then attempt to replicate the example with the new data.

Simply give it the example and then say "Using the above example please build a similar mapping for this new data : your new data_

Getting this to function reliably and automatically via the API could be a fairly large undertaking.

we are trying to get this done via API. Can you please help how to do this?

This could potentially be done via the API, what is your experience level with programming and database systems?

I have a fair experience with various programming languages including html, python and databases such as db2,MySql, Elastic search

Ok, great! I don’t think you will need to do any training as the GPT-3.5 and GPT-4 models have a wide background knowledge and you can give the model prompts with examples for anything you may have issues with.

The documentation for the API can be found here :