Skip to content

Commit 86fe7a9

Browse files
fix(anthropic.py): deep copy messages before popping system prompt
1 parent a178428 commit 86fe7a9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

litellm/llms/anthropic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os, types
22
import json
33
from enum import Enum
4-
import requests
4+
import requests, copy
55
import time, uuid
66
from typing import Callable, Optional
77
from litellm.utils import ModelResponse, Usage, map_finish_reason
@@ -117,6 +117,7 @@ def completion(
117117
):
118118
headers = validate_environment(api_key, headers)
119119
_is_function_call = False
120+
messages = copy.deepcopy(messages)
120121
if model in custom_prompt_dict:
121122
# check if the model has a registered custom prompt
122123
model_prompt_details = custom_prompt_dict[model]

0 commit comments

Comments
 (0)