-
-
Notifications
You must be signed in to change notification settings - Fork 649
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ernie | ||
|
||
import "github.com/tmc/langchaingo/llms/ernie" | ||
|
||
const ( | ||
// see: https://cloud.baidu.com/doc/WENXINWORKSHOP/s/alj562vvu#body%E5%8F%82%E6%95%B0 | ||
defaultBatchSize = 16 | ||
defaultStripNewLines = true | ||
) | ||
|
||
// Option is a function type that can be used to modify the client. | ||
type Option func(p *Ernie) | ||
|
||
// WithClient is an option for providing the LLM client. | ||
func WithClient(client ernie.LLM) Option { | ||
return func(e *Ernie) { | ||
e.client = &client | ||
} | ||
} | ||
|
||
// WithBatchSize is an option for specifying the batch size. | ||
func WithBatchSize(batchSize int) Option { | ||
return func(e *Ernie) { | ||
e.batchSize = batchSize | ||
} | ||
} | ||
|
||
// WithStripNewLines is an option for specifying the should it strip new lines. | ||
func WithStripNewLines(stripNewLines bool) Option { | ||
return func(e *Ernie) { | ||
e.stripNewLines = stripNewLines | ||
} | ||
} |