TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

An LLM Query Understanding Service

38 pointsby softwaredougabout 1 month ago

3 comments

simonwabout 1 month ago
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.
MarkSweepabout 1 month ago
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>
hamelsmuabout 1 month ago
Doug is the OG of search. His book &quot;Relevant Search&quot; is great. Glad to see that he is teaching again.