Home / Function/ _call() — langchain Function Reference

_call() — langchain Function Reference

Architecture documentation for the _call() function in moderation.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  06d68222_a4cc_adc7_f696_ec1e270c9c3a["_call()"]
  681be7b2_2ef1_3fa3_8051_488d0318bbe1["OpenAIModerationChain"]
  06d68222_a4cc_adc7_f696_ec1e270c9c3a -->|defined in| 681be7b2_2ef1_3fa3_8051_488d0318bbe1
  8f806073_b5ea_22ed_c6ce_442f9541f9ea["_moderate()"]
  06d68222_a4cc_adc7_f696_ec1e270c9c3a -->|calls| 8f806073_b5ea_22ed_c6ce_442f9541f9ea
  style 06d68222_a4cc_adc7_f696_ec1e270c9c3a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/moderation.py lines 105–117

    def _call(
        self,
        inputs: dict[str, Any],
        run_manager: CallbackManagerForChainRun | None = None,
    ) -> dict[str, Any]:
        text = inputs[self.input_key]
        if self.openai_pre_1_0:
            results = self.client.create(text)
            output = self._moderate(text, results["results"][0])
        else:
            results = self.client.moderations.create(input=text)
            output = self._moderate(text, results.results[0])
        return {self.output_key: output}

Subdomains

Calls

Frequently Asked Questions

What does _call() do?
_call() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/moderation.py.
Where is _call() defined?
_call() is defined in libs/langchain/langchain_classic/chains/moderation.py at line 105.
What does _call() call?
_call() calls 1 function(s): _moderate.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free