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

Uploaded Source

Built Distribution

langchain_openai-0.0.4-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_openai-0.0.4.tar.gz
  • Upload date:
  • Size: 22.9 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.4.tar.gz
Algorithm Hash digest
SHA256 ce474518deb27d8bce424b5beef142fe3a773ae6c03e67ae6f1032520bbab181
MD5 bf284830a210d0b1cfb4be291b60a559
BLAKE2b-256 04783f90a79fdaf49eca33db0e8b6de34e5221ce6233d334dc432b444231d268

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_openai-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e0592e6803285b19e0329124b688095d9558c756550a2dfbf3841fb7a6597585
MD5 a18bc5e63beeb205a8f84a468e9e83a6
BLAKE2b-256 32f03400db91cd38e46f74420fff171a86cad371aafb52fe6e65ec9cbe0a19ed

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