Skip to content

Commit

Permalink
Remove commented-out token limit check and unused completion model ad…
Browse files Browse the repository at this point in the history
…dition. (#523)
  • Loading branch information
swuecho authored Sep 8, 2024
1 parent d00d839 commit 1dde723
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions api/chat_main_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,6 @@ func genAnswer(h *ChatHandler, w http.ResponseWriter, chatSessionUuid string, ch
return
}

// check if total tokens exceed limit
// context window, max token
// totalTokens := totalInputToken(msgs)
// if totalTokens > chatSession.MaxTokens {
// RespondWithError(w, http.StatusRequestEntityTooLarge, "error.token_length_exceed_limit",
// map[string]interface{}{
// "max_tokens": chatSession.MaxTokens,
// "total_tokens": totalTokens,
// })
// return
// }

chatStreamFn := h.chooseChatStreamFn(chatSession, msgs)

answerText, answerID, shouldReturn := chatStreamFn(w, chatSession, msgs, chatUuid, false, streamOutput)
Expand Down Expand Up @@ -385,8 +373,7 @@ func (h *ChatHandler) chooseChatStreamFn(chat_session sqlc_queries.ChatSession,

completionModel := mapset.NewSet[string]()

completionModel.Add(openai.GPT3TextDavinci003)
completionModel.Add(openai.GPT3TextDavinci002)
// completionModel.Add(openai.GPT3TextDavinci002)
isCompletion := completionModel.Contains(model)
isCustom := strings.HasPrefix(model, "custom-")

Expand Down

0 comments on commit 1dde723

Please sign in to comment.