Home / Function/ encode_image() — langchain Function Reference

encode_image() — langchain Function Reference

Architecture documentation for the encode_image() function in vectorstores.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1fa15e9e_3ad0_16db_c7ff_a4a326370de0["encode_image()"]
  d25f9e94_3ec0_b9ca_7d2f_eb7ef487ccab["Chroma"]
  1fa15e9e_3ad0_16db_c7ff_a4a326370de0 -->|defined in| d25f9e94_3ec0_b9ca_7d2f_eb7ef487ccab
  37a23069_1b1e_eff0_d830_afb8dfa98dd5["add_images()"]
  37a23069_1b1e_eff0_d830_afb8dfa98dd5 -->|calls| 1fa15e9e_3ad0_16db_c7ff_a4a326370de0
  style 1fa15e9e_3ad0_16db_c7ff_a4a326370de0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/chroma/langchain_chroma/vectorstores.py lines 487–490

    def encode_image(uri: str) -> str:
        """Get base64 string from image URI."""
        with Path(uri).open("rb") as image_file:
            return base64.b64encode(image_file.read()).decode("utf-8")

Subdomains

Called By

Frequently Asked Questions

What does encode_image() do?
encode_image() is a function in the langchain codebase, defined in libs/partners/chroma/langchain_chroma/vectorstores.py.
Where is encode_image() defined?
encode_image() is defined in libs/partners/chroma/langchain_chroma/vectorstores.py at line 487.
What calls encode_image()?
encode_image() is called by 1 function(s): add_images.

Analyze Your Own Codebase

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

Try Supermodel Free