Skip to content

Commit

Permalink
Fix chains/loading.py error messages (langchain-ai#11688)
Browse files Browse the repository at this point in the history
- **Description:** make the error messages consistent in
chains/loading.py
  - **Dependencies:** None
  • Loading branch information
lawwu authored Oct 12, 2023
1 parent 18ebce2 commit 93bb19f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libs/langchain/langchain/chains/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _load_stuff_documents_chain(config: dict, **kwargs: Any) -> StuffDocumentsCh
elif "llm_chain_path" in config:
llm_chain = load_chain(config.pop("llm_chain_path"))
else:
raise ValueError("One of `llm_chain` or `llm_chain_config` must be present.")
raise ValueError("One of `llm_chain` or `llm_chain_path` must be present.")

if not isinstance(llm_chain, LLMChain):
raise ValueError(f"Expected LLMChain, got {llm_chain}")
Expand Down Expand Up @@ -109,7 +109,7 @@ def _load_map_reduce_documents_chain(
elif "llm_chain_path" in config:
llm_chain = load_chain(config.pop("llm_chain_path"))
else:
raise ValueError("One of `llm_chain` or `llm_chain_config` must be present.")
raise ValueError("One of `llm_chain` or `llm_chain_path` must be present.")

if not isinstance(llm_chain, LLMChain):
raise ValueError(f"Expected LLMChain, got {llm_chain}")
Expand Down Expand Up @@ -295,7 +295,7 @@ def _load_map_rerank_documents_chain(
elif "llm_chain_path" in config:
llm_chain = load_chain(config.pop("llm_chain_path"))
else:
raise ValueError("One of `llm_chain` or `llm_chain_config` must be present.")
raise ValueError("One of `llm_chain` or `llm_chain_path` must be present.")
return MapRerankDocumentsChain(llm_chain=llm_chain, **config)


Expand All @@ -320,7 +320,7 @@ def _load_refine_documents_chain(config: dict, **kwargs: Any) -> RefineDocuments
initial_llm_chain = load_chain(config.pop("initial_llm_chain_path"))
else:
raise ValueError(
"One of `initial_llm_chain` or `initial_llm_chain_config` must be present."
"One of `initial_llm_chain` or `initial_llm_chain_path` must be present."
)
if "refine_llm_chain" in config:
refine_llm_chain_config = config.pop("refine_llm_chain")
Expand All @@ -329,7 +329,7 @@ def _load_refine_documents_chain(config: dict, **kwargs: Any) -> RefineDocuments
refine_llm_chain = load_chain(config.pop("refine_llm_chain_path"))
else:
raise ValueError(
"One of `refine_llm_chain` or `refine_llm_chain_config` must be present."
"One of `refine_llm_chain` or `refine_llm_chain_path` must be present."
)
if "document_prompt" in config:
prompt_config = config.pop("document_prompt")
Expand Down

0 comments on commit 93bb19f

Please sign in to comment.