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

Uploaded Source

Built Distribution

langchain_openai-0.1.20-py3-none-any.whl (48.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.1.20.tar.gz
  • Upload date:
  • Size: 42.0 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.20.tar.gz
Algorithm Hash digest
SHA256 2c91e9f771541076b138e65dd4c5427b26957a2272406a7f4ee747d7896f9b35
MD5 70c1048f3a9b290f998400e492620376
BLAKE2b-256 42d0235841108357f0772255fffa64a74af1b4f5b331dcdbe053093e486494f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.1.20-py3-none-any.whl
Algorithm Hash digest
SHA256 232ebfe90b1898ef7cf181e364d45191edcf04bfc31b292ecaa1d2121942c28e
MD5 05f7b045dd9f41f8fe86e358cb773453
BLAKE2b-256 aa1caebc87392546cb90e143e299a3454b2fcecd8055ad73d6c09a43f5994f71

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