How to train Codex to use SCPI commands (custom APIs )

Hi all,

We have a manual which contains the commands and other parameters(such as example, command group), these commands are used to communicate with the Tektronix oscilloscope.

The URL of our manual is https://download.tek.com/manual/5_6-Series-MSO54-MSO56-MSO58-MSO58L-MSO64-Programmer-Manual_EN-US_077130505.pdf

Example of one such command is -

*RST: Resets the instrument to factory default settings.

My end goal is to generate python code for the tasks.

Sample Prompt:
“”“Write a python program to import Pyvisa and reset the scope .”“”

Expected python code:

import visa

rm = visa.ResourceManager()
scope = rm.open_resource(“TCPIP::127.0.0.1::4000::SOCKET”)
scope.write(’*RST’)

For simple commands like *RST - plain text to python code generation works well but for many other commands like Horizontal settings or Recall (which take input parameters) - I am not able to generate python code using codex.

How do we train codex for all the commands - since some of the commands are not correctly generated?

Thank you