Execute python function in custom GPT

I’m working on creating a custom GPT model for performing calculations on a given dataset. I’ve created a knowledge file with detailed instructions on how the actions should be carried out. While the custom GPT sometimes produces the desired results based on these instructions, there are instances where it generates incorrect or suboptimal code, leading to incorrect outcomes. To address this issue, I’ve attempted to pass code examples as part of the knowledge files (as .py file) and instructed the GPT to exclusively use the provided code snippets. However, I’m encountering difficulties with the GPT not loading my provided code.
Has anyone been successful in passing Python code to a custom GPT model, ensuring that it utilizes the provided code effectively?

My first guess is that the instructions are too involved/detailed which is why you’re not getting consistent results.

Might try putting all code samples in just a text file or something? My gut is saying you’re trying to get it to do too much in one go, though.