💡 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
httpx import at module level causes ModuleNotFoundError for Embeddings-only usage, closes #1012
davidmezzetti7672f427436b
diff --git a/setup.py b/setup.pyindex b087b529..07dbbf7d 100644--- a/setup.py+++ b/setup.py@@ -140,7 +140,7 @@ extras["all"] = (setup(name="txtai",- version="9.5.0",+ version="9.4.1",author="NeuML",description="All-in-one open-source AI framework for semantic search, LLM orchestration and language model workflows",long_description=DESCRIPTION,diff --git a/src/python/txtai/pipeline/llm/__init__.py b/src/python/txtai/pipeline/llm/__init__.pyindex 597a9c84..35974aac 100644--- a/src/python/txtai/pipeline/llm/__init__.py+++ b/src/python/txtai/pipeline/llm/__init__.py@@ -8,4 +8,5 @@ from .huggingface import *from .litellm import LiteLLMfrom .llama import LlamaCppfrom .llm import LLM+from .opencode import OpenCodefrom .rag import RAGdiff --git a/src/python/txtai/pipeline/llm/opencode.py b/src/python/txtai/pipeline/llm/opencode.pyindex ad5b30c4..eef30d26 100644--- a/src/python/txtai/pipeline/llm/opencode.py+++ b/src/python/txtai/pipeline/llm/opencode.py@@ -2,10 +2,17 @@OpenCode module"""-import httpx-from transformers.utils import cached_file+# Conditional import+try:+ import httpx++ HTTPX = True+except ImportError:+ HTTPX = False++from .generation import Generation@@ -49,6 +56,9 @@ class OpenCode(Generation):def __init__(self, path, template=None, **kwargs):super().__init__(path, template, **kwargs)+ if not HTTPX:+ raise ImportError('OpenCode is not available - install "pipeline" extra to enable')+# Get model and provider from pathself.provider, self.model = path.split("/", 1) if "/" in path else (None, None)diff --git a/src/python/txtai/version.py b/src/python/txtai/version.pyindex 1ad82ee5..303e45e7 100644--- a/src/python/txtai/version.py+++ b/src/python/txtai/version.py@@ -3,4 +3,4 @@ Version strings"""# Current version tag-__version__ = "9.5.0"+__version__ = "9.4.1"diff --git a/test/python/testoptional.py b/test/python/testoptional.pyindex 19968acf..45d57f7b 100644--- a/test/python/testoptional.py+++ b/test/python/testoptional.py@@ -35,6 +35,7 @@ class TestOptional(unittest.TestCase):"grandcypher","grand","hnswlib",+ "httpx","imagehash","libcloud.storage.providers","litellm",@@ -231,6 +232,7 @@ class TestOptional(unittest.TestCase):Microphone,MLOnnx,Objects,+ OpenCode,Segmentation,Tabular,TextToAudio,@@ -284,6 +286,9 @@ class TestOptional(unittest.TestCase):with self.assertRaises(ImportError):Objects()+ with self.assertRaises(ImportError):+ OpenCode("opencode")+with self.assertRaises(ImportError):Segmentation(sentences=True)