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

Uploaded Source

Built Distribution

langchain_openai-0.2.5-py3-none-any.whl (50.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.2.5.tar.gz
  • Upload date:
  • Size: 43.2 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.5.tar.gz
Algorithm Hash digest
SHA256 55b98711a880474ec363267bf6cd0e2727dc00e8433731318d063a2184582c28
MD5 eac88fb48b1ad5153b0ac22f82c7d541
BLAKE2b-256 b37a2cf68955181b9571d7768dfc4229f54f21977206fe6d7a0eb39fc48be649

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 745fd9d51a5a3a9cb8839d41f3786ab38dfc539e47c713a806cbca32f3d0875c
MD5 c8e484ea026a08f561349c581c363755
BLAKE2b-256 8574f0c5d1b00f9c63246c8106b795ea792bb7ac61e92db9101716f05cfc42c7

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