ProvidersOpenAIOn this pageOpenAIAll functionality related to OpenAIOpenAI is American artificial intelligence (AI) research laboratory
consisting of the non-profit OpenAI Incorporated
and its for-profit subsidiary corporation OpenAI Limited Partnership.
OpenAI conducts AI research with the declared intention of promoting and developing a friendly AI.
OpenAI systems run on an Azure-based supercomputing platform from Microsoft.The OpenAI API is powered by a diverse set of models with different capabilities and price points.ChatGPT is the Artificial Intelligence (AI) chatbot developed by OpenAI.Installation and Setup​Install the Python SDK withpip install openaiGet an OpenAI api key and set it as an environment variable (OPENAI_API_KEY)If you want to use OpenAI's tokenizer (only available for Python 3.9+), install itpip install tiktokenLLM​See a usage example.from langchain.llms import OpenAIIf you are using a model hosted on Azure, you should use different wrapper for that:from langchain.llms import AzureOpenAIFor a more detailed walkthrough of the Azure wrapper, see hereChat model​See a usage example.from langchain.chat_models import ChatOpenAIIf you are using a model hosted on Azure, you should use different wrapper for that:from langchain.llms import AzureChatOpenAIFor a more detailed walkthrough of the Azure wrapper, see hereText Embedding Model​See a usage examplefrom langchain.embeddings import OpenAIEmbeddingsTokenizer​There are several places you can use the tiktoken tokenizer. By default, it is used to count tokens
for OpenAI LLMs.You can also use it to count tokens when splitting documents with from langchain.text_splitter import CharacterTextSplitterCharacterTextSplitter.from_tiktoken_encoder(...)For a more detailed walkthrough of this, see this notebookDocument Loader​See a usage example.from langchain.document_loaders.chatgpt import ChatGPTLoaderRetriever​See a usage example.from langchain.retrievers import ChatGPTPluginRetrieverChain​See a usage example.from langchain.chains import OpenAIModerationChainPreviousMicrosoftNextActiveloop Deep LakeInstallation and SetupLLMChat modelText Embedding ModelTokenizerDocument LoaderRetrieverChain