Anyone familiar with examples / previous work where Custom ChatGPT code generation has been shaped by rules/specifications of some flavor?

Hi, is anyone familiar with examples / previous work where Custom ChatGPT code generation has been shaped by rules/specifications of some flavor? Note, I’m not trying to provide code that I want ChatGPT to use, but am trying to provide hints on how it should generate its code solutions.

I’m working through a code generation/ execution challenge for a Custom GPT. I am experimenting with a Custom GPT to analyze trail running data (GPX files). I’m at a stage where I’m trying to improve the reliability of its instructed “computation” steps. Computation in this case means when the Custom GPT takes its configured instructions and generates code and then executes it in the Code Interpreter. This can be a lengthy iterative process with ChatGPT and its Code Interpreter (when ChatGPT code errors force retries and sometimes failure).

I’m currently evaluating whether code rules and code samples can benefit this Custom GPT. I’m still evaluating the efficacy of these approaches - anecdotally some positive feedback, but still inconclusive. The code samples I provide to ChatGPT are code that ChatGPT successfully produced in previous sessions analyzing trail running data.

My goal is not to provide code to this Custom GPT but to provide high-level coding hints: pseudo-code, specification, etc, that ChatGPT can use to auto-complete and help it side-step many of the time-consuming pitfalls it encounters.

Thank you for any thoughts.

DETAILS:

Example of trail route processing instructions that I’ve tested:

  1. Examine all the GPX points in the route. Filter out duplicate GPX points - A GPX point that has the same geolocation and timestamp as another point is a duplicate of it. Remove one of the duplicate points.
  2. Go through all the GPX points and place them into 100 geospatial trail segments. Each trail segment should be disjoint - does not geospatially overlap with another trail segment. You may think of each trail segment as a “bin” of continguous geolocated GPX points.
  3. Take all of the GPX points within each trail segment and calculate the standard deviation of the pace, the mean pace, and the standard deviation of the elevation for all points within each trail segment.
  4. Compute a technical rating for each segment by multiplying the standard deviation of both the pace and the elevation for its points and subtracting the mean pace.

Example of a Python code instruction set that I’ve tested:

  1. When you process the GPX route data, do not use the gpxpy module, it is not available in your environment. Proceed with the analysis using alternative methods.

  2. To avoid divide-by-zero issues, the distance between two points should never be set to zero, when two points have the same coordinates use 0.0001 meters.

  3. Read the Python code in CODE_SAMPLES.txt in your knowledgebase. Use the examples there to help you guide your code choices.

Hi, I have some weeks of experience with traing my GPTS to use our framework to generate action code for web apps. The scrips are in fact just T-SQL. But we train the GPTS to use it within the context of our framework where several hundreds of sptored procedures exist. We make the GPTS aware of these procedures by describing them accurately. We also provide the context information and then at last some expected code eamples based on user promps. It is important to be concise in the instructions and create a training document to train the AI.

1 Like

Thank you!

It sounds like I should try something like below. Simple, short instructions to ChatGPT on what it should do. Then in a separate training document in the knowledge base locate a description of the algorithm blocks with pointers to code blocks, something like below.

XXXXXXXXXXXXX Instructions:

Do
X
Y
Z

XXXXXXXXXXXXX Knowledge File:

To do X, consider these approaches:
X1 (concise description of algorithm, perhaps pseudo code)
X2
XN

To do X1, consider these sample implementations:
CODE_BLOCKX1A
CODE_BLOCKX1B…

The advantage of keeping the training documents in separate files is that I can easily retrain a brand new GPT if it messes up too much…

1 Like