Skip to content

Commit c66bc29

Browse files
committed
Change to ChatOpenAI
1 parent 186451d commit c66bc29

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

services/chatbot/src/chatbot_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from langchain.chains import RetrievalQAWithSourcesChain, LLMChain
66
import os
77
from langchain.memory import ConversationBufferWindowMemory
8-
from langchain_openai import OpenAI
8+
from langchain_openai import ChatOpenAI
99
from langchain.memory import ConversationBufferWindowMemory
1010
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
1111
import logging
@@ -43,7 +43,7 @@ def load_global_retriever():
4343

4444

4545
def get_llm():
46-
llm = OpenAI(temperature=0.6, model_name="gpt-3.5-turbo-instruct")
46+
llm = ChatOpenAI(temperature=0.6, model_name="gpt-3.5-turbo-instruct")
4747
return llm
4848

4949

@@ -80,12 +80,13 @@ def get_qa_chain(llm, retriever, session):
8080
Previous conversation:
8181
"""
8282
chat_prompt_template = "{chat_history}"
83-
human_prompt_template = "{question}."
83+
human_prompt_template = "{question}"
8484
chatbot_prompt_template = "CrapBot:"
8585
messages = [
8686
("system", system_prompt_template),
8787
("placeholder", chat_prompt_template),
8888
("human", human_prompt_template),
89+
("system", chatbot_prompt_template),
8990
]
9091

9192
PROMPT = ChatPromptTemplate.from_messages(

0 commit comments

Comments
 (0)