Skip to content

Commit

Permalink
Update requirements, improve prompt (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 authored Oct 10, 2023
1 parent 7408a64 commit dd955c9
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions ayushma/utils/langchain.py
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ def __init__(
else:
llm = ChatOpenAI(**llm_args)

template = f"""You are a female assistant called {AI_NAME} who understands all languages and repsonds only in english and you must follow the given algorithm strictly to assist users. Remember you must give accurate answers, so stick strictly to the references as explained in algorithm. Your output must be in markdown format find important terms and add bold to it (example **word**) find numbers and add italic to it(example *word*) add bullet points to a list(example -word1\n-word2):
template = f"""You are an assistant called {AI_NAME} who understands all languages and repsonds only in english and you must follow the given algorithm strictly to assist users. Remember you must give accurate answers, so stick strictly to the references as explained in algorithm. Your output must be in markdown format find important terms and add bold to it (example **word**) find numbers and add italic to it(example *word*) add bullet points to a list(example -word1\n-word2):
Algorithm:
references = {{reference}}
/*
@@ -128,12 +128,12 @@ async def get_aresponse(
):
chat_history.append(
SystemMessage(
content="remeber only answer the question if it can be answered with the given references"
content="Remember to only answer the question if it can be answered with the given references"
)
)
try:
async_response = await self.chain.apredict(
user_msg=f"user: {user_msg}",
user_msg=user_msg,
reference=reference,
chat_history=chat_history,
)
@@ -146,11 +146,11 @@ async def get_aresponse(
def get_response(self, user_msg, reference, chat_history):
chat_history.append(
SystemMessage(
content="remeber only answer the question if it can be answered with the given references"
content="Remember to only answer the question if it can be answered with the given references"
)
)
return self.chain.predict(
user_msg=f"user: {user_msg}",
user_msg=user_msg,
reference=reference,
chat_history=chat_history,
)
2 changes: 1 addition & 1 deletion ayushma/utils/openaiapi.py
Original file line number Diff line number Diff line change
@@ -315,7 +315,7 @@ def converse(
chat_history = []
for message in previous_messages:
if message.messageType == ChatMessageType.USER:
chat_history.append(HumanMessage(content=f"Nurse: {message.message}"))
chat_history.append(HumanMessage(content=f"{message.message}"))
elif message.messageType == ChatMessageType.AYUSHMA:
chat_history.append(AIMessage(content=f"Ayushma: {message.message}"))

12 changes: 6 additions & 6 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -26,14 +26,14 @@ requests
django-storages==1.14 #

# OpenAI, Pinecone, PyPDF2 and Langchain
openai==0.28.0
openai==0.28.1
pinecone-client==2.2.4
PyPDF2==3.0.1
tiktoken==0.4.0
langchain==0.0.308
langchain==0.0.310

# For asynchronous event loop
anyio==4.0.0
# For asynchronous event loop (Do not update: anyio<4.0 is REQUIRED by langchain)
anyio==3.7.1

# Web scraping and parsing
beautifulsoup4==4.12.2
@@ -48,8 +48,8 @@ google-cloud-translate==3.12.0
googleapis-common-protos==1.60.0

# s3
boto3==1.28.61
botocore==1.31.44
boto3==1.28.62
botocore==1.31.62

# For testing framework
nltk==3.8.1

0 comments on commit dd955c9

Please sign in to comment.