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.12.tar.gz (43.4 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.2.12-py3-none-any.whl (50.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.2.12.tar.gz
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for langchain_openai-0.2.12.tar.gz
Algorithm Hash digest
SHA256 8b92096623065a2820e89aa5fb0a262fb109d56c346e3b09ba319af424c45cd1
MD5 f8b45e8c92579805f6066101ec3cee97
BLAKE2b-256 073d23166abcdc544161d283c78b18c49c50091640a71af3b70c325e3304a6c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 916965c45584d9ea565825ad3bb7629b1ff57f12f36d4b937e5b7d65903839d6
MD5 6477652426ecea10fecfa0ea78e00793
BLAKE2b-256 cd017a0259929474c47cadecaef64fd9361a95c8091d5f88d53c54d251abf05f

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