Skip to content

Commit

Permalink
Add llm_drop_params setting to avoid AnthropicException
Browse files Browse the repository at this point in the history
litellm.drop_params=True can avoid this error.
Error in chat: AnthropicException - anthropic does not support parameters
  • Loading branch information
nobu007 committed May 12, 2024
1 parent d316a99 commit f4a9f2c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 2 deletions.
22 changes: 21 additions & 1 deletion docs/settings/all-settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ llm:
For HTML: This will be run STATELESSLY. You may NEVER write '<!-- previous code here... --!>' or `<!-- header will go here -->` 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.
```

</CodeGroup>
Expand Down Expand Up @@ -694,3 +693,24 @@ 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>
4 changes: 3 additions & 1 deletion interpreter/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def __init__(
skills_path=None,
import_skills=False,
multi_line=False,
contribute_conversation=False
contribute_conversation=False,
llm_drop_params=False,
):
# State
self.messages = [] if messages is None else messages
Expand All @@ -92,6 +93,7 @@ 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

# Loop messages
self.force_task_completion = force_task_completion
Expand Down
2 changes: 2 additions & 0 deletions interpreter/core/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,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.interpreter.debug:
print("\n\n\nOPENAI COMPATIBLE MESSAGES\n\n\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions interpreter/terminal_interface/profiles/defaults/fast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions interpreter/terminal_interface/start_terminal_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,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",
Expand Down

0 comments on commit f4a9f2c

Please sign in to comment.