|
|
|
@ -172,6 +172,9 @@ func numTokensFromMessages(messages []Message, model string) int {
|
|
|
|
if strings.Contains(model, "gpt-3.5") {
|
|
|
|
if strings.Contains(model, "gpt-3.5") {
|
|
|
|
model = "gpt-3.5-turbo"
|
|
|
|
model = "gpt-3.5-turbo"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if strings.Contains(model, "gpt-4") {
|
|
|
|
|
|
|
|
model = "gpt-4"
|
|
|
|
|
|
|
|
}
|
|
|
|
tkm, err := tiktoken.EncodingForModel(model)
|
|
|
|
tkm, err := tiktoken.EncodingForModel(model)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
err = fmt.Errorf("getEncoding: %v", err)
|
|
|
|
err = fmt.Errorf("getEncoding: %v", err)
|
|
|
|
@ -191,6 +194,9 @@ func numTokensFromString(msg string, model string) int {
|
|
|
|
if strings.Contains(model, "gpt-3.5") {
|
|
|
|
if strings.Contains(model, "gpt-3.5") {
|
|
|
|
model = "gpt-3.5-turbo"
|
|
|
|
model = "gpt-3.5-turbo"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if strings.Contains(model, "gpt-4") {
|
|
|
|
|
|
|
|
model = "gpt-4"
|
|
|
|
|
|
|
|
}
|
|
|
|
tkm, err := tiktoken.EncodingForModel(model)
|
|
|
|
tkm, err := tiktoken.EncodingForModel(model)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
err = fmt.Errorf("getEncoding: %v", err)
|
|
|
|
err = fmt.Errorf("getEncoding: %v", err)
|
|
|
|
@ -606,7 +612,7 @@ func completions(c *gin.Context) {
|
|
|
|
func handleGetModels(c *gin.Context) {
|
|
|
|
func handleGetModels(c *gin.Context) {
|
|
|
|
// BUGFIX: fix options request, see https://github.com/diemus/azure-openai-proxy/issues/3
|
|
|
|
// BUGFIX: fix options request, see https://github.com/diemus/azure-openai-proxy/issues/3
|
|
|
|
//models := []string{"gpt-4", "gpt-4-0314", "gpt-4-32k", "gpt-4-32k-0314", "gpt-3.5-turbo", "gpt-3.5-turbo-0301", "text-davinci-003", "text-embedding-ada-002"}
|
|
|
|
//models := []string{"gpt-4", "gpt-4-0314", "gpt-4-32k", "gpt-4-32k-0314", "gpt-3.5-turbo", "gpt-3.5-turbo-0301", "text-davinci-003", "text-embedding-ada-002"}
|
|
|
|
models := []string{"gpt-3.5-turbo", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-16k-0613", "text-davinci-003", "text-embedding-ada-002", "text-davinci-edit-001", "code-davinci-edit-001", "images-generations"}
|
|
|
|
models := []string{"gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-16k-0613", "text-davinci-003", "text-embedding-ada-002", "text-davinci-edit-001", "code-davinci-edit-001", "images-generations"}
|
|
|
|
result := ListModelResponse{
|
|
|
|
result := ListModelResponse{
|
|
|
|
Object: "list",
|
|
|
|
Object: "list",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|