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.13.tar.gz (269.8 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.13-py3-none-any.whl (61.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.13.tar.gz
  • Upload date:
  • Size: 269.8 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.13.tar.gz
Algorithm Hash digest
SHA256 75038efbf686f4b5fe2b6bdb75c43790d563ecd61984fd1d51d6d51c53609d64
MD5 72c83a8417bcd56c8afb4623b4a4d200
BLAKE2b-256 87b6c8e86fa8fd3c6feab9c976da505e29abb50fc29fd323f869d14645d077a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.13-py3-none-any.whl
Algorithm Hash digest
SHA256 2ca3f1865df32d03c3bd85c77f11f0ffd81b157b4e363291741c65c81463606a
MD5 2f2c022b838041ae33aad10c55a3b45d
BLAKE2b-256 6d9dbe6d6a15b22a97209060f4f10d7160626bb173c4b986db373972c965b9c8

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