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 AzureChatOpenAI

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 AzureOpenAIEmbeddings

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 Azure OpenAI

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.29.tar.gz (766.5 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.29-py3-none-any.whl (74.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.29.tar.gz
  • Upload date:
  • Size: 766.5 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.29.tar.gz
Algorithm Hash digest
SHA256 83a0455f8ce874aa1806131ca3b4db08e482be037b7457a9b3ca21a213d2ab47
MD5 44a54d3e7fdd8bac34d712fc6f38eb8d
BLAKE2b-256 5b562e2010d15118ac52760f92ebf6ce75b3508e7a1023107ea04233fd6263e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.29-py3-none-any.whl
Algorithm Hash digest
SHA256 71ae6791b3e017ec892a8062f993edc882c6665fd8385aa66e9dc3bff8205996
MD5 62c754ba231b2ec0d437e1a9bd1e61e8
BLAKE2b-256 acf2a6a73beec15e90605e6a24c4498a8592d79a72c8e81c18ed0f5e9b7308e9

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