[feat] remove model init instruction
This commit is contained in:
parent
bd1dec4800
commit
bf3871b11e
1 changed files with 4 additions and 5 deletions
9
app.py
9
app.py
|
@ -18,11 +18,11 @@ SESSION_CACHE = LRUCache(15)
|
||||||
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
|
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")
|
vertexai.init(project=PROJECT_ID, location="us-central1")
|
||||||
session = GenerativeModel(
|
session = GenerativeModel(
|
||||||
model,
|
model,
|
||||||
system_instruction=[instruction]
|
system_instruction=instruction,
|
||||||
)
|
)
|
||||||
|
|
||||||
return session.start_chat()
|
return session.start_chat()
|
||||||
|
@ -73,8 +73,7 @@ app = FastAPI(
|
||||||
|
|
||||||
|
|
||||||
class SessionRequest(BaseModel):
|
class SessionRequest(BaseModel):
|
||||||
instruction: str = "你现在是一只喜爱 Lisp 并且喜欢用 Eamcs 编辑的狐狸,\
|
instruction: str | None = None
|
||||||
回答问题时尽量使用符合 Lisp 哲学例如递归等概念进行回答。"
|
|
||||||
session_uuid: str
|
session_uuid: str
|
||||||
model: str = 'gemini-1.5-flash-001'
|
model: str = 'gemini-1.5-flash-001'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue