Home / Function/ test_media_and_metadata() — langchain Function Reference

test_media_and_metadata() — langchain Function Reference

Architecture documentation for the test_media_and_metadata() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  0ee987f0_a583_79cf_b439_1e4ae6cfbd20["test_media_and_metadata()"]
  974a163b_6ea0_9385_8678_c36e3c96fcdf["TestChatPerplexityIntegration"]
  0ee987f0_a583_79cf_b439_1e4ae6cfbd20 -->|defined in| 974a163b_6ea0_9385_8678_c36e3c96fcdf
  style 0ee987f0_a583_79cf_b439_1e4ae6cfbd20 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/perplexity/tests/integration_tests/test_chat_models.py lines 103–125

    def test_media_and_metadata(self) -> None:
        """Test related questions and images."""
        chat = ChatPerplexity(
            model="sonar-pro",
            return_related_questions=True,
            return_images=True,
            # Media response overrides for video
            media_response=MediaResponse(overrides={"return_videos": True}),
        )
        message = HumanMessage(content="Apollo 11 moon landing")
        response = chat.invoke([message])

        # Check related questions
        if related := response.additional_kwargs.get("related_questions"):
            assert len(related) > 0

        # Check images
        if images := response.additional_kwargs.get("images"):
            assert len(images) > 0

        # Check videos (might not always be present but structure should handle it)
        if videos := response.additional_kwargs.get("videos"):
            assert len(videos) > 0

Domain

Subdomains

Frequently Asked Questions

What does test_media_and_metadata() do?
test_media_and_metadata() is a function in the langchain codebase, defined in libs/partners/perplexity/tests/integration_tests/test_chat_models.py.
Where is test_media_and_metadata() defined?
test_media_and_metadata() is defined in libs/partners/perplexity/tests/integration_tests/test_chat_models.py at line 103.

Analyze Your Own Codebase

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

Try Supermodel Free