_utils.py — langchain Source File
Architecture documentation for _utils.py, a python file in the langchain codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 20aaa94c_fc0f_12e0_a1f0_8005ccabf04b["_utils.py"] 0029f612_c503_ebcf_a452_a0fae8c9f2c3["os"] 20aaa94c_fc0f_12e0_a1f0_8005ccabf04b --> 0029f612_c503_ebcf_a452_a0fae8c9f2c3 feec1ec4_6917_867b_d228_b134d0ff8099["typing"] 20aaa94c_fc0f_12e0_a1f0_8005ccabf04b --> feec1ec4_6917_867b_d228_b134d0ff8099 bd035cf2_5933_bc0f_65e9_0dfe57627ca3["langchain_core.utils"] 20aaa94c_fc0f_12e0_a1f0_8005ccabf04b --> bd035cf2_5933_bc0f_65e9_0dfe57627ca3 77acce1d_8e2a_33a2_c02f_acee58214e55["perplexity"] 20aaa94c_fc0f_12e0_a1f0_8005ccabf04b --> 77acce1d_8e2a_33a2_c02f_acee58214e55 style 20aaa94c_fc0f_12e0_a1f0_8005ccabf04b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import os
from typing import Any
from langchain_core.utils import convert_to_secret_str
from perplexity import Perplexity
def initialize_client(values: dict[str, Any]) -> dict[str, Any]:
"""Initialize the Perplexity client."""
pplx_api_key = (
values.get("pplx_api_key")
or os.environ.get("PPLX_API_KEY")
or os.environ.get("PERPLEXITY_API_KEY")
or ""
)
values["pplx_api_key"] = convert_to_secret_str(pplx_api_key)
api_key = (
values["pplx_api_key"].get_secret_value() if values["pplx_api_key"] else None
)
if not values.get("client"):
values["client"] = Perplexity(api_key=api_key)
return values
Domain
Subdomains
Functions
Dependencies
- langchain_core.utils
- os
- perplexity
- typing
Source
Frequently Asked Questions
What does _utils.py do?
_utils.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, MessageInterface subdomain.
What functions are defined in _utils.py?
_utils.py defines 1 function(s): initialize_client.
What does _utils.py depend on?
_utils.py imports 4 module(s): langchain_core.utils, os, perplexity, typing.
Where is _utils.py in the architecture?
_utils.py is located at libs/partners/perplexity/langchain_perplexity/_utils.py (domain: LangChainCore, subdomain: MessageInterface, directory: libs/partners/perplexity/langchain_perplexity).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free