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.11.tar.gz (267.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.11-py3-none-any.whl (60.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.3.11.tar.gz
  • Upload date:
  • Size: 267.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.11.tar.gz
Algorithm Hash digest
SHA256 4de846b2770c2b15bee4ec8034af064bfecb01fa86d4c5ff3f427ee337f0e98c
MD5 7a99f4d17c6fc4bc1c2e887b4389fe00
BLAKE2b-256 77d6dc77062c0b7c09f18d10a94a33920a69b6bee13079905d638bfdb7300e97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.3.11-py3-none-any.whl
Algorithm Hash digest
SHA256 95cf602322d43d13cb0fd05cba9bc4cffd7024b10b985d38f599fcc502d2d4d0
MD5 e1747a5e7798e736e83a45665ee71502
BLAKE2b-256 959f08696493db3c3fa238c13eee9db6386dbcebe0fc164c8ce6a20afdde53a7

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