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
Hashes for langchain_openai-0.1.21rc2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57dd0fa90528f5030c3aaeca6600177f8fcf617b3f76fa03cca7cb03c7d93c54 |
|
MD5 | c5ba0317c13234c9eceffd6497ce1be6 |
|
BLAKE2b-256 | ee9fc3adfca4561c8d294b37ae86a69217d08ff3e6f22ec550fcc1bd34f5d71f |
Hashes for langchain_openai-0.1.21rc2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49e7209c2896cd59cfcc9565b4f836328469c1d4a23dde55ae902b3e52ada31d |
|
MD5 | f7953335826eb17895b5df64b0c4b177 |
|
BLAKE2b-256 | 7ca702364171b633b42287d9116132a14684744056ad85ab62b06b5e75a794c1 |