-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(model): Introduce Groq package with Model type and related funct…
…ions (#148) Here's a summary of the git diff: * Changed the name of the `model.go` file to `groq/model.go` * Added a new package called `groq` * Added a new type called `Model` that has three string values: `LLaMA270bChat`, `Mixtral8x7bInstructV01`, and `Gemma7bIt` * Added a function called `GetModel` that takes a `Model` value and returns a string representing the model name * Added a function called `IsValid` that takes a `Model` value and returns a boolean indicating whether the model is valid * Added a map called `model` that maps the three `Model` values to their corresponding string names * Changed the `README.md` file to include information about the new `groq` package and the `Model` type Overall, it seems like this commit adds a new package called `groq` that contains a new type called `Model` and some functions related to that type. The `README.md` file was also updated to include information about the new package and type. Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Loading branch information
Showing
3 changed files
with
102 additions
and
27 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,40 @@ | ||
package groq | ||
|
||
type Model string | ||
|
||
const ( | ||
LLaMA270bChat Model = "LLaMA2-70b-chat" | ||
Mixtral8x7bInstructV01 Model = "Mixtral-8x7b-Instruct-v0.1" | ||
Gemma7bIt Model = "Gemma-7b-it" | ||
) | ||
|
||
func (m Model) String() string { | ||
return string(m) | ||
} | ||
|
||
func (m Model) GetModel() string { | ||
return GetModel(m) | ||
} | ||
|
||
func (m Model) IsVaild() bool { | ||
switch m { | ||
case LLaMA270bChat, Mixtral8x7bInstructV01, Gemma7bIt: | ||
return true | ||
default: | ||
return false | ||
} | ||
} | ||
|
||
var model = map[Model]string{ | ||
LLaMA270bChat: "llama2-70b-4096", | ||
Mixtral8x7bInstructV01: "mixtral-8x7b-32768", | ||
Gemma7bIt: "gemma-7b-it", | ||
} | ||
|
||
// GetModel returns the model name. | ||
func GetModel(modelName Model) string { | ||
if _, ok := model[modelName]; !ok { | ||
return model[LLaMA270bChat] | ||
} | ||
return model[modelName] | ||
} |
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