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)

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

LLM (Legacy)

LLM refers to the legacy text-completion models that preceded chat models. 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

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_openai-0.3.14-py3-none-any.whl (62.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.14.tar.gz
  • Upload date:
  • Size: 270.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for langchain_openai-0.3.14.tar.gz
Algorithm Hash digest
SHA256 0662db78620c2e5c3ccfc1c36dc959c0ddc80e6bdf7ef81632cbf4b2cc9b9461
MD5 7f1fc0671c0f3b7b8ffe271f9c260cfb
BLAKE2b-256 7fec8042fd9b8cfb8e295eaf673c79fc8139aca0dd75506241b69e77efe2b850

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.14-py3-none-any.whl
Algorithm Hash digest
SHA256 b8e648d2d7678a5540818199d141ff727c6f1514294b3e1e999a95357c9d66a0
MD5 2f8b121034032113849909f9e1caed75
BLAKE2b-256 6f34d7af3c272fbdd214aa74d7bb23ef36eb6c3463fd557f2f0cd5126ea41536

See more details on using hashes here.

Supported by

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