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.4rc1.tar.gz (255.0 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.4rc1-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file langchain_openai-0.3.4rc1.tar.gz.

File metadata

  • Download URL: langchain_openai-0.3.4rc1.tar.gz
  • Upload date:
  • Size: 255.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for langchain_openai-0.3.4rc1.tar.gz
Algorithm Hash digest
SHA256 37c79114de3e553b68ebcc81eba6da9a5ea4fd73dbca2b3b09c4de7995f651f0
MD5 8ab0a18e5c8c9510860a99b2dbd081af
BLAKE2b-256 977b0699f0ee04e9c9fc670d86b00bd8adeaa2a723409e3c2f3d6fac502ebbe3

See more details on using hashes here.

File details

Details for the file langchain_openai-0.3.4rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_openai-0.3.4rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4e4cf9ca1a79af9538f8883bbcad454965e3a8a38eda5ccaa891329e8992b45
MD5 7b5140f9272b3df8752a32d8e0a108b0
BLAKE2b-256 02f03e91040aab248cf6af32bd8174391e76b03c7c40dc218d10e79447ae11e4

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