CsabaConsulting / ThruThinkCohereWeaviateChat

Cohere and Weaviate powered ThruThink support chat on Streamlit
https://thruthinksupport.streamlit.app/
MIT License
1 stars 3 forks source link

Prompt engineer the query variation prompt #8

Closed MrCsabaToth closed 9 months ago

MrCsabaToth commented 9 months ago

Came across https://github.com/pinecone-io/examples/blob/master/learn/generation/langchain/handbook/10-langchain-multi-query.ipynb in #6 https://www.youtube.com/watch?v=VFf8XJUIHnU

His prompt:

template = """
Your task is to generate 3 different search queries that aim to
answer the user question from multiple perspectives. The user questions
are focused on Large Language Models, Machine Learning, and related
disciplines.
Each query MUST tackle the question from a different viewpoint, we
want to get a variety of RELEVANT search results.
Provide these alternative questions separated by newlines.
Original question: {question}
"""
MrCsabaToth commented 9 months ago

https://python.langchain.com/docs/modules/data_connection/retrievers/MultiQueryRetriever 's query:

template="""You are an AI language model assistant. Your task is to generate five 
different versions of the given user question to retrieve relevant documents from a vector 
database. By generating multiple perspectives on the user question, your goal is to help
the user overcome some of the limitations of the distance-based similarity search. 
Provide these alternative questions separated by newlines.
Original question: {question}""",

Both of these queries emphasize the multiple perspective.