A simple example illustrates the insufficiency of the known approaches to interpolation in the problem of recovering a function from a few given specific values that clearly convey the form. A local choice between polynomial and rational local interpolants, which minimizes the local interpolant’s errors at the nearest external nodes from one or different sides, complements the known approaches. It combines the extreme computational simplicity of local interpolants with the thorought selection of them. The principles of constructing the algorithm are formulated in general terms for mappings of metric spaces. They provide accurate (with rare exceptions) reconstruction of mappings that locally coincide with some of the given possible interpolants. In the one-dimensional case, the two-stage algorithm guarantees the continuity of the interpolant and accurately reconstructs polynomials of small degree, simple rational functions with a linear denominator, and broken lines of long links with knots at the ends when these requirements do not contradict each other. An additional parameter allows you to replace the exact restoration of polylines with the required smoothness of interpolation.