_call() — langchain Function Reference
Architecture documentation for the _call() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 193d32b1_2740_febf_5c97_eebfa1726864["_call()"] c827daf0_9d8e_4865_a678_af8144586d0e["FlareChain"] 193d32b1_2740_febf_5c97_eebfa1726864 -->|defined in| c827daf0_9d8e_4865_a678_af8144586d0e 275efbc2_764c_f1ab_5418_e3b25379ab50["_do_retrieval()"] 193d32b1_2740_febf_5c97_eebfa1726864 -->|calls| 275efbc2_764c_f1ab_5418_e3b25379ab50 8245ca05_0a13_88d7_9345_6e14d983a746["_extract_tokens_and_log_probs()"] 193d32b1_2740_febf_5c97_eebfa1726864 -->|calls| 8245ca05_0a13_88d7_9345_6e14d983a746 df7d80eb_6d6e_6bee_cb9e_b4eda380e41a["_low_confidence_spans()"] 193d32b1_2740_febf_5c97_eebfa1726864 -->|calls| df7d80eb_6d6e_6bee_cb9e_b4eda380e41a style 193d32b1_2740_febf_5c97_eebfa1726864 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/flare/base.py lines 198–247
def _call(
self,
inputs: dict[str, Any],
run_manager: CallbackManagerForChainRun | None = None,
) -> dict[str, Any]:
_run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager()
user_input = inputs[self.input_keys[0]]
response = ""
for _i in range(self.max_iter):
_run_manager.on_text(
f"Current Response: {response}",
color="blue",
end="\n",
)
_input = {"user_input": user_input, "context": "", "response": response}
tokens, log_probs = _extract_tokens_and_log_probs(
self.response_chain.invoke(
_input,
{"callbacks": _run_manager.get_child()},
),
)
low_confidence_spans = _low_confidence_spans(
tokens,
log_probs,
self.min_prob,
self.min_token_gap,
self.num_pad_tokens,
)
initial_response = response.strip() + " " + "".join(tokens)
if not low_confidence_spans:
response = initial_response
final_response, finished = self.output_parser.parse(response)
if finished:
return {self.output_keys[0]: final_response}
continue
marginal, finished = self._do_retrieval(
low_confidence_spans,
_run_manager,
user_input,
response,
initial_response,
)
response = response.strip() + " " + marginal
if finished:
break
return {self.output_keys[0]: response}
Domain
Subdomains
Source
Frequently Asked Questions
What does _call() do?
_call() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/flare/base.py.
Where is _call() defined?
_call() is defined in libs/langchain/langchain_classic/chains/flare/base.py at line 198.
What does _call() call?
_call() calls 3 function(s): _do_retrieval, _extract_tokens_and_log_probs, _low_confidence_spans.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free