Home / Function/ change_directory() — langchain Function Reference

change_directory() — langchain Function Reference

Architecture documentation for the change_directory() function in test_loading.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a39a8c67_0bca_5506_7c34_c56c38051b9f["change_directory()"]
  eea05055_0cc3_c5ac_867f_b44ce74a7c7b["test_loading.py"]
  a39a8c67_0bca_5506_7c34_c56c38051b9f -->|defined in| eea05055_0cc3_c5ac_867f_b44ce74a7c7b
  c1870b2b_3829_9100_8e5c_ee35de86fb94["test_loading_with_template_as_file()"]
  c1870b2b_3829_9100_8e5c_ee35de86fb94 -->|calls| a39a8c67_0bca_5506_7c34_c56c38051b9f
  4bcf22a6_d46a_5591_bddb_a6519651f8f7["test_loading_few_shot_prompt_from_yaml()"]
  4bcf22a6_d46a_5591_bddb_a6519651f8f7 -->|calls| a39a8c67_0bca_5506_7c34_c56c38051b9f
  b636960c_44fd_d7f0_358a_fc2f83f80902["test_loading_few_shot_prompt_from_json()"]
  b636960c_44fd_d7f0_358a_fc2f83f80902 -->|calls| a39a8c67_0bca_5506_7c34_c56c38051b9f
  1fe39c77_4970_efbf_5251_0a1ec68eb98f["test_loading_few_shot_prompt_when_examples_in_config()"]
  1fe39c77_4970_efbf_5251_0a1ec68eb98f -->|calls| a39a8c67_0bca_5506_7c34_c56c38051b9f
  0be45c28_3007_8287_682e_b37fdda0dedc["test_loading_few_shot_prompt_example_prompt()"]
  0be45c28_3007_8287_682e_b37fdda0dedc -->|calls| a39a8c67_0bca_5506_7c34_c56c38051b9f
  style a39a8c67_0bca_5506_7c34_c56c38051b9f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_loading.py lines 18–25

def change_directory(dir_path: Path) -> Iterator[None]:
    """Change the working directory to the right folder."""
    origin = Path().absolute()
    try:
        os.chdir(dir_path)
        yield
    finally:
        os.chdir(origin)

Subdomains

Frequently Asked Questions

What does change_directory() do?
change_directory() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_loading.py.
Where is change_directory() defined?
change_directory() is defined in libs/core/tests/unit_tests/prompts/test_loading.py at line 18.
What calls change_directory()?
change_directory() is called by 5 function(s): test_loading_few_shot_prompt_example_prompt, test_loading_few_shot_prompt_from_json, test_loading_few_shot_prompt_from_yaml, test_loading_few_shot_prompt_when_examples_in_config, test_loading_with_template_as_file.

Analyze Your Own Codebase

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

Try Supermodel Free