Repository: ggerganov/whisper.cpp
File: whisper.h (C/C++)

Code before:

        int n_threads;
        int n_max_text_ctx;
        int offset_ms;      // start offset in ms
        int duration_ms;    // audio duration to process in ms

        bool translate;
        bool no_context;
        bool single_segment; // force single segment output (useful for streaming)
        bool print_special_tokens;
        bool print_progress;
        bool print_realtime;
        bool print_timestamps;

        // [EXPERIMENTAL] token-level timestamps
        bool  token_timestamps; // enable token-level timestamps
        float thold_pt;         // timestamp token probability threshold (~0.01)
        float thold_ptsum;      // timestamp token sum probability threshold (~0.01)
        int   max_len;          // max segment length in characters
        int   max_tokens;       // max tokens per segment (0 = no limit)

        // [EXPERIMENTAL] speed-up techniques
        bool speed_up;  // speed-up the audio by 2x using Phase Vocoder
        int  audio_ctx; // overwrite the audio context size (0 = use default)

        const std::vector<whisper_token> * prompt_tokens;
        const char * language;

        struct {
            int n_past;
        } greedy;

        struct {
            int n_past;
            int beam_width;
            int n_best;
        } beam_search;

        whisper_new_segment_callback new_segment_callback;
        void * new_segment_callback_user_data;
    };

    WHISPER_API struct whisper_full_params whisper_full_default_params(enum whisper_sampling_strategy strategy);

    // Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text
    // Uses the specified decoding strategy to obtain the text.
    WHISPER_API int whisper_full(
            struct whisper_context * ctx,
            struct whisper_full_params params,
            const float * samples,
            int n_samples);

Review comment (suggestion):
The idea is correct, but the problem is we cannot afford to use C++ constructs like `std::vector` in the C-style API. If we use it, then it will break compatibility with other programming languages that want to use the library.

Instead of `std::vector<whisper_token>` you will have to pass `whisper_token * prompt_tokens` and `int prompt_n_tokens`. I know it's ugly, but it's portable.

Code after:
        int n_threads;
        int n_max_text_ctx;
        int offset_ms;      // start offset in ms
        int duration_ms;    // audio duration to process in ms

        bool translate;
        bool no_context;
        bool single_segment; // force single segment output (useful for streaming)
        bool print_special_tokens;
        bool print_progress;
        bool print_realtime;
        bool print_timestamps;

        // [EXPERIMENTAL] token-level timestamps
        bool  token_timestamps; // enable token-level timestamps
        float thold_pt;         // timestamp token probability threshold (~0.01)
        float thold_ptsum;      // timestamp token sum probability threshold (~0.01)
        int   max_len;          // max segment length in characters
        int   max_tokens;       // max tokens per segment (0 = no limit)

        // [EXPERIMENTAL] speed-up techniques
        bool speed_up;  // speed-up the audio by 2x using Phase Vocoder
        int  audio_ctx; // overwrite the audio context size (0 = use default)

        // std::vector<whisper_token>: tokens to provide the whisper model as initial prompt
        const whisper_token * prompt_tokens;
        int prompt_n_tokens;

        const char * language;

        struct {
            int n_past;
        } greedy;

        struct {
            int n_past;
            int beam_width;
            int n_best;
        } beam_search;

        whisper_new_segment_callback new_segment_callback;
        void * new_segment_callback_user_data;
    };

    WHISPER_API struct whisper_full_params whisper_full_default_params(enum whisper_sampling_strategy strategy);

    // Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text
    // Uses the specified decoding strategy to obtain the text.
    WHISPER_API int whisper_full(
            struct whisper_context * ctx,
            struct whisper_full_params params,