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

Uploaded Source

Built Distribution

langchain_openai-0.0.8-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.0.8.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for langchain_openai-0.0.8.tar.gz
Algorithm Hash digest
SHA256 b7aba7fcc52305e78b08197ebc54fc45cc06dbc40ba5b913bc48a22b30a4f5c9
MD5 8b9a5157e70652ef212173fd48768971
BLAKE2b-256 c7bb451a3d2244350a40aa3dc822a1c405391bba1f79a8830986bd8b27d62260

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4862fc72cecbee0240aaa6df0234d5893dd30cd33ca23ac5cfdd86c11d2c44df
MD5 eeb6b382ff5e82a11df65e837d9eac94
BLAKE2b-256 8163012be16114559243aabcc9ec570366df84591dc9f8f3c2349a398e9b3626

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