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.

I’ve met the same issue. Detailed dataset, detailed script for treating it.
When data is small and the script is hort, it works. But the limits are reached too soon.
In its environment, at the moment, gpt’s cannot handle useful applications directly.
If you’ve found a solution, please share.
Cheers

First, have you tried embedding the code snippets directly in the knowledge file? Sometimes, that can help the model understand what you want it to do.

Also, make sure your prompts are super specific. Instead of saying “calculate this”, say “use this exact code snippet to calculate this”.

And don’t forget to fine-tune your model with some examples! That can really help it learn how to use your code snippets correctly.

If you’re still having trouble, feel free to share more details and we can try to help you troubleshoot!