_call() — langchain Function Reference
Architecture documentation for the _call() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 39b2c44c_a865_2cd7_07db_5daf7ba84304["_call()"] 1cb458d9_f8c6_d78d_c1e3_79a8b3106c08["BaseRetrievalQA"] 39b2c44c_a865_2cd7_07db_5daf7ba84304 -->|defined in| 1cb458d9_f8c6_d78d_c1e3_79a8b3106c08 811cffbd_8a9c_6a62_d725_9323fb07755c["_get_docs()"] 39b2c44c_a865_2cd7_07db_5daf7ba84304 -->|calls| 811cffbd_8a9c_6a62_d725_9323fb07755c 76742b46_481d_4a3f_d102_75a96ccd6564["_get_docs()"] 39b2c44c_a865_2cd7_07db_5daf7ba84304 -->|calls| 76742b46_481d_4a3f_d102_75a96ccd6564 style 39b2c44c_a865_2cd7_07db_5daf7ba84304 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/retrieval_qa/base.py lines 129–162
def _call(
self,
inputs: dict[str, Any],
run_manager: CallbackManagerForChainRun | None = None,
) -> dict[str, Any]:
"""Run get_relevant_text and llm on input query.
If chain has 'return_source_documents' as 'True', returns
the retrieved documents as well under the key 'source_documents'.
Example:
```python
res = indexqa({"query": "This is my query"})
answer, docs = res["result"], res["source_documents"]
```
"""
_run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager()
question = inputs[self.input_key]
accepts_run_manager = (
"run_manager" in inspect.signature(self._get_docs).parameters
)
if accepts_run_manager:
docs = self._get_docs(question, run_manager=_run_manager)
else:
docs = self._get_docs(question) # type: ignore[call-arg]
answer = self.combine_documents_chain.run(
input_documents=docs,
question=question,
callbacks=_run_manager.get_child(),
)
if self.return_source_documents:
return {self.output_key: answer, "source_documents": docs}
return {self.output_key: answer}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does _call() do?
_call() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/retrieval_qa/base.py.
Where is _call() defined?
_call() is defined in libs/langchain/langchain_classic/chains/retrieval_qa/base.py at line 129.
What does _call() call?
_call() calls 2 function(s): _get_docs, _get_docs.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free