Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

updated import error handling

Hasala Marakkalagefe3a07a54045
diff --git a/dsp/modules/azurecognitivesearch.py b/dsp/modules/azurecognitivesearch.py
index 6e60a2444..0d68c3cbe 100644
--- a/dsp/modules/azurecognitivesearch.py
+++ b/dsp/modules/azurecognitivesearch.py
@@ -1,11 +1,15 @@
from typing import Optional, Union, Any
from dsp.utils import dotdict
-
-from azure.core.credentials import AzureKeyCredential
-from azure.search.documents import SearchClient
-from azure.search.documents._paging import SearchItemPaged
-
+try:
+ from azure.core.credentials import AzureKeyCredential
+ from azure.search.documents import SearchClient
+ from azure.search.documents._paging import SearchItemPaged
+except ImportError as e:
+ raise ImportError(
+ "You need to install azure-search-documents library"
+ "Please use the command: pip install azure-search-documents"
+ )
class AzureCognitiveSearch:
"""Wrapper for the Azure Congitive Search Retrieval."""
diff --git a/setup.py b/setup.py
index 628104f03..2d78ecdee 100644
--- a/setup.py
+++ b/setup.py
@@ -20,8 +20,7 @@ setup(
"regex",
"ujson",
"tqdm",
- "datasets",
- 'azure-search-documents'
+ "datasets",
],
classifiers=[
"Development Status :: 3 - Alpha",