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.1.23.tar.gz (45.4 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.1.23-py3-none-any.whl (52.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.1.23.tar.gz
  • Upload date:
  • Size: 45.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for langchain_openai-0.1.23.tar.gz
Algorithm Hash digest
SHA256 ed7f16671ea0af177ac5f82d5645a746c5097c56f97b31798e5c07b5c84f0eed
MD5 284db90bf6e1f23ff761f8dd8d174f50
BLAKE2b-256 91cb216fd869f96b58716062e939cc6ad11f150f96198fbc750bec1c53c0f858

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.1.23-py3-none-any.whl
Algorithm Hash digest
SHA256 8e3d215803e157f26480c6108eb4333629832b1a0e746723060c24f93b8b78f4
MD5 46a9f4d11f8614bc18a96f39e60c6394
BLAKE2b-256 0ef112cd80e136b6bf5f498bee178084e71d48f664e5639e9cc7f900244d9f1c

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