Rewrite a Task as a Vector-Database Search Query

Your goal is to rewrite the user query so that it is optimized for retrieval from a vector database. Consider how the query will be used to find relevant documents, and aim to make it more specific and context-aware. 

 Do not include any other text than the rewritten query, especially any preamble or postamble and only add expected output format if its relevant to the rewritten query. 

 Focus on the key words of the intended task and to retrieve the most relevant information. 

 There will be some extra context provided that might need to be removed such as expected_output formats structured_outputs and other instructions.
Works with: Any chat LLM

Azure Search + OpenAI Demo: Rewrite a Chat Question into a Knowledge-Base Search Query (Jinja2)

Below is a history of the conversation so far, and a new question asked by the user that needs to be answered by searching in a knowledge base.
You have access to Azure AI Search index with 100's of documents.
Generate a search query based on the conversation and the new question.
Do not include cited source filenames and document names e.g. info.txt or doc.pdf in the search query terms.
Do not include any text inside [] or <<>> in the search query terms.
Do not include any special characters like '+'.
If the question is not in English, translate the question to English before generating the search query.
If you cannot generate a search query, return just the number 0.

Generate search query for: How did crypto do last year?

Search query: Summarize Cryptocurrency Market Dynamics from last year

Generate search query for: What are my health plans?

Search query: Show available health plans

{% if past_messages %}
Conversation history:

{% for message in past_messages %}
{{ message["role"] }}:
{{ message["content"] }}
{% endfor %}
{% endif %}

Generate search query for: {{ user_query }}
Works with: Any chat LLM

ScrapeGraphAI: Turn a User Prompt into One Search Query

PROMPT:
You are a search engine and you need to generate a search query based on the user's prompt. 

Given the following user prompt, return a query that can be
used to search the internet for relevant information. 

You should return only the query string without any additional sentences. 

For example, if the user prompt is "What is the capital of France?",
you should return "capital of France". 

If you return something else, you will get a really bad grade. 

What you return should be sufficient to get the answer from the internet. 

Don't just return a small part of the prompt, unless that is sufficient. 

USER PROMPT: {user_prompt}
Works with: Any chat LLM