Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

langchain-openai

This package contains the LangChain integrations for OpenAI through their openai SDK.

Installation and Setup

  • Install the LangChain partner package
pip install langchain-openai
  • Get an OpenAI api key and set it as an environment variable (OPENAI_API_KEY)

Chat model

See a usage example.

from langchain_openai import ChatOpenAI

If you are using a model hosted on Azure, you should use different wrapper for that:

from langchain_openai import AzureChatOpenAI

For a more detailed walkthrough of the Azure wrapper, see AzureChatOpenAI

Text Embedding Model

See a usage example

from langchain_openai import OpenAIEmbeddings

If you are using a model hosted on Azure, you should use different wrapper for that:

from langchain_openai import AzureOpenAIEmbeddings

For a more detailed walkthrough of the Azure wrapper, see AzureOpenAIEmbeddings

LLM (Legacy)

LLM refers to the legacy text-completion models that preceded chat models. See a usage example.

from langchain_openai import OpenAI

If you are using a model hosted on Azure, you should use different wrapper for that:

from langchain_openai import AzureOpenAI

For a more detailed walkthrough of the Azure wrapper, see Azure OpenAI

Metadata

Release files for langchain-openai 1.0.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-openai 1.0.0a1
File Size Uploaded Provenance Actions
langchain_openai-1.0.0a1.tar.gz 803.0 kB Without provenance Details for langchain_openai-1.0.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-openai 1.0.0a1
File Interpreter ABI Platform Actions
langchain_openai-1.0.0a1-py3-none-any.whl Python 3 none any Details for langchain_openai-1.0.0a1-py3-none-any.whl

Total release size: 879.0 kB

Release files / langchain_openai-1.0.0a1.tar.gz

Download URL langchain_openai-1.0.0a1.tar.gz
Size 803.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b3deb88789d77889635ed5b24b954508d4aa140cc63cda0307df9e6b6158253a
BLAKE2b-256 checksum
How to use checksums
fbdd403a48f0741436726146f925f94ef335dbefd39d488f9fadc846e40d9379
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / langchain_openai-1.0.0a1-py3-none-any.whl

Download URL langchain_openai-1.0.0a1-py3-none-any.whl
Size 76.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f4ef4ce32f950c8ae70d4715dde80fd9a8cf2fd409f45782869c350076e03ca
BLAKE2b-256 checksum
How to use checksums
12e130257e0266afde67b96f6aee1b3edb6d1adca83f5305d3194434cc93a60d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Security for langchain-openai 1.0.0a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page