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
Built Distribution
File details
Details for the file langchain_openai-0.1.8rc1.tar.gz
.
File metadata
- Download URL: langchain_openai-0.1.8rc1.tar.gz
- Upload date:
- Size: 29.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29419cc73cbee9b7954267b4b0b3023af948810c093e7ebbb27bc54f3106fbf6 |
|
MD5 | 74512a0b34529b0e4964067f42fcd3cd |
|
BLAKE2b-256 | cbb6a697383c1675066b3a76ed1b540a15d4551202aaa6c9e208fdd264e41b17 |
File details
Details for the file langchain_openai-0.1.8rc1-py3-none-any.whl
.
File metadata
- Download URL: langchain_openai-0.1.8rc1-py3-none-any.whl
- Upload date:
- Size: 35.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac2aab1bc5ec019af6167419180e236a7f358895f34df7a91a37077b35d5e06e |
|
MD5 | d719b69aca11b61c6b8a5ede06320c97 |
|
BLAKE2b-256 | a671bc0268c48ce47663a136e7056a1c132e8b636b52e86e2e4912eb6f1c7f4f |