Home / File/ test_openai_tools.py — langchain Source File

test_openai_tools.py — langchain Source File

Architecture documentation for test_openai_tools.py, a python file in the langchain codebase. 9 imports, 0 dependents.

File python LangChainCore MessageInterface 9 imports 30 functions 13 classes

Entity Profile

Dependency Diagram

graph LR
  0f94a062_f577_31c7_fb9c_0f526b273e64["test_openai_tools.py"]
  02625e10_fb78_7ecd_1ee2_105ee470faf5["sys"]
  0f94a062_f577_31c7_fb9c_0f526b273e64 --> 02625e10_fb78_7ecd_1ee2_105ee470faf5
  2bf6d401_816d_d011_3b05_a6114f55ff58["collections.abc"]
  0f94a062_f577_31c7_fb9c_0f526b273e64 --> 2bf6d401_816d_d011_3b05_a6114f55ff58
  feec1ec4_6917_867b_d228_b134d0ff8099["typing"]
  0f94a062_f577_31c7_fb9c_0f526b273e64 --> feec1ec4_6917_867b_d228_b134d0ff8099
  dd5e7909_a646_84f1_497b_cae69735550e["pydantic"]
  0f94a062_f577_31c7_fb9c_0f526b273e64 --> dd5e7909_a646_84f1_497b_cae69735550e
  f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"]
  0f94a062_f577_31c7_fb9c_0f526b273e64 --> f69d6389_263d_68a4_7fbf_f14c0602a9ba
  049d69ec_d53a_d170_b6fa_35c395793702["langchain_core.exceptions"]
  0f94a062_f577_31c7_fb9c_0f526b273e64 --> 049d69ec_d53a_d170_b6fa_35c395793702
  9444498b_8066_55c7_b3a2_1d90c4162a32["langchain_core.messages"]
  0f94a062_f577_31c7_fb9c_0f526b273e64 --> 9444498b_8066_55c7_b3a2_1d90c4162a32
  0dca717d_78a1_be75_1a4d_85530433c1fb["langchain_core.output_parsers.openai_tools"]
  0f94a062_f577_31c7_fb9c_0f526b273e64 --> 0dca717d_78a1_be75_1a4d_85530433c1fb
  4382dc25_6fba_324a_49e2_e9742d579385["langchain_core.outputs"]
  0f94a062_f577_31c7_fb9c_0f526b273e64 --> 4382dc25_6fba_324a_49e2_e9742d579385
  style 0f94a062_f577_31c7_fb9c_0f526b273e64 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import sys
from collections.abc import AsyncIterator, Iterator
from typing import Any

import pydantic
import pytest
from pydantic import BaseModel, Field, ValidationError

from langchain_core.exceptions import OutputParserException
from langchain_core.messages import (
    AIMessage,
    AIMessageChunk,
    BaseMessage,
    ToolCallChunk,
)
from langchain_core.output_parsers.openai_tools import (
    JsonOutputKeyToolsParser,
    JsonOutputToolsParser,
    PydanticToolsParser,
    parse_tool_call,
)
from langchain_core.outputs import ChatGeneration

STREAMED_MESSAGES = [
    AIMessageChunk(content=""),
    AIMessageChunk(
        content="",
        additional_kwargs={
            "tool_calls": [
                {
                    "index": 0,
                    "id": "call_OwL7f5PEPJTYzw9sQlNJtCZl",
                    "function": {"arguments": "", "name": "NameCollector"},
                    "type": "function",
                }
            ]
        },
    ),
    AIMessageChunk(
        content="",
        additional_kwargs={
            "tool_calls": [
                {
                    "index": 0,
                    "id": None,
                    "function": {"arguments": '{"na', "name": None},
                    "type": None,
                }
            ]
        },
    ),
    AIMessageChunk(
        content="",
        additional_kwargs={
            "tool_calls": [
                {
                    "index": 0,
                    "id": None,
                    "function": {"arguments": 'mes":', "name": None},
                    "type": None,
// ... (1395 more lines)

Domain

Subdomains

Dependencies

  • collections.abc
  • langchain_core.exceptions
  • langchain_core.messages
  • langchain_core.output_parsers.openai_tools
  • langchain_core.outputs
  • pydantic
  • pytest
  • sys
  • typing

Frequently Asked Questions

What does test_openai_tools.py do?
test_openai_tools.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, MessageInterface subdomain.
What functions are defined in test_openai_tools.py?
test_openai_tools.py defines 30 function(s): _get_aiter, _get_iter, message, test_json_output_key_tools_parser_empty_results, test_json_output_key_tools_parser_multiple_matching_tools, test_json_output_key_tools_parser_multiple_tools_first_only, test_json_output_key_tools_parser_multiple_tools_no_match, test_json_output_key_tools_parser_parameter_combinations, test_max_tokens_error, test_parse_tool_call_partial_mode_with_none_arguments, and 20 more.
What does test_openai_tools.py depend on?
test_openai_tools.py imports 9 module(s): collections.abc, langchain_core.exceptions, langchain_core.messages, langchain_core.output_parsers.openai_tools, langchain_core.outputs, pydantic, pytest, sys, and 1 more.
Where is test_openai_tools.py in the architecture?
test_openai_tools.py is located at libs/core/tests/unit_tests/output_parsers/test_openai_tools.py (domain: LangChainCore, subdomain: MessageInterface, directory: libs/core/tests/unit_tests/output_parsers).

Analyze Your Own Codebase

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

Try Supermodel Free