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.4

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.4.tar.gz
  • Upload date:
  • Size: 255.1 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.4.tar.gz
Algorithm Hash digest
SHA256 c6645745a1d1bf19f21ea6fa473a746bd464053ff57ce563215e6165a0c4b9f1
MD5 eaee425d5c2fff8ee3c35af0119e8a85
BLAKE2b-256 91a41270f7bad6ba0b032f8364b2fdffaa7d044bb9c6d8238ec52494a996689c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 58d0c014620eb92f4f46ff9daf584c2a7794896b1379eb85ad7be8d9f3493b61
MD5 075fd469ceaf05d7f26c45da193bf66f
BLAKE2b-256 a324a57c061a6738b89f44aa48d756945b011867cedba9a94d48729def22155c

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