mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-03-01 04:06:07 +00:00
upgraded
This commit is contained in:
parent
dbe4b2126c
commit
d13e7f8070
@ -1360,6 +1360,7 @@ Answer directly with the reformulation of the last prompt.
|
|||||||
for fc in self.config.mounted_function_calls:
|
for fc in self.config.mounted_function_calls:
|
||||||
if fc["selected"]:
|
if fc["selected"]:
|
||||||
dr = Path(fc["dir"])
|
dr = Path(fc["dir"])
|
||||||
|
try:
|
||||||
with open(dr/"config.yaml", "r") as f:
|
with open(dr/"config.yaml", "r") as f:
|
||||||
fc_dict = yaml.safe_load(f.read())
|
fc_dict = yaml.safe_load(f.read())
|
||||||
# Step 1: Construct the full path to the function.py module
|
# Step 1: Construct the full path to the function.py module
|
||||||
@ -1382,7 +1383,8 @@ Answer directly with the reformulation of the last prompt.
|
|||||||
# Step 4: Create an instance of the class and store it in fc_dict["class"]
|
# Step 4: Create an instance of the class and store it in fc_dict["class"]
|
||||||
fc_dict["class"] = class_(self, client)
|
fc_dict["class"] = class_(self, client)
|
||||||
function_calls.append(fc_dict)
|
function_calls.append(fc_dict)
|
||||||
|
except Exception as ex:
|
||||||
|
trace_exception(ex)
|
||||||
# Calculate the total number of tokens between conditionning, documentation, and knowledge
|
# Calculate the total number of tokens between conditionning, documentation, and knowledge
|
||||||
total_tokens = n_cond_tk + n_isearch_tk + n_doc_tk + n_user_description_tk + n_positive_boost + n_negative_boost + n_fun_mode + n_think_first_mode
|
total_tokens = n_cond_tk + n_isearch_tk + n_doc_tk + n_user_description_tk + n_positive_boost + n_negative_boost + n_fun_mode + n_think_first_mode
|
||||||
|
|
||||||
|
@ -34,6 +34,10 @@ class FunctionCall:
|
|||||||
elif self.function_type == FunctionType.POST_GENERATION:
|
elif self.function_type == FunctionType.POST_GENERATION:
|
||||||
raise NotImplementedError("Subclasses must implement the update_context method for POST_GENERATION functions.")
|
raise NotImplementedError("Subclasses must implement the update_context method for POST_GENERATION functions.")
|
||||||
|
|
||||||
|
def process_output(self, context, llm_output:str):
|
||||||
|
if self.function_type == FunctionType.CONTEXT_UPDATE:
|
||||||
|
raise NotImplementedError("Subclasses must implement the process_output for CONTEXT_UPDATE functions.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# from lollms.tasks import TasksLibrary
|
# from lollms.tasks import TasksLibrary
|
||||||
|
@ -139,9 +139,6 @@ async def mount_function_call(request: Request):
|
|||||||
# Check if already mounted
|
# Check if already mounted
|
||||||
for fc in lollmsElfServer.config.mounted_function_calls:
|
for fc in lollmsElfServer.config.mounted_function_calls:
|
||||||
if fc["name"] == function_name:
|
if fc["name"] == function_name:
|
||||||
if fc["mounted"]:
|
|
||||||
return {"status": False, "message": "Function already mounted"}
|
|
||||||
fc["mounted"] = True
|
|
||||||
lollmsElfServer.config.save_config()
|
lollmsElfServer.config.save_config()
|
||||||
return {"status": True, "message": "Function mounted"}
|
return {"status": True, "message": "Function mounted"}
|
||||||
|
|
||||||
@ -190,10 +187,6 @@ async def toggle_function_call(request: Request):
|
|||||||
function_name = data.get("name")
|
function_name = data.get("name")
|
||||||
if not check_access(lollmsElfServer, client_id):
|
if not check_access(lollmsElfServer, client_id):
|
||||||
raise HTTPException(status_code=403, detail="Access denied")
|
raise HTTPException(status_code=403, detail="Access denied")
|
||||||
p_dir = Path(fn_dir)
|
|
||||||
if not p_dir.exists() or not (p_dir / "config.yaml").exists() or not (p_dir / "function.py").exists():
|
|
||||||
raise HTTPException(status_code=404, detail="Function not found")
|
|
||||||
|
|
||||||
|
|
||||||
# Add new entry
|
# Add new entry
|
||||||
for entry in lollmsElfServer.config.mounted_function_calls:
|
for entry in lollmsElfServer.config.mounted_function_calls:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user