Skip to content

Commit

Permalink
fix: Fixed import issue with deprecated functions (#89)
Browse files Browse the repository at this point in the history
Fixed import issue with deprecated functions
  • Loading branch information
chandrasekharan-zipstack authored Aug 20, 2024
1 parent b49d6f4 commit df4853d
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/unstract/sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.45.0"
__version__ = "0.45.1"


def get_sdk_version():
Expand Down
2 changes: 1 addition & 1 deletion src/unstract/sdk/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _get_adapter_configuration(
msg = AdapterUtils.get_msg_from_request_exc(
err=e, message_key="error", default_err=default_err
)
raise SdkError(f"Error while retrieving adapter. {msg}")
raise SdkError(f"Error retrieving adapter. {msg}")
return adapter_data

@staticmethod
Expand Down
6 changes: 2 additions & 4 deletions src/unstract/sdk/embedding.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Any, Optional

from deprecated import deprecated
from llama_index.core.base.embeddings.base import Embedding
from llama_index.core.embeddings import BaseEmbedding
from typing_extensions import deprecated

from unstract.sdk.adapter import ToolAdapter
from unstract.sdk.adapters.constants import Common
Expand Down Expand Up @@ -38,9 +38,7 @@ def _initialise(self):
self._length: int = self._get_embedding_length()
self._usage_kwargs["adapter_instance_id"] = self._adapter_instance_id

if not SdkHelper.is_public_adapter(
adapter_id=self._adapter_instance_id
):
if not SdkHelper.is_public_adapter(adapter_id=self._adapter_instance_id):
platform_api_key = self._tool.get_env_or_die(ToolEnv.PLATFORM_API_KEY)
CallbackManager.set_callback(
platform_api_key=platform_api_key,
Expand Down
2 changes: 1 addition & 1 deletion src/unstract/sdk/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
from typing import Any, Callable, Optional

from deprecated import deprecated
from llama_index.core import Document
from llama_index.core.node_parser import SimpleNodeParser
from llama_index.core.vector_stores import (
Expand All @@ -11,7 +12,6 @@
VectorStoreQuery,
VectorStoreQueryResult,
)
from typing_extensions import deprecated

from unstract.sdk.adapter import ToolAdapter
from unstract.sdk.adapters.exceptions import AdapterError
Expand Down
2 changes: 1 addition & 1 deletion src/unstract/sdk/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import re
from typing import Any, Callable, Optional

from deprecated import deprecated
from llama_index.core.base.llms.types import CompletionResponseGen
from llama_index.core.llms import LLM as LlamaIndexLLM
from llama_index.core.llms import CompletionResponse
from openai import APIError as OpenAIAPIError
from openai import RateLimitError as OpenAIRateLimitError
from typing_extensions import deprecated

from unstract.sdk.adapter import ToolAdapter
from unstract.sdk.adapters.constants import Common
Expand Down
2 changes: 1 addition & 1 deletion src/unstract/sdk/ocr.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABCMeta
from typing import Optional

from typing_extensions import deprecated
from deprecated import deprecated

from unstract.sdk.adapter import ToolAdapter
from unstract.sdk.adapters.constants import Common
Expand Down
2 changes: 1 addition & 1 deletion src/unstract/sdk/utils/callback_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from typing import Callable, Optional, Union

import tiktoken
from deprecated import deprecated
from llama_index.core.callbacks import CallbackManager as LlamaIndexCallbackManager
from llama_index.core.callbacks import TokenCountingHandler
from llama_index.core.embeddings import BaseEmbedding
from llama_index.core.llms import LLM
from typing_extensions import deprecated

from unstract.sdk.utils.usage_handler import UsageHandler

Expand Down
2 changes: 1 addition & 1 deletion src/unstract/sdk/vector_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collections.abc import Sequence
from typing import Any, Optional, Union

from deprecated import deprecated
from llama_index.core import StorageContext, VectorStoreIndex
from llama_index.core.indices.base import IndexType
from llama_index.core.schema import BaseNode, Document
Expand All @@ -10,7 +11,6 @@
VectorStore,
VectorStoreQueryResult,
)
from typing_extensions import deprecated

from unstract.sdk.adapter import ToolAdapter
from unstract.sdk.adapters.constants import Common
Expand Down
2 changes: 1 addition & 1 deletion src/unstract/sdk/x2txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any, Optional

import pdfplumber
from typing_extensions import deprecated
from deprecated import deprecated

from unstract.sdk.adapter import ToolAdapter
from unstract.sdk.adapters.constants import Common
Expand Down

0 comments on commit df4853d

Please sign in to comment.