Skip to content

Commit

Permalink
add gpt4 alpha model
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Nov 9, 2023
1 parent b6968bb commit f4cad0e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 24 deletions.
2 changes: 1 addition & 1 deletion adapter/chatgpt/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewChatInstanceFromModel(props *InstanceProps) *ChatInstance {
globals.GPT432k, globals.GPT432k0613, globals.GPT432k0314:
return NewChatInstanceFromConfig("gpt4")

case globals.GPT4Vision, globals.Dalle3:
case globals.GPT4Vision, globals.GPT4Dalle, globals.GPT4All:
return NewChatInstanceFromConfig("reverse")

case globals.GPT3Turbo, globals.GPT3TurboInstruct, globals.GPT3Turbo0613, globals.GPT3Turbo0301,
Expand Down
11 changes: 0 additions & 11 deletions adapter/oneapi/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ func processFormat(data string) string {
}

func formatMessages(props *ChatProps) []globals.Message {
if props.Model == globals.GPT4Vision {
base := props.Message[len(props.Message)-1].Content
urls := utils.ExtractUrls(base)

if len(urls) > 0 {
base = fmt.Sprintf("%s %s", strings.Join(urls, " "), base)
}
props.Message[len(props.Message)-1].Content = base
return props.Message
}

return props.Message
}

Expand Down
7 changes: 4 additions & 3 deletions app/src/conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@/utils/env.ts";
import { getMemory } from "@/utils/memory.ts";

export const version = "3.6.15";
export const version = "3.6.15rc";
export const dev: boolean = getDev();
export const deploy: boolean = true;
export let rest_api: string = getRestApi(deploy);
Expand All @@ -21,8 +21,9 @@ export const supportModels: Model[] = [
{ id: "gpt-3.5-turbo-0613", name: "GPT-3.5", free: true, auth: false },
{ id: "gpt-3.5-turbo-16k-0613", name: "GPT-3.5-16k", free: true, auth: true },
{ id: "gpt-4-0613", name: "GPT-4", free: false, auth: true },
{ id: "gpt-4-v", name: "GPT-4V", free: false, auth: true },
{ id: "gpt-4-dalle", name: "DALLE3", free: false, auth: true },
{ id: "gpt-4-all", name: "GPT-4 Alpha", free: false, auth: true },
{ id: "gpt-4-v", name: "GPT-4 Vision", free: false, auth: true },
{ id: "gpt-4-dalle", name: "GPT-4 DALLE", free: false, auth: true },

// anthropic models
{ id: "claude-2", name: "Claude-2", free: true, auth: true },
Expand Down
11 changes: 6 additions & 5 deletions globals/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ const (
GPT3Turbo16k0613 = "gpt-3.5-turbo-16k-0613"
GPT3Turbo16k0301 = "gpt-3.5-turbo-16k-0301"
GPT4 = "gpt-4"
GPT4All = "gpt-4-all"
GPT4Vision = "gpt-4-v"
GPT4Dalle = "gpt-4-dalle"
GPT40314 = "gpt-4-0314"
GPT40613 = "gpt-4-0613"
GPT432k = "gpt-4-32k"
GPT432k0314 = "gpt-4-32k-0314"
GPT432k0613 = "gpt-4-32k-0613"
Dalle2 = "dalle"
Dalle3 = "gpt-4-dalle"
Claude1 = "claude-1"
Claude1100k = "claude-1-100k"
Claude2 = "claude-2"
Expand Down Expand Up @@ -89,9 +90,8 @@ var GPT3Turbo16kArray = []string{
}

var GPT4Array = []string{
GPT4,
GPT4Vision, Dalle3,
GPT40314, GPT40613,
GPT4, GPT40314, GPT40613,
GPT4Vision, GPT4Dalle, GPT4All,
}

var GPT432kArray = []string{
Expand Down Expand Up @@ -172,7 +172,8 @@ var AllModels = []string{
GPT40314,
GPT40613,
GPT4Vision,
Dalle3,
GPT4All,
GPT4Dalle,
GPT432k,
GPT432k0314,
GPT432k0613,
Expand Down
2 changes: 1 addition & 1 deletion manager/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import "github.com/gin-gonic/gin"

func Register(app *gin.Engine) {
app.GET("/chat", ChatAPI)
app.GET("/v1/chat/models", ModelAPI)
app.GET("/v1/models", ModelAPI)
app.POST("/v1/chat/completions", TranshipmentAPI)
}
6 changes: 3 additions & 3 deletions utils/tokenizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func GetWeightByModel(model string) int {
return 2
case globals.GPT3Turbo, globals.GPT3Turbo0613,
globals.GPT3Turbo16k, globals.GPT3Turbo16k0613,
globals.GPT4, globals.GPT4Vision, globals.Dalle3, globals.GPT40314, globals.GPT40613,
globals.GPT4, globals.GPT4Vision, globals.GPT4Dalle, globals.GPT4All, globals.GPT40314, globals.GPT40613,
globals.GPT432k, globals.GPT432k0613, globals.GPT432k0314,

globals.SparkDesk, globals.SparkDeskV2, globals.SparkDeskV3,
Expand Down Expand Up @@ -77,7 +77,7 @@ func CountInputToken(model string, v []globals.Message) float32 {
case globals.GPT3Turbo, globals.GPT3Turbo0613, globals.GPT3Turbo0301, globals.GPT3TurboInstruct,
globals.GPT3Turbo16k, globals.GPT3Turbo16k0613, globals.GPT3Turbo16k0301:
return 0
case globals.GPT4, globals.GPT4Vision, globals.Dalle3, globals.GPT40314, globals.GPT40613:
case globals.GPT4, globals.GPT4Vision, globals.GPT4All, globals.GPT4Dalle, globals.GPT40314, globals.GPT40613:
return float32(CountTokenPrice(v, model)) / 1000 * 2.1 * 0.6
case globals.GPT432k, globals.GPT432k0613, globals.GPT432k0314:
return float32(CountTokenPrice(v, model)) / 1000 * 4.2
Expand Down Expand Up @@ -107,7 +107,7 @@ func CountOutputToken(model string, t int) float32 {
case globals.GPT3Turbo, globals.GPT3Turbo0613, globals.GPT3Turbo0301, globals.GPT3TurboInstruct,
globals.GPT3Turbo16k, globals.GPT3Turbo16k0613, globals.GPT3Turbo16k0301:
return 0
case globals.GPT4, globals.GPT4Vision, globals.Dalle3, globals.GPT40314, globals.GPT40613:
case globals.GPT4, globals.GPT4Vision, globals.GPT4All, globals.GPT4Dalle, globals.GPT40314, globals.GPT40613:
return float32(t*GetWeightByModel(model)) / 1000 * 4.3 * 0.6
case globals.GPT432k, globals.GPT432k0613, globals.GPT432k0314:
return float32(t*GetWeightByModel(model)) / 1000 * 8.6
Expand Down

0 comments on commit f4cad0e

Please sign in to comment.