💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Improve LiteLLM model detection method
davidmezzettib44d5778d87a
diff --git a/setup.py b/setup.pyindex 124b4167..f7c009bb 100644--- a/setup.py+++ b/setup.py@@ -49,7 +49,7 @@ extras["pipeline-data"] = ["beautifulsoup4>=4.9.3", "nltk>=3.5", "pandas>=1.1.0"extras["pipeline-image"] = ["imagehash>=4.2.1", "pillow>=7.1.2", "timm>=0.4.12"]-extras["pipeline-llm"] = ["litellm>=1.12.0", "llama-cpp-python>=0.2.20"]+extras["pipeline-llm"] = ["litellm>=1.15.8", "llama-cpp-python>=0.2.20"]extras["pipeline-text"] = ["fasttext>=0.9.2", "sentencepiece>=0.1.91"]diff --git a/src/python/txtai/pipeline/llm/litellm.py b/src/python/txtai/pipeline/llm/litellm.pyindex e79031a8..5709dd9f 100644--- a/src/python/txtai/pipeline/llm/litellm.py+++ b/src/python/txtai/pipeline/llm/litellm.py@@ -2,9 +2,6 @@LiteLLM module"""-import os-import contextlib-# Conditional importtry:import litellm as api@@ -35,11 +32,16 @@ class LiteLLM(Generation):# pylint: disable=W0702if isinstance(path, str) and LITELLM:- with open(os.devnull, "w", encoding="utf-8") as f, contextlib.redirect_stdout(f):- try:- return api.get_llm_provider(path)- except:- return False+ debug = api.suppress_debug_info+ try:+ # Suppress debug messages for this test+ api.suppress_debug_info = True+ return api.get_llm_provider(path)+ except:+ return False+ finally:+ # Restore debug info value to original value+ api.suppress_debug_info = debugreturn False