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

Uploaded Source

Built Distribution

langchain_openai-0.0.3-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_openai-0.0.3.tar.gz
Algorithm Hash digest
SHA256 19720510abcd7d6217a47d551def7779dc001aebbf978bda5c03e0a8c8167ac3
MD5 f51e21720a832004ff2185ab74c34a98
BLAKE2b-256 71b45875000e919d29d37126290ace8749a9d011eaaefdfb04ba742cab094864

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 32d8ae288e212ed47af418ffd216c8af3b8115514bb39127ca9e2910c06fc6b2
MD5 2b4ceb3e37f68721d002910df4b5b947
BLAKE2b-256 ff52fae28fb6d5bc313927166f00c50f28cc569517394c4dec40eeb75e9b1802

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