Home / Function/ _get_openai_client() — langchain Function Reference

_get_openai_client() — langchain Function Reference

Architecture documentation for the _get_openai_client() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c645c8bb_ce81_8c6f_5f9a_71f4971c6a53["_get_openai_client()"]
  0331239a_f3d1_a093_b494_8cbb257ab96b["base.py"]
  c645c8bb_ce81_8c6f_5f9a_71f4971c6a53 -->|defined in| 0331239a_f3d1_a093_b494_8cbb257ab96b
  9b0b4c70_d21f_7b00_336a_51e3a1be614e["create_assistant()"]
  9b0b4c70_d21f_7b00_336a_51e3a1be614e -->|calls| c645c8bb_ce81_8c6f_5f9a_71f4971c6a53
  style c645c8bb_ce81_8c6f_5f9a_71f4971c6a53 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/openai_assistant/base.py lines 74–87

def _get_openai_client() -> openai.OpenAI:
    try:
        import openai

        return openai.OpenAI()
    except ImportError as e:
        msg = "Unable to import openai, please install with `pip install openai`."
        raise ImportError(msg) from e
    except AttributeError as e:
        msg = (
            "Please make sure you are using a v1.1-compatible version of openai. You "
            'can install with `pip install "openai>=1.1"`.'
        )
        raise AttributeError(msg) from e

Subdomains

Called By

Frequently Asked Questions

What does _get_openai_client() do?
_get_openai_client() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/openai_assistant/base.py.
Where is _get_openai_client() defined?
_get_openai_client() is defined in libs/langchain/langchain_classic/agents/openai_assistant/base.py at line 74.
What calls _get_openai_client()?
_get_openai_client() is called by 1 function(s): create_assistant.

Analyze Your Own Codebase

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

Try Supermodel Free