diff --git a/docs/settings/all-settings.mdx b/docs/settings/all-settings.mdx index 93d6e1013b..99a5430b30 100644 --- a/docs/settings/all-settings.mdx +++ b/docs/settings/all-settings.mdx @@ -297,7 +297,6 @@ llm: For HTML: This will be run STATELESSLY. You may NEVER write '' or `` or anything like that. It is CRITICAL TO NEVER WRITE PLACEHOLDERS. Placeholders will BREAK it. You must write the FULL HTML CODE EVERY TIME. Therefore you cannot write HTML piecemeal—write all the HTML, CSS, and possibly Javascript **in one step, in one code block**. The user will help you review it visually. If the user submits a filepath, you will also see the image. The filepath and user image will both be in the user's message. If you use `plt.show()`, the resulting image will be sent to you. However, if you use `PIL.Image.show()`, the resulting image will NOT be sent to you. - ``` @@ -694,3 +693,24 @@ computer.emit_images: True ``` + +### LLM Drop Params + +Inform llm to drop unknown params like "functions". +It supports to easy debug of llm errors. + + + +```bash Terminal +interpreter --llm_drop_params +``` + +```python Python +interpreter.llm_drop_params = True +``` + +```yaml Profile +llm_drop_params: true +``` + + diff --git a/interpreter/core/core.py b/interpreter/core/core.py index 0e6bf526a7..9462c79323 100644 --- a/interpreter/core/core.py +++ b/interpreter/core/core.py @@ -74,6 +74,7 @@ def __init__( skills_path=None, import_skills=False, multi_line=False, + llm_drop_params=False, ): # State self.messages = [] if messages is None else messages @@ -91,6 +92,7 @@ def __init__( self.disable_telemetry = disable_telemetry self.in_terminal_interface = in_terminal_interface self.multi_line = multi_line + self.llm_drop_params = llm_drop_params # Loop messages self.force_task_completion = force_task_completion diff --git a/interpreter/core/llm/llm.py b/interpreter/core/llm/llm.py index 9ffe52e2e9..9afcba6373 100644 --- a/interpreter/core/llm/llm.py +++ b/interpreter/core/llm/llm.py @@ -194,6 +194,8 @@ def run(self, messages): litellm.max_budget = self.max_budget if self.interpreter.verbose: litellm.set_verbose = True + if self.interpreter.llm_drop_params: + litellm.drop_params = True if self.supports_functions: yield from run_function_calling_llm(self, params) diff --git a/interpreter/terminal_interface/profiles/defaults/default.yaml b/interpreter/terminal_interface/profiles/defaults/default.yaml index 3151f24036..9ae9b4a668 100644 --- a/interpreter/terminal_interface/profiles/defaults/default.yaml +++ b/interpreter/terminal_interface/profiles/defaults/default.yaml @@ -20,6 +20,7 @@ llm: # offline: False # If True, will disable some online features like checking for updates # verbose: False # If True, will print detailed logs # multi_line: False # If True, you can input multiple lines starting and ending with ``` +# llm_drop_params: False # If True, litellm.drop_params=True, Drop any unmapped params ``` # Documentation # All options: https://docs.openinterpreter.com/settings diff --git a/interpreter/terminal_interface/profiles/defaults/fast.yaml b/interpreter/terminal_interface/profiles/defaults/fast.yaml index 061bd87267..74f863f839 100644 --- a/interpreter/terminal_interface/profiles/defaults/fast.yaml +++ b/interpreter/terminal_interface/profiles/defaults/fast.yaml @@ -16,6 +16,7 @@ custom_instructions: "The user has set you to FAST mode. **No talk, just code.** # offline: False # If True, will disable some online features like checking for updates # verbose: False # If True, will print detailed logs # multi_line: False # If True, you can input multiple lines starting and ending with ``` +# llm_drop_params: False # If True, litellm.drop_params=True, Drop any unmapped params ``` # All options: https://docs.openinterpreter.com/settings diff --git a/interpreter/terminal_interface/start_terminal_interface.py b/interpreter/terminal_interface/start_terminal_interface.py index 4a395c7582..7c05ea2bca 100644 --- a/interpreter/terminal_interface/start_terminal_interface.py +++ b/interpreter/terminal_interface/start_terminal_interface.py @@ -190,6 +190,13 @@ def start_terminal_interface(interpreter): "type": bool, "attribute": {"object": interpreter, "attr_name": "multi_line"}, }, + { + "name": "llm_drop_params", + "nickname": "ldp", + "help_text": "set litellm.drop_params=True, Drop any unmapped params", + "type": bool, + "attribute": {"object": interpreter, "attr_name": "llm_drop_params"}, + }, { "name": "local", "nickname": "l", @@ -216,7 +223,11 @@ def start_terminal_interface(interpreter): "default": "NOT_PROVIDED", "nargs": "?", # This means you can pass in nothing if you want }, - {"name": "profiles", "help_text": "opens profiles directory", "type": bool}, + { + "name": "profiles", + "help_text": "opens profiles directory", + "type": bool, + }, { "name": "local_models", "help_text": "opens local models directory",