Home / Function/ test_translate_grounding_metadata_web() — langchain Function Reference

test_translate_grounding_metadata_web() — langchain Function Reference

Architecture documentation for the test_translate_grounding_metadata_web() function in test_google_genai.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8306e9f7_e873_a81b_8a5e_a57691fbad5c["test_translate_grounding_metadata_web()"]
  25aec1a3_6028_10e6_bb5b_1c7319a29818["test_google_genai.py"]
  8306e9f7_e873_a81b_8a5e_a57691fbad5c -->|defined in| 25aec1a3_6028_10e6_bb5b_1c7319a29818
  style 8306e9f7_e873_a81b_8a5e_a57691fbad5c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/block_translators/test_google_genai.py lines 8–48

def test_translate_grounding_metadata_web() -> None:
    """Test translation of web grounding metadata to citations."""
    grounding_metadata = {
        "grounding_chunks": [
            {
                "web": {
                    "uri": "https://example.com",
                    "title": "Example Site",
                },
                "maps": None,
            }
        ],
        "grounding_supports": [
            {
                "segment": {
                    "start_index": 0,
                    "end_index": 13,
                    "text": "Test response",
                },
                "grounding_chunk_indices": [0],
                "confidence_scores": [],
            }
        ],
        "web_search_queries": ["test query"],
    }

    citations = translate_grounding_metadata_to_citations(grounding_metadata)

    assert len(citations) == 1
    citation = citations[0]
    assert citation["type"] == "citation"
    assert citation.get("url") == "https://example.com"
    assert citation.get("title") == "Example Site"
    assert citation.get("start_index") == 0
    assert citation.get("end_index") == 13
    assert citation.get("cited_text") == "Test response"

    extras = citation.get("extras", {})["google_ai_metadata"]
    assert extras["web_search_queries"] == ["test query"]
    assert extras["grounding_chunk_index"] == 0
    assert "place_id" not in extras

Domain

Subdomains

Frequently Asked Questions

What does test_translate_grounding_metadata_web() do?
test_translate_grounding_metadata_web() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/block_translators/test_google_genai.py.
Where is test_translate_grounding_metadata_web() defined?
test_translate_grounding_metadata_web() is defined in libs/core/tests/unit_tests/messages/block_translators/test_google_genai.py at line 8.

Analyze Your Own Codebase

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

Try Supermodel Free