💡 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
Add exponential http backoff to work around constant HF Hub 429 errors
davidmezzetti1f5a352261ad
diff --git a/test/python/testpipeline/testtext/testtranslation.py b/test/python/testpipeline/testtext/testtranslation.pyindex 79f878a3..a383d968 100644--- a/test/python/testpipeline/testtext/testtranslation.py+++ b/test/python/testpipeline/testtext/testtranslation.py@@ -3,6 +3,9 @@ Translation module tests"""import unittest+import time++import requestsfrom txtai.pipeline import Translation@@ -20,6 +23,19 @@ class TestTranslation(unittest.TestCase):cls.translate = Translation()+ # Preload list of models. Handle HF Hub errors.+ complete, wait = False, 1+ while not complete:+ try:+ cls.translate.lookup("en", "es")+ complete = True+ except requests.exceptions.HTTPError:+ # Exponential backoff+ time.sleep(wait)++ # Wait up to 16 seconds+ wait = min(wait * 2, 16)+def testDetect(self):"""Test language detection