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

Uploaded Source

Built Distribution

langchain_openai-0.1.1-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.1.1.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for langchain_openai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d10e9a9fc4c8ea99ca98f23808ce44c7dcdd65354ac07ad10afe874ecf3401ca
MD5 1ab367d25001301b1424dde14d459fb6
BLAKE2b-256 20042b70b53fe5df0de7de55c2f56572c2215af9cc1528dc3a7503e34c1f919a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5cf4df5d2550af673337eafedaeec014ba52f9a25aeb8451206ca254bed01e5c
MD5 f6f2ac229b16717dad53759c4fe69b1f
BLAKE2b-256 eadb66818d1efb4bdc037396b4e0c47c423f58e6bb23155b099bae50d816db43

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