test_base.py — langchain Source File
Architecture documentation for test_base.py, a python file in the langchain codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 2edc9f83_2189_a9c8_70f5_10e2e98e8272["test_base.py"] 2bf6d401_816d_d011_3b05_a6114f55ff58["collections.abc"] 2edc9f83_2189_a9c8_70f5_10e2e98e8272 --> 2bf6d401_816d_d011_3b05_a6114f55ff58 f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"] 2edc9f83_2189_a9c8_70f5_10e2e98e8272 --> f69d6389_263d_68a4_7fbf_f14c0602a9ba 17a62cb3_fefd_6320_b757_b53bb4a1c661["langchain_core.callbacks"] 2edc9f83_2189_a9c8_70f5_10e2e98e8272 --> 17a62cb3_fefd_6320_b757_b53bb4a1c661 4382dc25_6fba_324a_49e2_e9742d579385["langchain_core.outputs"] 2edc9f83_2189_a9c8_70f5_10e2e98e8272 --> 4382dc25_6fba_324a_49e2_e9742d579385 2cad93e6_586a_5d28_a74d_4ec6fd4d2227["langchain_openai"] 2edc9f83_2189_a9c8_70f5_10e2e98e8272 --> 2cad93e6_586a_5d28_a74d_4ec6fd4d2227 251bfb01_1c7e_1133_a3e7_d13a513891ea["tests.unit_tests.fake.callbacks"] 2edc9f83_2189_a9c8_70f5_10e2e98e8272 --> 251bfb01_1c7e_1133_a3e7_d13a513891ea style 2edc9f83_2189_a9c8_70f5_10e2e98e8272 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Test OpenAI llm."""
from collections.abc import Generator
import pytest
from langchain_core.callbacks import CallbackManager
from langchain_core.outputs import LLMResult
from langchain_openai import OpenAI
from tests.unit_tests.fake.callbacks import FakeCallbackHandler
def test_stream() -> None:
"""Test streaming tokens from OpenAI."""
llm = OpenAI()
for token in llm.stream("I'm Pickle Rick"):
assert isinstance(token, str)
async def test_astream() -> None:
"""Test streaming tokens from OpenAI."""
llm = OpenAI()
async for token in llm.astream("I'm Pickle Rick"):
assert isinstance(token, str)
async def test_abatch() -> None:
"""Test streaming tokens from OpenAI."""
llm = OpenAI()
result = await llm.abatch(["I'm Pickle Rick", "I'm not Pickle Rick"])
for token in result:
assert isinstance(token, str)
async def test_abatch_tags() -> None:
"""Test batch tokens from OpenAI."""
llm = OpenAI()
result = await llm.abatch(
["I'm Pickle Rick", "I'm not Pickle Rick"], config={"tags": ["foo"]}
)
for token in result:
assert isinstance(token, str)
def test_batch() -> None:
"""Test batch tokens from OpenAI."""
llm = OpenAI()
result = llm.batch(["I'm Pickle Rick", "I'm not Pickle Rick"])
for token in result:
assert isinstance(token, str)
async def test_ainvoke() -> None:
"""Test invoke tokens from OpenAI."""
llm = OpenAI()
// ... (213 more lines)
Domain
Subdomains
Functions
- mock_completion()
- test_abatch()
- test_abatch_tags()
- test_ainvoke()
- test_astream()
- test_batch()
- test_invoke()
- test_openai_abatch()
- test_openai_abatch_tags()
- test_openai_ainvoke()
- test_openai_astream()
- test_openai_async_generate()
- test_openai_async_streaming_callback()
- test_openai_batch()
- test_openai_call()
- test_openai_invoke()
- test_openai_llm_output_contains_model_name()
- test_openai_modelname_to_contextsize_invalid()
- test_openai_modelname_to_contextsize_valid()
- test_openai_multiple_prompts()
- test_openai_stop_valid()
- test_openai_streaming()
- test_openai_streaming_best_of_error()
- test_openai_streaming_call()
- test_openai_streaming_callback()
- test_openai_streaming_multiple_prompts_error()
- test_openai_streaming_n_error()
- test_stream()
Dependencies
- collections.abc
- langchain_core.callbacks
- langchain_core.outputs
- langchain_openai
- pytest
- tests.unit_tests.fake.callbacks
Source
Frequently Asked Questions
What does test_base.py do?
test_base.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, LanguageModelBase subdomain.
What functions are defined in test_base.py?
test_base.py defines 28 function(s): mock_completion, test_abatch, test_abatch_tags, test_ainvoke, test_astream, test_batch, test_invoke, test_openai_abatch, test_openai_abatch_tags, test_openai_ainvoke, and 18 more.
What does test_base.py depend on?
test_base.py imports 6 module(s): collections.abc, langchain_core.callbacks, langchain_core.outputs, langchain_openai, pytest, tests.unit_tests.fake.callbacks.
Where is test_base.py in the architecture?
test_base.py is located at libs/partners/openai/tests/integration_tests/llms/test_base.py (domain: LangChainCore, subdomain: LanguageModelBase, directory: libs/partners/openai/tests/integration_tests/llms).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free