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 here

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 here

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 here

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.2.tar.gz (48.4 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.2-py3-none-any.whl (54.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.2.tar.gz
  • Upload date:
  • Size: 48.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for langchain_openai-0.3.2.tar.gz
Algorithm Hash digest
SHA256 c2c80ac0208eb7cefdef96f6353b00fa217979ffe83f0a21cc8666001df828c1
MD5 0bed1623046eb88b416c22adbb48d46c
BLAKE2b-256 2eb6711dc59041ca3a93461ccc176f90f6ab321cc41b24b70031a68928d3086f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8674183805e26d3ae3f78cc44f79fe0b2066f61e2de0e7e18be3b86f0d3b2759
MD5 06e25eda22a8b2d3b5fc084a597d5acb
BLAKE2b-256 009f00b39a6b782e6a05b3536fc82d2a3cd50402ad273c6c742b180538abcc63

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