Home / File/ azure.py — langchain Source File

azure.py — langchain Source File

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

Entity Profile

Dependency Diagram

graph LR
  4e8f9124_9268_805a_3fef_070a80b70239["azure.py"]
  2a7f66a7_8738_3d47_375b_70fcaa6ac169["logging"]
  4e8f9124_9268_805a_3fef_070a80b70239 --> 2a7f66a7_8738_3d47_375b_70fcaa6ac169
  cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"]
  4e8f9124_9268_805a_3fef_070a80b70239 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  4e8f9124_9268_805a_3fef_070a80b70239 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  45fc8fd3_e815_b442_a6d1_0dedc9327b62["openai"]
  4e8f9124_9268_805a_3fef_070a80b70239 --> 45fc8fd3_e815_b442_a6d1_0dedc9327b62
  ba43b74d_3099_7e1c_aac3_cf594720469e["langchain_core.language_models"]
  4e8f9124_9268_805a_3fef_070a80b70239 --> ba43b74d_3099_7e1c_aac3_cf594720469e
  f4d905c6_a2b2_eb8f_be9b_7808b72f6a16["langchain_core.utils"]
  4e8f9124_9268_805a_3fef_070a80b70239 --> f4d905c6_a2b2_eb8f_be9b_7808b72f6a16
  6e58aaea_f08e_c099_3cc7_f9567bfb1ae7["pydantic"]
  4e8f9124_9268_805a_3fef_070a80b70239 --> 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7
  91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"]
  4e8f9124_9268_805a_3fef_070a80b70239 --> 91721f45_4909_e489_8c1f_084f8bd87145
  4271a109_76ed_f75d_f4f5_19af386bcf65["langchain_openai.llms.base"]
  4e8f9124_9268_805a_3fef_070a80b70239 --> 4271a109_76ed_f75d_f4f5_19af386bcf65
  style 4e8f9124_9268_805a_3fef_070a80b70239 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Azure OpenAI large language models. Not to be confused with chat models."""

from __future__ import annotations

import logging
from collections.abc import Awaitable, Callable, Mapping
from typing import Any, cast

import openai
from langchain_core.language_models import LangSmithParams
from langchain_core.utils import from_env, secret_from_env
from pydantic import Field, SecretStr, model_validator
from typing_extensions import Self

from langchain_openai.llms.base import BaseOpenAI

logger = logging.getLogger(__name__)


class AzureOpenAI(BaseOpenAI):
    """Azure-specific OpenAI large language models.

    To use, you should have the `openai` python package installed, and the
    environment variable `OPENAI_API_KEY` set with your API key.

    Any parameters that are valid to be passed to the openai.create call can be passed
    in, even if not explicitly saved on this class.

    Example:
        ```python
        from langchain_openai import AzureOpenAI

        openai = AzureOpenAI(model_name="gpt-3.5-turbo-instruct")
        ```
    """

    azure_endpoint: str | None = Field(
        default_factory=from_env("AZURE_OPENAI_ENDPOINT", default=None)
    )
    """Your Azure endpoint, including the resource.

        Automatically inferred from env var `AZURE_OPENAI_ENDPOINT` if not provided.

        Example: `'https://example-resource.azure.openai.com/'`
    """
    deployment_name: str | None = Field(default=None, alias="azure_deployment")
    """A model deployment.

        If given sets the base client URL to include `/deployments/{azure_deployment}`.

        !!! note
            This means you won't be able to use non-deployment endpoints.

    """
    openai_api_version: str | None = Field(
        alias="api_version",
        default_factory=from_env("OPENAI_API_VERSION", default=None),
    )
    """Automatically inferred from env var `OPENAI_API_VERSION` if not provided."""
    # Check OPENAI_KEY for backwards compatibility.
// ... (173 more lines)

Subdomains

Classes

Dependencies

  • collections.abc
  • langchain_core.language_models
  • langchain_core.utils
  • langchain_openai.llms.base
  • logging
  • openai
  • pydantic
  • typing
  • typing_extensions

Frequently Asked Questions

What does azure.py do?
azure.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What does azure.py depend on?
azure.py imports 9 module(s): collections.abc, langchain_core.language_models, langchain_core.utils, langchain_openai.llms.base, logging, openai, pydantic, typing, and 1 more.
Where is azure.py in the architecture?
azure.py is located at libs/partners/openai/langchain_openai/llms/azure.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/partners/openai/langchain_openai/llms).

Analyze Your Own Codebase

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

Try Supermodel Free