mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
Merge 04408755df into 252c71c0b2
This commit is contained in:
commit
4a3994ceb8
2 changed files with 8 additions and 1 deletions
|
|
@ -34,7 +34,7 @@ def extract_key(message: dict, fallback_index: int, used_keys: set[str]) -> str:
|
|||
if match:
|
||||
# Use just the filename, not full path
|
||||
path = match.group(1)
|
||||
key = path.split("/")[-1]
|
||||
key = re.split(r"[\\/]", path)[-1]
|
||||
break
|
||||
|
||||
if key is None:
|
||||
|
|
|
|||
|
|
@ -98,6 +98,13 @@ def test_extract_key_with_filename():
|
|||
assert key == "auth.py"
|
||||
|
||||
|
||||
def test_extract_key_with_windows_file_path():
|
||||
msg = {"role": "user", "content": r"File: C:\repo\auth.py"}
|
||||
used: set = set()
|
||||
key = extract_key(msg, fallback_index=0, used_keys=used)
|
||||
assert key == "auth.py"
|
||||
|
||||
|
||||
def test_extract_key_fallback():
|
||||
msg = {"role": "user", "content": "Some random content without a filename"}
|
||||
used: set = set()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue