|
41 | 41 | {{"entities": [<a list of entities of the prescribed entity types that you can reliably identify in the text, \
|
42 | 42 | formatted as '<ENTITY_TYPE_NAME>::<entity_name>' (please use that capitalization)>. Each entity \
|
43 | 43 | also should be followed by a list of comma-separated attribute filters for the entity, if referred to in the \
|
44 |
| -question for that entity. Example: 'ACCOUNT::* -- [account_type: customer, status: active]' should the question be \ |
45 |
| -'list all customer accounts', and ACCOUNT was an entity type with this attribute key/value allowed.] \ |
| 44 | +question for that entity. CRITICAL: you can only use attributes that are mentioned above for the \ |
| 45 | +entity type in question. Example: 'ACCOUNT::* -- [account_type: customer, status: active]' should the question be \ |
| 46 | +'list all customer accounts', and ACCOUNT was an entity type with these attribute key/values allowed.] \ |
46 | 47 | "time_filter": <if needed, a SQL-like filter for a field called 'event_date'. Do not select anything here \
|
47 | 48 | unless you are sure that the question asks for that filter. Only apply a time_filter if the question explicitly \
|
48 | 49 | mentions a specific date, time period, or event that can be directly translated into a date filter. Do not assume \
|
|
267 | 268 | QUERY_ENTITY_EXTRACTION_PROMPT = f"""
|
268 | 269 | You are an expert in the area of knowledge extraction and using knowledge graphs. You are given a question \
|
269 | 270 | and asked to extract entities (with attributes if applicable) that you can reliably identify, which will then
|
270 |
| -be matched with a known entity in the knowledge graph. You are also asked to extract time filters SHOULD \ |
271 |
| -there be an explicit mention of a date or time frame in the QUESTION (note: last, first, etc.. DO NOT \ |
| 271 | +be matched with a known entity in the knowledge graph. You are also asked to extract time constraints information \ |
| 272 | +from the QUESTION. Some time constraints will be captured by entity attributes if \ |
| 273 | +the entity type has a fitting attribute (example: 'created_at' could be a candidate for that), other times |
| 274 | +we will extracty an explicit time filter if no attribute fits. (Note regarding 'last', 'first', etc.: DO NOT \ |
272 | 275 | imply the need for a time filter just because the question asks for something that is not the current date. \
|
273 |
| -They will relate to ordering that we will handle separately). |
| 276 | +They will relate to ordering that we will handle separately later). |
274 | 277 |
|
275 |
| -Today is ---today_date--- and the user asking is ---user_name---, which may or may not be relevant. |
| 278 | +In case useful, today is ---today_date--- and the user asking is ---user_name---, which may or may not be relevant. |
276 | 279 | Here are the entity types that are available for extraction. Some of them may have \
|
277 | 280 | a description, others should be obvious. Also, notice that some may have attributes associated with them, which will \
|
278 | 281 | be important later.
|
|
337 | 340 | actual attribute may be implied.
|
338 | 341 | - don't just look at the entities that are mentioned in the question but also those that the question \
|
339 | 342 | may be about.
|
| 343 | + - be very careful that you only extract attributes that are listed above for the entity type in question! Do \ |
| 344 | +not make up attributes even if they are implied! Particularly if there is a relationship type that would \ |
| 345 | +would actually represent that information, you MUST not extract the information as an attribute. We \ |
| 346 | +will extract the relationship type later. |
| 347 | + - For the values of attributes, look at the possible values above! For example 'open' may refer to \ |
| 348 | +'backlog', 'todo', 'in progress', etc. In cases like that construct a ';'-separated list of values that you think may fit \ |
| 349 | +what is implied in the question (in the exanple: 'open; backlog; todo; in progress'). |
340 | 350 |
|
341 | 351 | Also, if you think the name or the title of an entity is given but name or title are not mentioned \
|
342 | 352 | explicitly as an attribute, then you should indeed extract the name/title as the entity name.
|
|
592 | 602 | 1. SIMPLE: You think you can answer the question using a database that is aware of the entities, relationships \
|
593 | 603 | above, and is generally suitable if it is enough to either list or count entities, return dates, etc. Usually, \
|
594 | 604 | 'SIMPLE' is chosen for questions of the form 'how many...' (always), or 'list the...' (often), 'when was...', \
|
595 |
| -'what did (someone) work on...'etc. |
| 605 | +'what did (someone) work on...'etc. Often it is also used in cases like 'what did John work on since April?'. Here, \ |
| 606 | +the user would expect to just see the list. So chose 'SIMPLE' here unless there are REALLY CLEAR \ |
| 607 | +follow-up instructions for each item (like 'summarize...' , 'anaylyze...', 'what are tyhe main poinst of...'.) If \ |
| 608 | +it is a 'what did...'-type question, chose 'SIMPLE'! |
| 609 | +
|
596 | 610 | 2. DEEP: You think you really should ALSO leverage the actual text of sources to answer the question, which sits \
|
597 | 611 | in a vector database. Examples are 'what is discussed in...', 'summarize', 'what is the discussion about...',\
|
598 | 612 | 'how does... relate to...', 'are there any mentions of... in..', 'what are the main points in...', \
|
|
0 commit comments