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.19.tar.gz (544.3 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.19-py3-none-any.whl (64.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.19.tar.gz
  • Upload date:
  • Size: 544.3 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.19.tar.gz
Algorithm Hash digest
SHA256 2ff103f272d01694aef650dfe0dc64525481b89f7f9e61f5e3ef8eb21da9f5fe
MD5 179dddb4d22eafb1ec2c94e4618785f0
BLAKE2b-256 5caa4622a8c722f7bbd5261c8492d805165d845bc3212eca16b156fa48ce5626

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.19-py3-none-any.whl
Algorithm Hash digest
SHA256 0ffb9eb86e1d25909a8e406e7e1fead3bd2e8d74a7e6daa74bacf2c6971e8b99
MD5 17a4eaff8afb55b747aa63559f64fc31
BLAKE2b-256 2d301dd3bebaccdce52afc0139f4733b31d01986b42d53e4ac1a919eca9531d8

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