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)

LLM

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

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

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.2.13.tar.gz (43.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.2.13-py3-none-any.whl (50.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.2.13.tar.gz
  • Upload date:
  • Size: 43.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for langchain_openai-0.2.13.tar.gz
Algorithm Hash digest
SHA256 5b0eb9c7ab3f46ba7b5a53337e76586fb89b67475a465f3e3f0ab40a2f94235d
MD5 d966d90389a91f88a0189214c7a3bd63
BLAKE2b-256 ed2bdd9d51e069dc8c620ef643da48b406bcfcd6123571d9fa9e25f846cde232

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.2.13-py3-none-any.whl
Algorithm Hash digest
SHA256 4b0707694b5081b474e0d8313572fbe611de0df82cf4659068ed20ccb629d1f8
MD5 d1c3a39dba3f247281fbcbd287d49b01
BLAKE2b-256 ad1360ba429572b3d8c569a7df61d27d53c0378df0dad7499929d81e3663ed5c

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