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.14.tar.gz (39.6 kB view details)

Uploaded Source

Built Distribution

langchain_openai-0.1.14-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_openai-0.1.14.tar.gz
Algorithm Hash digest
SHA256 1f13d6041e8bedddf6eb47ccad7416e05af38fa169324f7f1bdf4f385780f8d8
MD5 bf3782343701c3692c8cc18150bda414
BLAKE2b-256 54190e1502ff1812381ea37accb652d88c32c701de449be1b90b7e9cda0912f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 fcd34cc5b5713798908a5828d364b4426e3b1afccbd564d344e5477acb86634a
MD5 ec62f4a6cd8aa7975929abbcd944c8c2
BLAKE2b-256 a206d200c9e3f8f17bb50a07df9b7c92894ad5e0c1d65729ea0e438a36371858

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page