AzureChatOpenAI and AzureOpenAI are components within the LangChain framework designed to interact with the Azure OpenAI Service, but they are tailored for different types of interactions with the underlying language models.
- This class is specifically designed for interacting with chat completion models like GPT-3.5 Turbo and GPT-4, which are optimized for conversational AI.
- It handles input and output in a message-based format, reflecting the turn-based nature of conversations. You provide a list of messages (user, assistant, system roles), and it returns a message response.
- Building chatbots, conversational agents, and applications that require maintaining context over multiple turns of dialogue.
- This class is designed for interacting with text completion models (older generation models like text-davinci-003) and potentially other types of models within the Azure OpenAI Service that are not primarily chat-focused.
- It typically takes a single prompt string as input and returns a generated text completion.
- Generating code, creative writing, text summarization, or other tasks where a single prompt and a single completion are sufficient.
- AzureChatOpenAI is for chat models (e.g., GPT-3.5 Turbo, GPT-4), while AzureOpenAI is for older text completion models.
- AzureChatOpenAI handles message lists for conversational turns, while AzureOpenAI handles single prompt strings for direct text generation.
- AzureChatOpenAI inherently supports conversational context through the message history you provide, making it suitable for multi-turn interactions. AzureOpenAI is more suited for single-shot text generation tasks.