fixed bindings to match new API (#2240)

* fixed bindings to match new API

Signed-off-by: Jerry Caligiure <jerry@noof.biz>

* added update to readme

Signed-off-by: Jerry Caligiure <jerry@noof.biz>

---------

Signed-off-by: Jerry Caligiure <jerry@noof.biz>
Co-authored-by: Jerry Caligiure <jerry@noof.biz>
This commit is contained in:
Noofbiz
2024-04-29 08:49:26 -04:00
committed by GitHub
parent 6f38fde80b
commit 1b87aa2dbc
6 changed files with 33 additions and 15 deletions

View File

@@ -1,8 +1,8 @@
package gpt4all
type PredictOptions struct {
ContextSize, RepeatLastN, Tokens, TopK, Batch int
TopP, MinP, Temperature, ContextErase, RepeatPenalty float64
ContextSize, RepeatLastN, Tokens, TopK, Batch, Special int
TopP, MinP, Temperature, ContextErase, RepeatPenalty float64
}
type PredictOption func(p *PredictOptions)
@@ -11,9 +11,10 @@ var DefaultOptions PredictOptions = PredictOptions{
Tokens: 200,
TopK: 10,
TopP: 0.90,
MinP: 0.0,
MinP: 0.0,
Temperature: 0.96,
Batch: 1,
Special: 0,
ContextErase: 0.55,
ContextSize: 1024,
RepeatLastN: 10,
@@ -93,6 +94,17 @@ func SetBatch(size int) PredictOption {
}
}
// SetSpecial is true if special tokens in the prompt should be processed, false otherwise.
func SetSpecial(special bool) PredictOption {
return func(p *PredictOptions) {
if special {
p.Special = 1
} else {
p.Special = 0
}
}
}
// Create a new PredictOptions object with the given options.
func NewPredictOptions(opts ...PredictOption) PredictOptions {
p := DefaultOptions