Refined knowledge search, added norm_question, entity type/value parms
This commit is contained in:
parent
127e694ee9
commit
b4bc506585
|
|
@ -3,6 +3,9 @@ You are a knowledge extractor for knowledge base. Extract the answer in "SQL Ans
|
|||
* Skip the question/answer for tmp table.
|
||||
* Don't include tmp table in the answer.
|
||||
* Include all the explanation comments as additional knowledge.
|
||||
* Don't replace the parameter in the question.
|
||||
* Replace the specific id in answer based on the question.
|
||||
* Don't need multiple set of query solutions for the same question. Only keep one.
|
||||
|
||||
=====
|
||||
User Questions:
|
||||
|
|
|
|||
|
|
@ -25,11 +25,14 @@ public class PrimaryStagePlanFn : IFunctionCallback
|
|||
|
||||
state.SetState("max_tokens", "4096");
|
||||
var task = JsonSerializer.Deserialize<PrimaryRequirementRequest>(message.FunctionArgs);
|
||||
var searchQuestions = new List<string>(task.Questions);
|
||||
searchQuestions.AddRange(task.NormQuestions);
|
||||
searchQuestions = searchQuestions.Distinct().ToList();
|
||||
|
||||
// Get knowledge from vectordb
|
||||
var hooks = _services.GetServices<IKnowledgeHook>();
|
||||
var knowledges = new List<string>();
|
||||
foreach (var question in task.Questions)
|
||||
foreach (var question in searchQuestions)
|
||||
{
|
||||
foreach (var hook in hooks)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,4 +7,7 @@ public class PrimaryRequirementRequest
|
|||
|
||||
[JsonPropertyName("questions")]
|
||||
public string[] Questions { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("norm_questions")]
|
||||
public string[] NormQuestions { get; set; } = [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,35 @@
|
|||
},
|
||||
"questions": {
|
||||
"type": "array",
|
||||
"description": "Rephrase user requirements in details and in multiple ways, don't miss any information especially for those line items, values and numbers.",
|
||||
"description": "Break down user requirements in details and in multiple ways, don't miss any entity type/value",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "Question converted from requirement in different ways to search in the knowledge base, be short and you can refer to the global knowledge.One question should contain only one main topic."
|
||||
"description": "Question converted from requirement in different ways to search in the knowledge base, be short and you can refer to the global knowledge.One question should contain only one main topic that with one entity type."
|
||||
}
|
||||
},
|
||||
"norm_questions": {
|
||||
"type": "array",
|
||||
"description": "normalize the generated questions, remove specific entity value.",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "Normalized question"
|
||||
}
|
||||
},
|
||||
"entities": {
|
||||
"type": "array",
|
||||
"description": "entities with type and value",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "entity type"
|
||||
},
|
||||
"value": {
|
||||
"type": "string",
|
||||
"description": "entity value"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ Thinking process:
|
|||
- If there is extra knowledge or relationship needed between steps, set the need_breakdown_task to true for both steps.
|
||||
- If the solution mentioned "related solutions" is needed, set the need_breakdown_task to true.
|
||||
- You should find the relationships between data structure based on the task knowledge strictly. If lack of information, set the need_breakdown_task to true.
|
||||
- If you need to lookup the dictionary to verify or get the enum/term/dictionary value, set the need_lookup_dictionary to true.
|
||||
- If you need to lookup the dictionary to verify or get the enum/term/dictionary value(exclude example data from attachment), set the need_lookup_dictionary to true.
|
||||
- Don't set need_lookup_dictionary to true for attachment data.
|
||||
- Seperate the dictionary lookup and need additional information/knowledge into different subtask.
|
||||
3. Input argument must reference to corresponding variable name that retrieved by previous steps, variable name must start with '@';
|
||||
4. Output all the subtasks as much detail as possible in JSON: [{{ response_format }}]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "verify_dictionary_term",
|
||||
"description": "Get id from dictionary table by keyword. Call this function only if need_lookup_dictionary is true and is_insert is false",
|
||||
"description": "Get id from dictionary table by keyword. Call this function only if need_lookup_dictionary is true and is_insert is false. You can only query one table at a time.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
},
|
||||
"tables": {
|
||||
"type": "array",
|
||||
"description": "all related tables",
|
||||
"description": "all related dictionary tables",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "table name"
|
||||
|
|
|
|||
Loading…
Reference in a new issue