TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

An LLM Query Understanding Service

38 点作者 softwaredoug大约 1 个月前

3 条评论

simonw大约 1 个月前
Prompting LLMs to turn search queries like &quot;red loveseat&quot; into structured search filters like {&quot;item_type&quot;: &quot;loveseat&quot;, &quot;color&quot;: &quot;red&quot;} is a neat trick.<p>I tried Doug&#x27;s prompt out on a few other LLMs:<p>Gemini 1.5 Flash 8B handles it well and costs about 1&#x2F;1000th of a cent: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;simonw&#x2F;cc825bfa7f921ca9ac47d7afb6eab1ce" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;simonw&#x2F;cc825bfa7f921ca9ac47d7afb6eab...</a><p>Llama 3.2 3B is a very small local model (a 2GB file) which can handle it too: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;simonw&#x2F;d18422ca24528cdb9e5bd77692531cfd" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;simonw&#x2F;d18422ca24528cdb9e5bd77692531...</a><p>An even smaller model, the 1.1GB deepseek-r1:1.5b, thought about it at length and confidently spat out the wrong answer! <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;simonw&#x2F;c37eca96dd6721883207c99d25aec49d" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;simonw&#x2F;c37eca96dd6721883207c99d25aec...</a><p>All three tests run with <a href="https:&#x2F;&#x2F;llm.datasette.io" rel="nofollow">https:&#x2F;&#x2F;llm.datasette.io</a> using the llm-gemini or llm-ollama plugins.
MarkSweep大约 1 个月前
I’ve played around with a similar concept last weekend. The one tweak I would suggest is to use the “structured outputs” feature of the LLM API if it supports it. It makes it more likely that the LLM generates valid JSON that follows your schema. Here are some examples of the documentation for different APIs that implement the feature:<p><a href="https:&#x2F;&#x2F;ai.google.dev&#x2F;gemini-api&#x2F;docs&#x2F;structured-output" rel="nofollow">https:&#x2F;&#x2F;ai.google.dev&#x2F;gemini-api&#x2F;docs&#x2F;structured-output</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;ollama&#x2F;ollama&#x2F;blob&#x2F;main&#x2F;docs&#x2F;api.md#request-structured-outputs">https:&#x2F;&#x2F;github.com&#x2F;ollama&#x2F;ollama&#x2F;blob&#x2F;main&#x2F;docs&#x2F;api.md#reque...</a>
hamelsmu大约 1 个月前
Doug is the OG of search. His book &quot;Relevant Search&quot; is great. Glad to see that he is teaching again.