mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-04-29 03:50:04 +00:00
simplify model provisioning
This commit is contained in:
parent
fcd883f393
commit
15048b0839
3 changed files with 58 additions and 14 deletions
|
|
@ -24,10 +24,9 @@ class ThreadState(TypedDict):
|
|||
|
||||
def call_model_with_messages(state: ThreadState, config: RunnableConfig) -> dict:
|
||||
system_prompt = Prompter(prompt_template="chat").render(data=state)
|
||||
model = provision_model(
|
||||
str(system_prompt) + str(state.get("messages", [])), config, "chat"
|
||||
)
|
||||
ai_message = model.invoke([system_prompt] + state.get("messages", []))
|
||||
payload = [system_prompt] + state.get("messages", [])
|
||||
model = provision_model(str(payload), config, "chat")
|
||||
ai_message = model.invoke(payload, [])
|
||||
return {"messages": ai_message}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue