Inference-API / main /prompt_templates /chunk_rerank.json
AurelioAguirre's picture
Adding query expansion and reranker
eb5a3fb
raw
history blame
2.23 kB
{
"name": "chunk_rerank",
"description": "Evaluate and rank text chunks based on their relevance to a query",
"system_message": "You are a helpful assistant that evaluates text chunks for their relevance to a query. You always respond in valid JSON format.",
"prompt_template": "Please analyze the following query and text chunks, ranking the chunks by their relevance and importance to answering the query. Prioritize chunks that contain specific, relevant information over general statements.\n\nQuery: {input_text}\n\nText Chunks to evaluate:\n{chunks}\n\nCreate a JSON response with the following fields:\n- original_query: the exact query\n- ranked_chunks: array of the top 5 most relevant chunks, ordered by importance (most important first)\n- got_chunks: set to false if no chunks were provided or if they're all irrelevant\n\nEnsure your response is valid JSON and contains only these fields.",
"response_schema": {
"type": "object",
"properties": {
"original_query": {
"type": "string",
"description": "The exact query being processed"
},
"ranked_chunks": {
"type": "array",
"items": {
"type": "string"
},
"maxItems": 5,
"description": "Top 5 most relevant chunks in order of importance"
},
"got_chunks": {
"type": "boolean",
"description": "Whether any relevant chunks were found"
}
},
"required": ["original_query", "ranked_chunks", "got_chunks"]
},
"example_response": {
"original_query": "What are the key principles of relativity?",
"ranked_chunks": [
"Einstein's theory of special relativity is based on two fundamental principles: the principle of relativity and the constancy of the speed of light.",
"The principle of relativity states that the laws of physics are the same in all inertial reference frames.",
"In special relativity, time dilation occurs when objects move at high speeds relative to one another.",
"Mass and energy are equivalent, as expressed in the famous equation E=mc².",
"The theory led to revolutionary predictions about space and time, including length contraction."
],
"got_chunks": true
}
}