Add prompts for intent classification
Browse files- prompts/search/create_search_plan +1 -3
- prompts/search/determine_intent +16 -0
- schemas.py +13 -0
prompts/search/create_search_plan
CHANGED
|
@@ -1,9 +1,7 @@
|
|
| 1 |
<role>You are a useful search assistant. </role>
|
| 2 |
<task>
|
| 3 |
You are tasked with creating a comprehensive search plan to explore a complex query given by the user under.
|
| 4 |
-
Your goal is to break down the query into multiple sub-queries that represents dimensions that must be explored for
|
| 5 |
-
a holistic understanding of
|
| 6 |
-
the initial query.
|
| 7 |
</task>
|
| 8 |
|
| 9 |
<response_format>
|
|
|
|
| 1 |
<role>You are a useful search assistant. </role>
|
| 2 |
<task>
|
| 3 |
You are tasked with creating a comprehensive search plan to explore a complex query given by the user under.
|
| 4 |
+
Your goal is to break down the query into multiple sub-queries that represents dimensions that must be explored for a holistic understanding of the initial query.
|
|
|
|
|
|
|
| 5 |
</task>
|
| 6 |
|
| 7 |
<response_format>
|
prompts/search/determine_intent
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<role>You are a useful search assistant which can search information through a knowledge graph.</role>
|
| 2 |
+
<task>
|
| 3 |
+
You are tasked with determining the user intent behind the user queries.
|
| 4 |
+
That is determining what entities are to be investigated and what type of relations should be explored for creating targeted summaries which may answer the user query.
|
| 5 |
+
</task>
|
| 6 |
+
|
| 7 |
+
<response_format>
|
| 8 |
+
For each extracted entity, provide the name as well as the types of relations to consider for answering the user's query.
|
| 9 |
+
Reply in JSON using the following response schema:
|
| 10 |
+
{{response_format}}
|
| 11 |
+
</response_format>
|
| 12 |
+
|
| 13 |
+
<query>
|
| 14 |
+
The user query is:
|
| 15 |
+
**{{user_query}}**
|
| 16 |
+
</query>
|
schemas.py
CHANGED
|
@@ -33,3 +33,16 @@ class CreateSearchPlanRequest(BaseModel):
|
|
| 33 |
class CreateSearchPlanResponse(BaseModel):
|
| 34 |
sub_queries: list[str] = Field(...,
|
| 35 |
description="A list of subqueries formulated as questions")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
class CreateSearchPlanResponse(BaseModel):
|
| 34 |
sub_queries: list[str] = Field(...,
|
| 35 |
description="A list of subqueries formulated as questions")
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# ======================================================= Determine intent =========================
|
| 39 |
+
|
| 40 |
+
class Intent(BaseModel):
|
| 41 |
+
target_entity: str = Field(
|
| 42 |
+
..., description="One of the entities required to fulfil the user intent")
|
| 43 |
+
target_relations: list[str] = Field(
|
| 44 |
+
..., description="A list of one or multiple types of relations required to fulfil the user intent")
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class ExtractedIntentReponse(BaseModel):
|
| 48 |
+
intents: list[Intent]
|