Skip to content

Commit aa21637

Browse files
authored
Merge pull request #1409 from CyanideByte/hide-warning-cost
Hide missing cost completion map warnings LiteLLM
2 parents 65546c2 + e0de5d4 commit aa21637

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

interpreter/core/llm/llm.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,27 @@
2525
from .run_tool_calling_llm import run_tool_calling_llm
2626
from .utils.convert_to_openai_messages import convert_to_openai_messages
2727

28+
import logging
29+
30+
# Create or get the logger
31+
logger = logging.getLogger('LiteLLM')
32+
33+
class SuppressDebugFilter(logging.Filter):
34+
def filter(self, record):
35+
# Suppress only the specific message containing the keywords
36+
if "cost map" in record.getMessage():
37+
return False # Suppress this log message
38+
return True # Allow all other messages
2839

2940
class Llm:
3041
"""
3142
A stateless LMC-style LLM with some helpful properties.
3243
"""
3344

3445
def __init__(self, interpreter):
46+
# Add the filter to the logger
47+
logger.addFilter(SuppressDebugFilter())
48+
3549
# Store a reference to parent interpreter
3650
self.interpreter = interpreter
3751

0 commit comments

Comments
 (0)