Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add llm_drop_params setting to avoid AnthropicException #1239

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/settings/all-settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -694,3 +694,47 @@ computer.emit_images: True
```

</CodeGroup>


### LLM Drop Params

Inform llm to drop unknown params like "functions".
It supports to easy debug of llm errors.

<CodeGroup>

```bash Terminal
interpreter --llm_drop_params
```

```python Python
interpreter.llm_drop_params = True
```

```yaml Profile
llm_drop_params: true
```

</CodeGroup>


### LLM Modify Params

Inform llm to modify params or messages.
It supports to easy debug of llm errors.

<CodeGroup>

```bash Terminal
interpreter --llm_modify_params
```

```python Python
interpreter.llm_modify_params = True
```

```yaml Profile
llm_modify_params: true
```

</CodeGroup>
4 changes: 4 additions & 0 deletions interpreter/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def __init__(
import_skills=False,
multi_line=False,
contribute_conversation=False,
llm_drop_params=False,
llm_modify_params=False,
):
# State
self.messages = [] if messages is None else messages
Expand All @@ -103,6 +105,8 @@ def __init__(
self.in_terminal_interface = in_terminal_interface
self.multi_line = multi_line
self.contribute_conversation = contribute_conversation
self.llm_drop_params = llm_drop_params
self.llm_modify_params = llm_modify_params

# Loop messages
self.force_task_completion = force_task_completion
Expand Down
4 changes: 4 additions & 0 deletions interpreter/core/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ 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.interpreter.llm_modify_params:
litellm.modify_params = True

if self.interpreter.debug:
print("\n\n\nOPENAI COMPATIBLE MESSAGES\n\n\n")
Expand Down
2 changes: 2 additions & 0 deletions interpreter/terminal_interface/profiles/defaults/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ 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
# llm_modify_params: False # If True, litellm.drop_params=True, Modify params or messages

# Documentation
# All options: https://docs.openinterpreter.com/settings
2 changes: 2 additions & 0 deletions interpreter/terminal_interface/profiles/defaults/fast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ 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
# llm_modify_params: False # If True, litellm.drop_params=True, Modify params or messages

# All options: https://docs.openinterpreter.com/settings

Expand Down
14 changes: 14 additions & 0 deletions interpreter/terminal_interface/start_terminal_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,20 @@ def start_terminal_interface(interpreter):
"attr_name": "contribute_conversation",
},
},
{
"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": "llm_modify_params",
"nickname": "lmp",
"help_text": "set litellm.modify_params=True, Modify params or messages",
"type": bool,
"attribute": {"object": interpreter, "attr_name": "llm_modify_params"},
},
]

# Check for deprecated flags before parsing arguments
Expand Down