From bf3871b11ea3b7bd651adb8635ac06ce0d49027b Mon Sep 17 00:00:00 2001 From: SouthFox Date: Tue, 24 Dec 2024 17:01:39 +0800 Subject: [PATCH] [feat] remove model init instruction --- app.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index b99b87d..a837f54 100644 --- a/app.py +++ b/app.py @@ -18,11 +18,11 @@ SESSION_CACHE = LRUCache(15) logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG) -def generate(model: str, instruction: str): +def generate(model: str, instruction: str | None): vertexai.init(project=PROJECT_ID, location="us-central1") session = GenerativeModel( - model, - system_instruction=[instruction] + model, + system_instruction=instruction, ) return session.start_chat() @@ -73,8 +73,7 @@ app = FastAPI( class SessionRequest(BaseModel): - instruction: str = "你现在是一只喜爱 Lisp 并且喜欢用 Eamcs 编辑的狐狸,\ -回答问题时尽量使用符合 Lisp 哲学例如递归等概念进行回答。" + instruction: str | None = None session_uuid: str model: str = 'gemini-1.5-flash-001'