From 8a22759f24301085d90b4c538734d876ac127df9 Mon Sep 17 00:00:00 2001 From: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:18:41 +0530 Subject: [PATCH] fix: Fixed parse_llm_err by passing the LLM adapter class correctly (#135) Fixed parse_llm_err by passing the LLM adapter class correctly --- src/unstract/sdk/__init__.py | 2 +- src/unstract/sdk/llm.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/unstract/sdk/__init__.py b/src/unstract/sdk/__init__.py index 1c78c028..331d19e9 100644 --- a/src/unstract/sdk/__init__.py +++ b/src/unstract/sdk/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.54.0rc6" +__version__ = "0.54.0rc7" def get_sdk_version(): diff --git a/src/unstract/sdk/llm.py b/src/unstract/sdk/llm.py index fb4c35cf..7acdb803 100644 --- a/src/unstract/sdk/llm.py +++ b/src/unstract/sdk/llm.py @@ -109,7 +109,7 @@ def complete( process_text_output = {} return {LLM.RESPONSE: response, **process_text_output} except Exception as e: - raise parse_llm_err(e, self._llm_instance) from e + raise parse_llm_err(e, self._llm_adapter_class) from e def stream_complete( self, @@ -122,7 +122,7 @@ def stream_complete( ) return response except Exception as e: - raise parse_llm_err(e, self._llm_instance) from e + raise parse_llm_err(e, self._llm_adapter_class) from e def _get_llm(self, adapter_instance_id: str) -> LlamaIndexLLM: """Returns the LLM object for the tool. @@ -147,9 +147,9 @@ def _get_llm(self, adapter_instance_id: str) -> LlamaIndexLLM: Common.ADAPTER ] llm_metadata = llm_config_data.get(Common.ADAPTER_METADATA) - llm_adapter_class: LLMAdapter = llm_adapter(llm_metadata) - self._usage_kwargs["provider"] = llm_adapter_class.get_provider() - llm_instance: LLM = llm_adapter_class.get_llm_instance() + self._llm_adapter_class: LLMAdapter = llm_adapter(llm_metadata) + self._usage_kwargs["provider"] = self._llm_adapter_class.get_provider() + llm_instance: LLM = self._llm_adapter_class.get_llm_instance() return llm_instance except Exception as e: self._tool.stream_log(