Home / Function/ _get_metadata() — langchain Function Reference

_get_metadata() — langchain Function Reference

Architecture documentation for the _get_metadata() function in retrievers.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  4ff29015_cd7b_30be_cf2e_cc8ce78e2742["_get_metadata()"]
  adcb3d5b_1090_8f27_8ae7_b26d830eb673["retrievers.py"]
  4ff29015_cd7b_30be_cf2e_cc8ce78e2742 -->|defined in| adcb3d5b_1090_8f27_8ae7_b26d830eb673
  5cd1a72f_50ef_d2d2_ed38_f5ce81dd0a4b["_get_relevant_documents()"]
  5cd1a72f_50ef_d2d2_ed38_f5ce81dd0a4b -->|calls| 4ff29015_cd7b_30be_cf2e_cc8ce78e2742
  style 4ff29015_cd7b_30be_cf2e_cc8ce78e2742 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/exa/langchain_exa/retrievers.py lines 20–36

def _get_metadata(result: Any) -> dict[str, Any]:
    """Get the metadata from a result object."""
    metadata = {
        "title": result.title,
        "url": result.url,
        "id": result.id,
        "score": result.score,
        "published_date": result.published_date,
        "author": result.author,
    }
    if getattr(result, "highlights"):
        metadata["highlights"] = result.highlights
    if getattr(result, "highlight_scores"):
        metadata["highlight_scores"] = result.highlight_scores
    if getattr(result, "summary"):
        metadata["summary"] = result.summary
    return metadata

Domain

Subdomains

Frequently Asked Questions

What does _get_metadata() do?
_get_metadata() is a function in the langchain codebase, defined in libs/partners/exa/langchain_exa/retrievers.py.
Where is _get_metadata() defined?
_get_metadata() is defined in libs/partners/exa/langchain_exa/retrievers.py at line 20.
What calls _get_metadata()?
_get_metadata() is called by 1 function(s): _get_relevant_documents.

Analyze Your Own Codebase

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

Try Supermodel Free