Skip to main content

An integration package connecting OpenAI and LangChain

Project description

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

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_openai-1.0.0a3.tar.gz (801.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_openai-1.0.0a3-py3-none-any.whl (77.4 kB view details)

Uploaded Python 3

File details

Details for the file langchain_openai-1.0.0a3.tar.gz.

File metadata

  • Download URL: langchain_openai-1.0.0a3.tar.gz
  • Upload date:
  • Size: 801.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for langchain_openai-1.0.0a3.tar.gz
Algorithm Hash digest
SHA256 9aa35608a0125bfadc64ba044995fe3ca5b93b12067ba7063fade579aed9eda7
MD5 8ccc419b43e30863e8e8f7f3842f1dc7
BLAKE2b-256 db63deef34172b1d454608c07a92c2cea1c1c745def5b7a3aad42667a3935d0f

See more details on using hashes here.

File details

Details for the file langchain_openai-1.0.0a3-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_openai-1.0.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 849a4409ea1b6b4ef0ff4fe8e15e1bb37695f42e218085d64ad6d259b93c3953
MD5 acea8e24a1ff49e95f2f2cf3e581e416
BLAKE2b-256 0567cbc851457149ea48b66c6709fcb33903de2a052506b9201d59f202df7242

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page