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

This version

0.1.5

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

Uploaded Source

Built Distribution

langchain_openai-0.1.5-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_openai-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c161890f871f8675eb633dcebb53173527045996468ed9d393ed892448408ab1
MD5 0871299ff5b6972a2410703ca53a62a1
BLAKE2b-256 7660a1d3534115c35fb3e0955df61556fab064f2a7e501bb00bda0e4af240ee0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8789af68afe747fd05acbe5190e5f0f17cbcce4c07bc58f0584f169318ed9f1c
MD5 280913fa30dc4512b706e0f1fce8828c
BLAKE2b-256 5e9c4d42e1d362c84b2f51ddeeae82f366596a70173844ea7c9c8abec6ce4e1f

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