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.33.tar.gz (784.5 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.33-py3-none-any.whl (75.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.33.tar.gz
  • Upload date:
  • Size: 784.5 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.33.tar.gz
Algorithm Hash digest
SHA256 2dec058332ea9e8977cd91df6515b95952e187ac7484f349c3fe91d936a92375
MD5 70eb47e54a70a085c3a79467d37355a7
BLAKE2b-256 ff664245ffe1fed8cd3812be9d228be50baa406cbb0ef5bd7cb1d98d82dcfe37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.33-py3-none-any.whl
Algorithm Hash digest
SHA256 2d52aab6d2af61da9bb9470616ce782128f4be59df965caee3dece30ae6b2bc4
MD5 62a419f1ed6c0721fdf400cf4e6ae8f1
BLAKE2b-256 6731af0486b7ad8a49f3c5c852ca2b3a7f6d8526cc71a405045dd959c36ec5db

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