Skip to main content
View in Github Any time you want to send a generate request you will have to send a GenerateReqInput object. Often times you’ll see the type as Omit<GenerateReqInput, 'text' | 'input_ids'> or something along those lines. This is because the ProgramState handles creating the prompt for you, so you should never have to pass an input in yourself.

GenerateReqInput

The GenerateReqInput object is a union between two types: GenerateReqNonStreamingInput and GenerateReqStreamingInput. This is because the things you can pass in to streaming and non-streaming requests are slightly different, but more importantly for better type inference so typescript can tell what the return type of the .gen function should be. Both types are slight variations of the GenerateReqInputBase type.

GenerateReqInputBase

Types Referenced

GenerateReqInputNonStreaming

If you are streaming, then you can use choices.

GenerateReqInputStreaming

If you are streaming then you cannot use the choices parameter.

GenerateReqInput

SamplingParams