Home / Function/ test_chat_openai_streaming_generation_info() — langchain Function Reference

test_chat_openai_streaming_generation_info() — langchain Function Reference

Architecture documentation for the test_chat_openai_streaming_generation_info() function in test_base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  39377d85_e451_e328_3858_72ffb8612fd4["test_chat_openai_streaming_generation_info()"]
  bd382a4e_442c_13ae_530c_6e34bc43623d["test_base.py"]
  39377d85_e451_e328_3858_72ffb8612fd4 -->|defined in| bd382a4e_442c_13ae_530c_6e34bc43623d
  1af1a498_c875_c738_b8bd_9cae9db34f7d["on_llm_end()"]
  39377d85_e451_e328_3858_72ffb8612fd4 -->|calls| 1af1a498_c875_c738_b8bd_9cae9db34f7d
  style 39377d85_e451_e328_3858_72ffb8612fd4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/integration_tests/chat_models/test_base.py lines 177–193

def test_chat_openai_streaming_generation_info() -> None:
    """Test that generation info is preserved when streaming."""

    class _FakeCallback(FakeCallbackHandler):
        saved_things: dict = {}

        def on_llm_end(self, *args: Any, **kwargs: Any) -> Any:
            # Save the generation
            self.saved_things["generation"] = args[0]

    callback = _FakeCallback()
    callback_manager = CallbackManager([callback])
    chat = ChatOpenAI(max_tokens=2, temperature=0, callbacks=callback_manager)  # type: ignore[call-arg]
    list(chat.stream("hi"))
    generation = callback.saved_things["generation"]
    # `Hello!` is two tokens, assert that is what is returned
    assert generation.generations[0][0].text == "Hello!"

Domain

Subdomains

Calls

Frequently Asked Questions

What does test_chat_openai_streaming_generation_info() do?
test_chat_openai_streaming_generation_info() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/chat_models/test_base.py.
Where is test_chat_openai_streaming_generation_info() defined?
test_chat_openai_streaming_generation_info() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_base.py at line 177.
What does test_chat_openai_streaming_generation_info() call?
test_chat_openai_streaming_generation_info() calls 1 function(s): on_llm_end.

Analyze Your Own Codebase

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

Try Supermodel Free