test_outputs.py — langchain Source File
Architecture documentation for test_outputs.py, a python file in the langchain codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1f0b4d17_0393_5e38_3b50_0e4927e08029["test_outputs.py"] d758344f_537f_649e_f467_b9d7442e86df["langchain_core.messages"] 1f0b4d17_0393_5e38_3b50_0e4927e08029 --> d758344f_537f_649e_f467_b9d7442e86df ac2a9b92_4484_491e_1b48_ec85e71e1d58["langchain_core.outputs"] 1f0b4d17_0393_5e38_3b50_0e4927e08029 --> ac2a9b92_4484_491e_1b48_ec85e71e1d58 style 1f0b4d17_0393_5e38_3b50_0e4927e08029 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from langchain_core.messages import HumanMessageChunk
from langchain_core.outputs import ChatGenerationChunk, GenerationChunk
def test_generation_chunk() -> None:
assert GenerationChunk(text="Hello, ") + GenerationChunk(
text="world!"
) == GenerationChunk(text="Hello, world!"), (
"GenerationChunk + GenerationChunk should be a GenerationChunk"
)
assert GenerationChunk(text="Hello, ") + GenerationChunk(
text="world!", generation_info={"foo": "bar"}
) == GenerationChunk(text="Hello, world!", generation_info={"foo": "bar"}), (
"GenerationChunk + GenerationChunk should be a GenerationChunk "
"with merged generation_info"
)
assert GenerationChunk(text="Hello, ") + GenerationChunk(
text="world!", generation_info={"foo": "bar"}
) + GenerationChunk(text="!", generation_info={"baz": "foo"}) == GenerationChunk(
text="Hello, world!!", generation_info={"foo": "bar", "baz": "foo"}
), (
"GenerationChunk + GenerationChunk should be a GenerationChunk "
"with merged generation_info"
)
def test_chat_generation_chunk() -> None:
assert ChatGenerationChunk(
message=HumanMessageChunk(content="Hello, ")
) + ChatGenerationChunk(
message=HumanMessageChunk(content="world!")
) == ChatGenerationChunk(message=HumanMessageChunk(content="Hello, world!")), (
"ChatGenerationChunk + ChatGenerationChunk should be a ChatGenerationChunk"
)
assert ChatGenerationChunk(
message=HumanMessageChunk(content="Hello, ")
) + ChatGenerationChunk(
message=HumanMessageChunk(content="world!"), generation_info={"foo": "bar"}
) == ChatGenerationChunk(
message=HumanMessageChunk(content="Hello, world!"),
generation_info={"foo": "bar"},
), (
"GenerationChunk + GenerationChunk should be a GenerationChunk "
"with merged generation_info"
)
assert ChatGenerationChunk(
message=HumanMessageChunk(content="Hello, ")
) + ChatGenerationChunk(
message=HumanMessageChunk(content="world!"), generation_info={"foo": "bar"}
) + ChatGenerationChunk(
message=HumanMessageChunk(content="!"), generation_info={"baz": "foo"}
) == ChatGenerationChunk(
message=HumanMessageChunk(content="Hello, world!!"),
generation_info={"foo": "bar", "baz": "foo"},
), (
"GenerationChunk + GenerationChunk should be a GenerationChunk "
"with merged generation_info"
)
Domain
Subdomains
Dependencies
- langchain_core.messages
- langchain_core.outputs
Source
Frequently Asked Questions
What does test_outputs.py do?
test_outputs.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in test_outputs.py?
test_outputs.py defines 2 function(s): test_chat_generation_chunk, test_generation_chunk.
What does test_outputs.py depend on?
test_outputs.py imports 2 module(s): langchain_core.messages, langchain_core.outputs.
Where is test_outputs.py in the architecture?
test_outputs.py is located at libs/core/tests/unit_tests/test_outputs.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/tests/unit_tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free