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

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.2.11.tar.gz
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for langchain_openai-0.2.11.tar.gz
Algorithm Hash digest
SHA256 563bd843092d260c7ffd88b8e0e6b830f36347e058e62a6d5e9cc4c461a8da98
MD5 ea8531f04b77d5325614b86d95718a97
BLAKE2b-256 37339c43a11cad4f807311f8a22d8ca9cf25de5ac8d3b710203165cff7867e22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.2.11-py3-none-any.whl
Algorithm Hash digest
SHA256 c019ae915a5782943bee9503388e65c8622d400e0451ef885f3e4989cf35727f
MD5 a6549b18af7d347dbd427f6a366f4db4
BLAKE2b-256 6715b5a83ff73f5550d2be854265dd9c507389d69516391a46a30683a3683fcc

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