Skip to content

Commit

Permalink
Update default max_tokens from 512 to 4096 in chat_session schema and…
Browse files Browse the repository at this point in the history
… remove legacy token adjustment in GetDefaultChatModel handler.
  • Loading branch information
swuecho committed Dec 28, 2024
1 parent 07ed6cc commit 78502c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions api/chat_model_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,6 @@ func (h *ChatModelHandler) DeleteChatModel(w http.ResponseWriter, r *http.Reques

func (h *ChatModelHandler) GetDefaultChatModel(w http.ResponseWriter, r *http.Request) {
ChatModel, err := h.db.GetDefaultChatModel(r.Context())
// default 512 is for history reasaon, now most model support 4096 and token is cheap
if ChatModel.MaxToken == 512 {
ChatModel.MaxToken = 4096
}
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(fmt.Sprintf("Error retrieving default chat API: %s", err.Error())))
Expand Down
4 changes: 2 additions & 2 deletions api/sqlc/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ CREATE TABLE IF NOT EXISTS chat_session (
max_length integer DEFAULT 0 NOT NULL,
temperature float DEFAULT 1.0 NOT NUll,
top_p float DEFAULT 1.0 NOT NUll,
max_tokens int DEFAULT 512 NOT NULL,
max_tokens int DEFAULT 4096 NOT NULL,
n integer DEFAULT 1 NOT NULL,
summarize_mode boolean DEFAULT false NOT NULL
);
Expand All @@ -130,7 +130,7 @@ CREATE TABLE IF NOT EXISTS chat_session (
-- chat_session
ALTER TABLE chat_session ADD COLUMN IF NOT EXISTS temperature float DEFAULT 1.0 NOT NULL;
ALTER TABLE chat_session ADD COLUMN IF NOT EXISTS top_p float DEFAULT 1.0 NOT NULL;
ALTER TABLE chat_session ADD COLUMN IF NOT EXISTS max_tokens int DEFAULT 512 NOT NULL;
ALTER TABLE chat_session ADD COLUMN IF NOT EXISTS max_tokens int DEFAULT 4096 NOT NULL;
ALTER TABLE chat_session ADD COLUMN IF NOT EXISTS debug boolean DEFAULT false NOT NULL;
ALTER TABlE chat_session ADD COLUMN IF NOT EXISTS model character varying(255) NOT NULL DEFAULT 'gpt-3.5-turbo';
ALTER TABLE chat_session ADD COLUMN IF NOT EXISTS n INTEGER DEFAULT 1 NOT NULL;
Expand Down

0 comments on commit 78502c7

Please sign in to comment.