Skip to content

The agent engineering platform.

community: Fix Predibase Integration for HuggingFace-hosted fine-tuned adapters (#25015)

Alex Sherstinsky208042e0f2f9
diff --git a/libs/community/langchain_community/llms/predibase.py b/libs/community/langchain_community/llms/predibase.py
index b45ff1d1ea..65aca86bcf 100644
--- a/libs/community/langchain_community/llms/predibase.py
+++ b/libs/community/langchain_community/llms/predibase.py
@@ -49,9 +49,11 @@ class Predibase(LLM):
run_manager: Optional[CallbackManagerForLLMRun] = None,
**kwargs: Any,
) -> str:
- options: Dict[str, Union[str, float]] = (
- self.model_kwargs or self.default_options_for_generation
- )
+ options: Dict[str, Union[str, float]] = {
+ **(self.model_kwargs or {}),
+ **self.default_options_for_generation,
+ **(kwargs or {}),
+ }
if self._is_deprecated_sdk_version():
try:
from predibase import PredibaseClient
@@ -137,6 +139,9 @@ class Predibase(LLM):
if self.adapter_version:
# Since the adapter version is provided, query the Predibase repository.
pb_adapter_id: str = f"{self.adapter_id}/{self.adapter_version}"
+ options.pop(
+ "api_token", None
+ ) # The "api_token" is not used for Predibase-hosted models.
try:
response = lorax_client.generate(
prompt=prompt,