Skip to content

Commit

Permalink
Add builder pattern for model API
Browse files Browse the repository at this point in the history
Add all builder methods

Fix builder params

Add example usage to README
  • Loading branch information
h0rv committed Dec 7, 2023
1 parent 2f2d8e6 commit ccac548
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 168 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,33 @@
)
```

## Example Usage

### Builder Pattern

```go
model, err := wx.NewModelBuilder().
SetModelId(wx.ModelTypesEnum.LLAMA_2_70B_CHAT).
SetApiKey(yourWatsonxApiKey).
SetProjectId(yourWatsonxProjectID).
SetTemperature(yourtemperature).
SetMaxNewTokens(yourMaxNewTokens).
SetDecodingMethod(wx.DecodingMethodsEnum.GREEDY).
Build()
if err != nil {
// Failed to get watsonx model
return err
}

result, err := model.GenerateText(
"Hi, how are you?",
nil, /* or your Generation Params */
)
if err != nil {
// Failed to call generate on model
return err
}
```


## Setup
Expand Down
163 changes: 0 additions & 163 deletions foundation_models/model.go

This file was deleted.

File renamed without changes.
Loading

0 comments on commit ccac548

Please sign in to comment.