From e6e60e24926f9fe1396d30062310c2877f1364ea Mon Sep 17 00:00:00 2001 From: aditya thomas Date: Sat, 2 Mar 2024 02:02:20 +0530 Subject: [PATCH] docs: ChatOpenAI update module import path and calling method (#18169) **Description:** (a) Update to the module import path to reflect the splitting up of langchain into separate packages (b) Update to the documentation to include the new calling method (invoke) --- docs/docs/integrations/chat/openai.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/integrations/chat/openai.ipynb b/docs/docs/integrations/chat/openai.ipynb index d5fe3e76605..dfbae24ba27 100644 --- a/docs/docs/integrations/chat/openai.ipynb +++ b/docs/docs/integrations/chat/openai.ipynb @@ -29,12 +29,12 @@ }, "outputs": [], "source": [ - "from langchain.prompts.chat import (\n", + "from langchain_core.messages import HumanMessage, SystemMessage\n", + "from langchain_core.prompts.chat import (\n", " ChatPromptTemplate,\n", " HumanMessagePromptTemplate,\n", " SystemMessagePromptTemplate,\n", ")\n", - "from langchain_core.messages import HumanMessage, SystemMessage\n", "from langchain_openai import ChatOpenAI" ] }, @@ -91,7 +91,7 @@ " content=\"Translate this sentence from English to French. I love programming.\"\n", " ),\n", "]\n", - "chat(messages)" + "chat.invoke(messages)" ] }, { @@ -144,7 +144,7 @@ ")\n", "\n", "# get a chat completion from the formatted messages\n", - "chat(\n", + "chat.invoke(\n", " chat_prompt.format_prompt(\n", " input_language=\"English\", output_language=\"French\", text=\"I love programming.\"\n", " ).to_messages()\n",