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-0.3.32.tar.gz (783.0 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-0.3.32-py3-none-any.whl (74.5 kB view details)

Uploaded Python 3

File details

Details for the file langchain_openai-0.3.32.tar.gz.

File metadata

  • Download URL: langchain_openai-0.3.32.tar.gz
  • Upload date:
  • Size: 783.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for langchain_openai-0.3.32.tar.gz
Algorithm Hash digest
SHA256 782ad669bd1bdb964456d8882c5178717adcfceecb482cc20005f770e43d346d
MD5 8670446d5ea83336c4c0d822b22c6168
BLAKE2b-256 7e19167d9ad1b6bb75406c4acceda01ef0dc1101c7f629f74441fe8a787fb190

See more details on using hashes here.

File details

Details for the file langchain_openai-0.3.32-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_openai-0.3.32-py3-none-any.whl
Algorithm Hash digest
SHA256 3354f76822f7cc76d8069831fe2a77f9bc7ff3b4f13af788bd94e4c6e853b400
MD5 b4649fb6a0d6b3cadd38dfebc8d2b9da
BLAKE2b-256 e63de22ee65fff79afe7bdfbd67844243eb279b440c882dad9e4262dcc87131f

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