Doug Turnbull 最近写了一篇关于现在所有搜索的结构的文章:
很多时候,即使是小型开源法学硕士也能够以相对较低的成本将搜索查询转变为合理的结构。
在本后续教程中,他演示了在支持 GPU 的 Google Kubernetes Engine 容器中运行的 Qwen 2-7B,将用户搜索查询(如“redloveseat”)转换为结构化过滤器(如{"item_type": "loveseat", "color": "red"}
。
这是他使用的提示。
Respond with a single line of JSON: {"item_type": "sofa", "material": "wood", "color": "red"} Omit any other information. Do not include any other text in your response. Omit a value if the user did not specify it. For example, if the user said "red sofa", you would respond with: {"item_type": "sofa", "color": "red"} Here is the search query: blue armchair
出于好奇,我尝试使用LLM对其他一些模型运行他的提示:
-
gemini-1.5-flash-8b
是 Gemini 型号中最便宜的,处理得很好,成本为 0.000011 美元 – 或 0.0011 美分。 -
llama3.2:3b
也可以工作– 这是一个非常小的 2GB 模型,我使用 Ollama 运行。 -
deepseek-r1:1.5b
– 一个微小的 1.1GB 模型,再次通过 Ollama,在认真思考问题后,将“红色双人沙发”解释为{"item_type": "sofa", "material": null, "color": "red"}
有趣地失败了!
标签:提示工程, llm ,生成人工智能,搜索, ai , llms ,双子座, ollama
原文: https://simonwillison.net/2025/Apr/9/an-llm-query-understanding-service/#atom-everything