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.34.tar.gz (785.9 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.34-py3-none-any.whl (75.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_openai-0.3.34.tar.gz
Algorithm Hash digest
SHA256 57916d462be5b8fd19e5cb2f00d4e5cf0465266a292d583de2fc693a55ba190e
MD5 8cfda55dd9f2984eb793988f8d07648d
BLAKE2b-256 752391461c6c2b1c8ceeadd6fefe453a03b1537afeff4ace3c118d7e7659f5a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.34-py3-none-any.whl
Algorithm Hash digest
SHA256 08d61d68a6d869c70d542171e149b9065668dedfc4fafcd4de8aeb5b933030a9
MD5 02868572f329be81c6d349e6bd930558
BLAKE2b-256 6694132aff5a1ed4ebfe7b4d3e4dbf30b9f70ce2bd2ac3470d0c0e742845afb1

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