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.10.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.10-py3-none-any.whl (50.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_openai-0.2.10.tar.gz
Algorithm Hash digest
SHA256 878200a84d80353fc47720631bf591157e56b6a3923e5f7b13c7f61c82999b50
MD5 fa4d21949ef6f9c2103ca77743085423
BLAKE2b-256 d6463ca4e0e6205fcd8ced434918234f3d4560baa346f662b42878627f0c9426

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 b06a14d99ab81343f23ced83de21fc1cfcd79c9fb96fdbd9070ad018038c5602
MD5 14a396376c0398954d6163212af463a7
BLAKE2b-256 c336a5426bf8195af460aefefe9c15bbf091a549cfd9cb243efd167d6a7b3a42

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