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

Uploaded Source

Built Distribution

langchain_openai-0.2.14-py3-none-any.whl (50.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.2.14.tar.gz
  • Upload date:
  • Size: 43.6 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.14.tar.gz
Algorithm Hash digest
SHA256 7a514f309e356b182a337c0ed36ab3fbe34d9834a235a3b85cb7f91ae775d978
MD5 0d9980c5ac3e0569bf4d1ed21ad10c42
BLAKE2b-256 e5fd8256eba9a159f95a13c5bf7f1f49683de93b3876585b768e6be5dc3a5765

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.2.14-py3-none-any.whl
Algorithm Hash digest
SHA256 d232496662f79ece9a11caf7d798ba863e559c771bc366814f7688e0fe664fe8
MD5 2da2f2f5461da866baabb8bc9ae623aa
BLAKE2b-256 ed5463c8264d7dbc3bf31ba61bf97740fdd76386b2d4f9a58f58afd3961ce7d7

See more details on using hashes here.

Supported by

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