@@ -219,33 +219,13 @@ def _load_reduce_documents_chain(config: dict, **kwargs: Any) -> ReduceDocuments
219
219
220
220
221
221
def _load_llm_bash_chain (config : dict , ** kwargs : Any ) -> Any :
222
- from langchain_experimental .llm_bash .base import LLMBashChain
223
-
224
- llm_chain = None
225
- if "llm_chain" in config :
226
- llm_chain_config = config .pop ("llm_chain" )
227
- llm_chain = load_chain_from_config (llm_chain_config , ** kwargs )
228
- elif "llm_chain_path" in config :
229
- llm_chain = load_chain (config .pop ("llm_chain_path" ), ** kwargs )
230
- # llm attribute is deprecated in favor of llm_chain, here to support old configs
231
- elif "llm" in config :
232
- llm_config = config .pop ("llm" )
233
- llm = load_llm_from_config (llm_config , ** kwargs )
234
- # llm_path attribute is deprecated in favor of llm_chain_path,
235
- # its to support old configs
236
- elif "llm_path" in config :
237
- llm = load_llm (config .pop ("llm_path" ), ** kwargs )
238
- else :
239
- raise ValueError ("One of `llm_chain` or `llm_chain_path` must be present." )
240
- if "prompt" in config :
241
- prompt_config = config .pop ("prompt" )
242
- prompt = load_prompt_from_config (prompt_config )
243
- elif "prompt_path" in config :
244
- prompt = load_prompt (config .pop ("prompt_path" ))
245
- if llm_chain :
246
- return LLMBashChain (llm_chain = llm_chain , prompt = prompt , ** config )
247
- else :
248
- return LLMBashChain (llm = llm , prompt = prompt , ** config )
222
+ """Load LLM Bash chain from config dict"""
223
+ raise NotImplementedError (
224
+ "LLMBash Chain is not available through LangChain anymore. "
225
+ "The relevant code can be found in langchain_experimental, "
226
+ "but it is not appropriate for production usage due to security "
227
+ "concerns. Please refer to langchain-experimental repository for more details."
228
+ )
249
229
250
230
251
231
def _load_llm_checker_chain (config : dict , ** kwargs : Any ) -> LLMCheckerChain :
@@ -336,16 +316,12 @@ def _load_map_rerank_documents_chain(
336
316
337
317
338
318
def _load_pal_chain (config : dict , ** kwargs : Any ) -> Any :
339
- from langchain_experimental .pal_chain import PALChain
340
-
341
- if "llm_chain" in config :
342
- llm_chain_config = config .pop ("llm_chain" )
343
- llm_chain = load_chain_from_config (llm_chain_config , ** kwargs )
344
- elif "llm_chain_path" in config :
345
- llm_chain = load_chain (config .pop ("llm_chain_path" ), ** kwargs )
346
- else :
347
- raise ValueError ("One of `llm_chain` or `llm_chain_path` must be present." )
348
- return PALChain (llm_chain = llm_chain , ** config )
319
+ raise NotImplementedError (
320
+ "PALChain is not available through LangChain anymore. "
321
+ "The relevant code can be found in langchain_experimental, "
322
+ "but it is not appropriate for production usage due to security "
323
+ "concerns. Please refer to langchain-experimental repository for more details."
324
+ )
349
325
350
326
351
327
def _load_refine_documents_chain (config : dict , ** kwargs : Any ) -> RefineDocumentsChain :
@@ -399,30 +375,15 @@ def _load_qa_with_sources_chain(config: dict, **kwargs: Any) -> QAWithSourcesCha
399
375
400
376
401
377
def _load_sql_database_chain (config : dict , ** kwargs : Any ) -> Any :
402
- from langchain_experimental .sql import SQLDatabaseChain
403
-
404
- if "database" in kwargs :
405
- database = kwargs .pop ("database" )
406
- else :
407
- raise ValueError ("`database` must be present." )
408
- if "llm_chain" in config :
409
- llm_chain_config = config .pop ("llm_chain" )
410
- chain = load_chain_from_config (llm_chain_config , ** kwargs )
411
- return SQLDatabaseChain (llm_chain = chain , database = database , ** config )
412
- if "llm" in config :
413
- llm_config = config .pop ("llm" )
414
- llm = load_llm_from_config (llm_config , ** kwargs )
415
- elif "llm_path" in config :
416
- llm = load_llm (config .pop ("llm_path" ), ** kwargs )
417
- else :
418
- raise ValueError ("One of `llm` or `llm_path` must be present." )
419
- if "prompt" in config :
420
- prompt_config = config .pop ("prompt" )
421
- prompt = load_prompt_from_config (prompt_config )
422
- else :
423
- prompt = None
424
-
425
- return SQLDatabaseChain .from_llm (llm , database , prompt = prompt , ** config )
378
+ """Load SQL Database chain from config dict."""
379
+ raise NotImplementedError (
380
+ "SQLDatabaseChain is not available through LangChain anymore. "
381
+ "The relevant code can be found in langchain_experimental, "
382
+ "but it is not appropriate for production usage due to security "
383
+ "concerns. Please refer to langchain-experimental repository for more details, "
384
+ "or refer to this tutorial for best practices: "
385
+ "https://python.langchain.com/docs/tutorials/sql_qa/"
386
+ )
426
387
427
388
428
389
def _load_vector_db_qa_with_sources_chain (
0 commit comments