Urgent.News

What's breaking now, across thousands of outlets.

AI

Semantic Caching and Live Internet Search: Tools That Let AI Cache Answers to Save Money, and Pull Data From the Web When It Needs To

Say you open the logs of your chat system and they are full of questions like these: "How do I change my password?" "Forgot my password, what do I do?" "Where do I reset my password?" All three mean the same thing. But the system sent each one to the AI, had it write a fresh answer three times, and paid for the tokens three times. Multiply that by thousands or tens of thousands of users, and the…

This article explores two techniques to optimize AI usage: semantic caching and live internet search. Semantic caching saves costs by remembering answers to frequently asked, similar questions, while live internet search allows the AI to fetch real-time data when needed. The decision to use caching or search depends on the question's similarity and urgency.

Semantic caching has three main risks: providing wrong answers due to similar questions, outdated information, and sharing incorrect answers with other users. Live internet search offers real-time answers at the cost of additional API fees and slower response times. The two methods work together, with a sorting step determining the appropriate approach for each question.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

Stop Using LLMs Like Search Engines

Most devs use modern language models wrong. They open a chat window, paste an error stack trace, and wait for a magic snippet. When it works, they celebrate.

  • LLMs are spatial compressors of human text, not search engines.
  • Treating LLMs like APIs requires explicit architectural constraints and data types.
  • Building domain-specific wrappers with internal documentation improves results.

Stop Telling Your AI What Format You Want. Start Writing It.

You ask the model for a JSON object. Your parser gets this: Certainly! Here's the JSON you asked for: {"severity": "high", "summary": "Login fails after password reset"} Let me know if you'd like me…

  • Seed desired format directly into model's response to avoid extraneous phrases.
  • Utilize API features like structured output or JSON mode for better control.
  • Implement validation to ensure generated output conforms to specified format.

More from Friday 30 October →