Class GeneratorParams
java.lang.Object
smile.onnx.genai.GeneratorParams
- All Implemented Interfaces:
AutoCloseable
Search and sampling options for a
Generator.
Common search option names include max_length, temperature,
top_p, top_k, do_sample, and repetition_penalty.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static GeneratorParamsCreates generator parameters for a model.setGuidance(String type, String data, boolean enableFfTokens) Sets guidance (e.g.setSearchOption(String name, boolean value) Sets a boolean search option.setSearchOption(String name, double value) Sets a numeric search option.setSpeculativeOption(String name, boolean value) Sets a boolean speculative-decoding option.setSpeculativeOption(String name, double value) Sets a numeric speculative-decoding option.
-
Method Details
-
of
Creates generator parameters for a model.- Parameters:
model- the model.- Returns:
- a new params object owned by the caller.
-
setSearchOption
Sets a numeric search option.- Parameters:
name- option name.value- option value.- Returns:
thisfor chaining.
-
setSearchOption
Sets a boolean search option.- Parameters:
name- option name.value- option value.- Returns:
thisfor chaining.
-
setGuidance
Sets guidance (e.g. JSON schema / grammar) for constrained decoding.- Parameters:
type- guidance type.data- guidance payload.enableFfTokens- whether to enable feed-forward tokens.- Returns:
thisfor chaining.
-
setSpeculativeOption
Sets a numeric speculative-decoding option.- Parameters:
name- option name.value- option value.- Returns:
thisfor chaining.
-
setSpeculativeOption
Sets a boolean speculative-decoding option.- Parameters:
name- option name.value- option value.- Returns:
thisfor chaining.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-