From 1788eb89c3daf3175389fb4abc48015095afd892 Mon Sep 17 00:00:00 2001 From: Pankaj Telang Date: Mon, 6 Jan 2025 10:43:11 -0500 Subject: [PATCH] Configure litellm to drop unsupported parameters --- src/codegate/llm_utils/llmclient.py | 3 +++ src/codegate/providers/litellmshim/litellmshim.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/codegate/llm_utils/llmclient.py b/src/codegate/llm_utils/llmclient.py index d364790c..53c77e0a 100644 --- a/src/codegate/llm_utils/llmclient.py +++ b/src/codegate/llm_utils/llmclient.py @@ -1,6 +1,7 @@ import json from typing import Any, Dict, Optional +import litellm import structlog from litellm import acompletion from ollama import Client as OllamaClient @@ -10,6 +11,8 @@ logger = structlog.get_logger("codegate") +litellm.drop_params = True + class LLMClient: """ diff --git a/src/codegate/providers/litellmshim/litellmshim.py b/src/codegate/providers/litellmshim/litellmshim.py index 5954691f..f0088219 100644 --- a/src/codegate/providers/litellmshim/litellmshim.py +++ b/src/codegate/providers/litellmshim/litellmshim.py @@ -1,5 +1,6 @@ from typing import Any, AsyncIterator, Callable, Optional, Union +import litellm import structlog from fastapi.responses import JSONResponse, StreamingResponse from litellm import ( @@ -12,6 +13,8 @@ logger = structlog.get_logger("codegate") +litellm.drop_params = True + class LiteLLmShim(BaseCompletionHandler): """