Skip to content

Commit

Permalink
Feat Latest Models "gemini-1.5-flash-latest" (#425)
Browse files Browse the repository at this point in the history
- [+] chore(README.md): update Go version badge from 1.22.1 to 1.22.3
- [+] chore(go.mod): update Go version from 1.22.1 to 1.22.3
- [+] feat(terminal): add new model constant GeminiProFlash for "gemini-1.5-flash-latest"
- [+] feat(terminal): enable GeminiProFlash model in availableModels map
- [+] feat(terminal): apply safety settings for GeminiProFlash model in ApplyToModel function

Note: TODO - Rewrite this from scratch for v1 because the codebase looks bad needs improvement. The new version will support HTTP REST API streaming instead of only terminal output, which is currently supported.
  • Loading branch information
H0llyW00dzZ committed May 15, 2024
1 parent e7b45bd commit 7be3d43
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Copyright (©️) 2024 @H0llyW00dzZ All rights reserved.
</pre>

[![Go Version](https://img.shields.io/badge/1.22.1-gray?style=flat&logo=go&logoWidth=15)](https://github.com/H0llyW00dzZ/GoGenAI-Terminal-Chat/blob/master/go.mod#L3)
[![Go Version](https://img.shields.io/badge/1.22.3-gray?style=flat&logo=go&logoWidth=15)](https://github.com/H0llyW00dzZ/GoGenAI-Terminal-Chat/blob/master/go.mod#L3)
[![Go Reference](https://pkg.go.dev/badge/github.com/H0llyW00dzZ/GoGenAI-Terminal-Chat.svg)](https://pkg.go.dev/github.com/H0llyW00dzZ/GoGenAI-Terminal-Chat)
[![Go Report Card](https://goreportcard.com/badge/github.com/H0llyW00dzZ/GoGenAI-Terminal-Chat)](https://goreportcard.com/report/github.com/H0llyW00dzZ/GoGenAI-Terminal-Chat)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/H0llyW00dzZ/GoGenAI-Terminal-Chat

go 1.22.1
go 1.22.3

require (
github.com/google/generative-ai-go v0.12.0 // direct
Expand Down
1 change: 1 addition & 0 deletions terminal/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
GeminiProLatest = "gemini-1.0-pro-latest"
GeminiProVision = "gemini-pro-vision"
GeminiProTuning = "gemini-1.0-pro-001"
GeminiProFlash = "gemini-1.5-flash-latest"
// this may subject to changed in future for example can customize the delay
TypingDelay = 60 * time.Millisecond
// this clearing chat history in secret storage
Expand Down
1 change: 1 addition & 0 deletions terminal/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ func init() {
GeminiPro: true,
GeminiProTuning: true,
GeminiProLatest: true,
GeminiProFlash: true,
// List Model TODO or not A fucking available but already showing in docs https://ai.google.dev/models/gemini
GeminiProVision: false,
}
Expand Down
2 changes: 1 addition & 1 deletion terminal/safety_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (s *SafetySettings) ApplyToModel(model *genai.GenerativeModel, modelName st
// For instance, simplify the process by breaking down the logic into smaller components.
// Keeping cyclomatic complexity under 5 is a secret key hahaha in Go programming. It leads to reusable, easy-to-maintain code that boosts performance and minimizes bugs.
switch modelName {
case GeminiPro, GeminiProLatest, GeminiProTuning:
case GeminiPro, GeminiProLatest, GeminiProTuning, GeminiProFlash:
// Apply a specific set of safety settings for the "gemini-pro", "gemini-1.0-pro-latest", "gemini-1.0-pro-001 (tuning)" model
model.SafetySettings = []*genai.SafetySetting{
{
Expand Down

0 comments on commit 7be3d43

Please sign in to comment.