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.9rc1.tar.gz (264.7 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.9rc1-py3-none-any.whl (58.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.9rc1.tar.gz
  • Upload date:
  • Size: 264.7 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.9rc1.tar.gz
Algorithm Hash digest
SHA256 ac6e4a302bd218ad631a61c86f163f315d189f0450a0f9d099070bb3dcfa85f3
MD5 eefeab4f47d683d9b6331b3d984b4dcc
BLAKE2b-256 1ff5eb0e72f6440ead214f839422c05092295a4f4dd1bbf84c826ee2a9f832c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.9rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 1686999eb6d01290748d2ddffb3b35f2b95e380d4969de9c70ecc17b3455c78c
MD5 612591c778db28cf9e3c35d72340e776
BLAKE2b-256 558ce86a53771e881d0631bc6c6867c5ad63442bd4147e36b5e92a68e1e879ad

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