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.24.tar.gz (687.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.24-py3-none-any.whl (69.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.24.tar.gz
  • Upload date:
  • Size: 687.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.24.tar.gz
Algorithm Hash digest
SHA256 cec1ab4ce7a8680af1eb11427b4384d2ceb46e9b20ff3f7beb0b0d83cab61a97
MD5 0e19f9b7bca095b776c64a17d6b99ace
BLAKE2b-256 dae17be9384c5cb6fd6d0466ac6e781e44c3d80081c624faa7a9d2f8bf3a59ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.24-py3-none-any.whl
Algorithm Hash digest
SHA256 3db7bb2964f86636276a8f4bbed4514daf13865b80896e547ff7ea13ce98e593
MD5 b9cee0541f617ab01b4218c37c18e4bb
BLAKE2b-256 fc9bb8f86d78dbc651decd684ab938a1340e1ad3ba1dbcef805e12db65dee0ba

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