Spaces:
Sleeping
Sleeping
Update chat/model_manage.py
Browse files- chat/model_manage.py +2 -2
chat/model_manage.py
CHANGED
|
@@ -142,7 +142,7 @@ def tool_config_from_mode(mode: str, fns: Iterable[str] = ()):
|
|
| 142 |
{"function_calling_config": {"mode": mode, "allowed_function_names": fns}}
|
| 143 |
)
|
| 144 |
|
| 145 |
-
def init_model(mode = "auto"):
|
| 146 |
# return an instance of a model, holding its own ChatSession
|
| 147 |
# every socket session holds its own model
|
| 148 |
# this function must be called upon socket init, also start_chat() to begin chat
|
|
@@ -152,7 +152,7 @@ def init_model(mode = "auto"):
|
|
| 152 |
tools=tools,
|
| 153 |
tool_config=tool_config_from_mode(mode),
|
| 154 |
system_instruction=system_instruction)
|
| 155 |
-
chat_instance = model.start_chat(enable_automatic_function_calling=True)
|
| 156 |
return model, chat_instance
|
| 157 |
|
| 158 |
# handle tool call and chatsession
|
|
|
|
| 142 |
{"function_calling_config": {"mode": mode, "allowed_function_names": fns}}
|
| 143 |
)
|
| 144 |
|
| 145 |
+
def init_model(mode = "auto", history = []):
|
| 146 |
# return an instance of a model, holding its own ChatSession
|
| 147 |
# every socket session holds its own model
|
| 148 |
# this function must be called upon socket init, also start_chat() to begin chat
|
|
|
|
| 152 |
tools=tools,
|
| 153 |
tool_config=tool_config_from_mode(mode),
|
| 154 |
system_instruction=system_instruction)
|
| 155 |
+
chat_instance = model.start_chat(history=history,enable_automatic_function_calling=True)
|
| 156 |
return model, chat_instance
|
| 157 |
|
| 158 |
# handle tool call and chatsession
|