You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何优化GPT提示词以解决房产翻新时间窗口判断错误问题

问题背景

我正尝试从房产描述中提取物业状态,规则如下:

  • 2020年及以后完成翻新的房产标记为"JUST_RENOVATED"
  • 2020年之前翻新的标记为"GOOD"

示例描述:

Entièrement rénovée en 2017, cette jolie maison 2 chambres vous séduira par ses pièces épurées et lumineuses. PEB exceptionnel (PEB A) grâce à la qualité d'isolation utilisée. Faible consommation de gaz pour le chauffage central. Châssis triple vitrage. Cuisine ouverte entièrement équipée. Installation électrique aux normes RGIE. Compteur bi-horaire. Pour plus de renseignements et pour participer aux prochaines visites, merci de contacter l'agence immobilière ASTON & PARTNERS au 081/30.44.44.

按规则该房产应标记为"GOOD",但GPT常误将2017年翻新的房产标记为"JUST_RENOVATED",无法正确识别时间窗口。

当前使用的提示词
Extract the property condition based on descriptions.

Follow this order of decision :
1. Tag any property that has been renovated recently (i.e. 2020 and above) by "JUST_RENOVATED". If renovation have been made before 2020, tag by "GOOD".
2. Tag any property that has been recently build or is a project by "AS_NEW".
3. Tag any property with need of restorations by "TO_RENOVATE".
4. Tag any property in good condition (i.e. good energetic performance) by "GOOD".
5. If none of the above tag suit the description, tag by "NOT_FOUND".

Answer only with the tag.
相关Python代码
def debug_prompt(description):
    intro_message = f""" 
        Extract the property condition based on descriptions.

        Follow this order of decision :
        1. Tag any property that has been renovated recently (i.e. 2020 and above) by "JUST_RENOVATED". If renovation have been made before 2020, tag by "GOOD".
        2. Tag any property that has been recently build or is a project by "AS_NEW".
        3. Tag any property with need of restorations by "TO_RENOVATE".
        4. Tag any property in good condition (i.e. good energetic performance) by "GOOD".
        5. If none of the above tag suit the description, tag by "NOT_FOUND".

        Answer only with the tag.
    """

    system_message = [{"role": "system", "content": intro_message}]


    debug_prompt = [{
        "role": "user", 
        "content": f"""
            Extract the estate condition from the following description: '''{description}'''.
        """
    }]
    
    messages = system_message + debug_prompt

    response = client.chat.completions.create(
        model="gpt-3.5-turbo",
        messages=messages,
        temperature=0,
    )
    
    for response in response.choices:
        print(response.message.content.strip())
优化后的提示词方案

针对GPT无法正确识别时间窗口的问题,强化时间规则清晰度并优化决策逻辑表述:

根据房产描述提取物业状态,严格遵循以下优先级规则执行:
1. 优先检查翻新时间:
   - 若房产在2020年或之后完成翻新,标记为"JUST_RENOVATED"
   - 若房产在2020年之前完成翻新,标记为"GOOD"
2. 若房产为新建或待建项目,标记为"AS_NEW"
3. 若房产需要翻新/维修,标记为"TO_RENOVATED"
4. 若房产状态良好(如能效等级优秀)且未触发上述规则,标记为"GOOD"
5. 若以上规则均不适用,标记为"NOT_FOUND"

仅输出标记内容,无需额外解释。

优化要点

  • 拆分翻新规则为明确子项,用直白表述界定时间边界,避免"recently"这类模糊词汇
  • 强化优先级顺序,明确翻新时间检查为第一判断项
  • 修正原提示词中"build"的拼写错误,统一表述减少歧义
  • 保持输出要求清晰,确保模型仅返回指定标记

内容的提问来源于stack exchange,提问作者Mathieu Rousseau

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 09:17:05