[feat] remove model init instruction

This commit is contained in:
SouthFox 2024-12-24 17:01:39 +08:00
parent bd1dec4800
commit bf3871b11e

9
app.py
View file

@ -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'