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

Uploaded Source

Built Distribution

langchain_openai-0.1.9-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.1.9.tar.gz
  • Upload date:
  • Size: 34.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.9.tar.gz
Algorithm Hash digest
SHA256 730a94d68208678b9b9f64e4959a87057e021d6600754ea8b954e7765c7a62f1
MD5 dd0b6ee46ece8d7809c4946e6b3ab84a
BLAKE2b-256 85165a9baf5175e4d13263a1562087d21a4eec344604578a648fd0d390aee567

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 afae71ef315c967685e53fe061470438000946739a9492d5f2d53bd4ae9d495a
MD5 61b3ec5ce737ce672e1e91f5e247096b
BLAKE2b-256 15bbe8f080c8408673609f15436237ec8f9d8c39ab67986807d0ca2663acd7a0

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