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

This version

0.3.8

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.8.tar.gz (256.9 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.8-py3-none-any.whl (55.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.8.tar.gz
  • Upload date:
  • Size: 256.9 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.8.tar.gz
Algorithm Hash digest
SHA256 4d73727eda8102d1d07a2ca036278fccab0bb5e0abf353cec9c3973eb72550ec
MD5 0dfc63d5d1bed6fd0d7635d26865a721
BLAKE2b-256 2e04ae071af0b04d1c3a8040498714091afd21149f6f8ae1dbab584317d9dfd7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9004dc8ef853aece0d8f0feca7753dc97f710fa3e53874c8db66466520436dbb
MD5 dc6f72589f4964004962c5ffd7e01828
BLAKE2b-256 a5439c6a1101bcd751d52a3328a06956f85122f9aaa31da1b15a8e0f99a70317

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