Latest / AI Fire Daily / #243 Max: Gemini's New File Search API – Build RAG Agents 10x Cheaper & Easier
Transcript
- 0:00You know, if you've ever tried to build a rag
- 0:01agent for like a real world application, you
- 0:04know the pain. It's just this massive technical
- 0:07headache that can stop a project coal. Oh, it's
- 0:10brutal. The infrastructure alone. You're trying
- 0:12to figure out document chunking, getting the
- 0:14right vector embeddings, and then you have to
- 0:17stand up and manage a whole vector database.
- 0:20Pinecone, Milvus, whatever. It's a full time
- 0:22engineering job. Exactly. And the costs just
- 0:25start climbing right away. Yeah. But what if
- 0:27there was a way to just... Skip 90 % of that.
- 0:30Well, that's what we're talking about. Here's
- 0:31the headline that should make you just stop.
- 0:33We're talking about indexing 121 -page PDF, a
- 0:37huge knowledge base, for less than two cents.
- 0:41Welcome back to the Deep Dive. Today, our whole
- 0:44mission is to unpack Google's new Gemini File
- 0:47Search API because it looks like it completely
- 0:50automates the hardest parts of retrieval augmented
- 0:52generation. And you can do it with a simple no
- 0:55-code tool. Yeah. And let's just make sure we're
- 0:57on the same page with ARAC. Retrieval augmented
- 1:00generation just means using your own documents
- 1:02to ground an LLM to make sure its answers are
- 1:05based on some kind of truth, not just its training
- 1:08data. That grounding is absolutely everything.
- 1:10So here's what we're going to do. We'll walk
- 1:13through the insane cost savings. Yeah. Then the
- 1:15super simple four -step workflow. And then we
- 1:19have to talk about the limitations. Because,
- 1:21you know, if it sounds this good, there's got
- 1:23to be some catches. Okay, let's get into it.
- 1:25Let's see just how simple this really is. So
- 1:28the traditional way of doing our edge, it really
- 1:31was a gauntlet. It wasn't just, you know, pointing
- 1:33an LLM at a file. You had like... A dozen different
- 1:36things you had to build and then maintain. Absolutely.
- 1:39You had to worry about all the different file
- 1:41types, how to ingest them, adding metadata, and
- 1:44then the chunking. Oh, the chunking. Recursive
- 1:47character splitting, running every single one
- 1:49of those little chunks through an embeddings
- 1:51model. And only then, after all that, could you
- 1:53even put it in the database. Right. It was so
- 1:56intense. That's just the definition of high friction.
- 2:00So how does this Gemini file search solution...
- 2:03get around all that. What's Google actually doing
- 2:05under the hood? It just simplifies the whole
- 2:07thing from the developer side. You just upload
- 2:09the file. That's it. Google takes care of the
- 2:11chunking. They generate their own embeddings
- 2:13and they handle the storage. That entire pipeline
- 2:16is managed for you. So the big idea is you don't
- 2:20have to build your own search system. You don't
- 2:22have to set up a vector database or worry about
- 2:24keeping things in sync. You're just using their
- 2:27pipeline. Exactly. And what's really interesting
- 2:29is that their chunking is probably way better
- 2:32than what most of us would build. It's not just
- 2:35split every 500 characters. It understands the
- 2:38document's flow and structure. That's a great
- 2:41point. And just to be clear for everyone, when
- 2:43we say embeddings, we're just talking about turning
- 2:45words into numbers, right? Into a mathematical
- 2:48format so a computer can search them incredibly
- 2:50fast. That's it. It's just turning language into
- 2:52math for quick comparisons. So if you had to
- 2:54pick just one thing. What's the single biggest
- 2:57piece of complexity that this new Gemini method
- 3:01just gets rid of? It's that whole chain of manual
- 3:04document splitting, generating the embeddings,
- 3:07and then managing all the separate search infrastructure
- 3:09to glue it all together. Okay, let's talk about
- 3:11the money, because this is where the story gets
- 3:12kind of wild. You said you could index a huge
- 3:16document for pennies. How does that pricing actually
- 3:19work? The main thing is that you really only
- 3:21get charged for that first step, the upload,
- 3:23the indexing, and the cost is just... Tiny. It's
- 3:2615 cents per 1 million tokens. Let's put that
- 3:30in real terms again. That 121 -page PDF was,
- 3:33what, about 95 ,000 tokens? Yeah. So the math
- 3:36on that really is less than 2 cents. It costs
- 3:38basically nothing to load your knowledge. It's
- 3:41incredibly cheap to get the data in. And here's
- 3:43maybe the biggest deal right now. Storage is
- 3:45free. Totally free. You are not paying by the
- 3:49gigabyte for all those vectors to just sit there
- 3:52on Google servers. Okay, but what about querying?
- 3:55I have this agent running all day. Am I going
- 3:57to get slammed with retrieval fees? No, not for
- 4:00the retrieval itself. You pay the normal rate
- 4:02for using the LLM, you know, for Gemini 2 .5
- 4:06flash to generate the answer. But the actual
- 4:08cost of pulling the data from your store is,
- 4:11for now, absorbed. I saw the cost comparison
- 4:14table. Yeah. And it's a little bit shocking.
- 4:17Right. Let's say you have 100 gigs of data and
- 4:19you run a million queries in a month. Right.
- 4:22For a traditional setup with something like Pinecone
- 4:24plus all the compute you'd need, you're looking
- 4:26at hundreds, maybe even thousands of dollars
- 4:28a month easily. Whoa. Yeah. And with Gemini File
- 4:32Search, that whole first month, including the
- 4:34one -time indexing fee for all that data, is
- 4:37about $47. Wait, $47? Yeah. For that kind of
- 4:41volume? Yeah. That's the moment of wonder right
- 4:43there. I mean, imagine. Imagine what you could
- 4:45build, what you could experiment with if your
- 4:47entire knowledge -based infrastructure costs
- 4:49less than a pizza. It just opens a powerful RAG
- 4:52to everyone. It's a huge democratization. It's
- 4:54moving away from spending big capital on infrastructure
- 4:57to just a simple operational cost. So beyond
- 5:00that initial tiny fee, what's the main takeaway
- 5:03on cost for someone just starting out? The fact
- 5:05that storage is currently free. that removes
- 5:08the single biggest recurring cost that you always
- 5:10have with traditional vector databases okay so
- 5:13the money part is a no -brainer let's get practical
- 5:16let's talk about building this thing in nat which
- 5:19is basically a tool for visualizing api calls
- 5:22right and you only need four of them four simple
- 5:25http request nodes it's like stacking lego blocks
- 5:29it's really that linear okay walk us through
- 5:31them what are those four steps doing step one
- 5:33is create store Think of this as just making
- 5:37a folder. You're creating a permanent named index
- 5:41on Google's side where your documents are going
- 5:43to live. Got it. Then you have to get the actual
- 5:45file up there. Exactly. Step two is upload file.
- 5:48But this is just a temporary step. The file is
- 5:51in the Google Cloud environment, but it's not
- 5:53connected to your store yet. It's just sitting
- 5:55there. So you have to link the file to the folder.
- 5:57That is step three. Move file to store. This
- 6:00is the magic step. This is what actually kicks
- 6:02off the indexing and makes the file a permanent
- 6:05part of your knowledge base. And then finally,
- 6:07you can ask it a question. Step four, query the
- 6:10store. This is the request you send to the Gemini
- 6:13model, and you tell it, hey, use this specific
- 6:16knowledge base to help you answer the user's
- 6:18question. Okay, a quick but important detour
- 6:21on setup. Getting the security right. The original
- 6:24notes mention some confusion in Google's documentation.
- 6:28So what's the right way to do authentication
- 6:30in ADEM? The best way is to not paste your API
- 6:34key in every single node. That's messy and insecure.
- 6:37Instead, you use ADEM's generic credential type.
- 6:41Right. And you use the query auth option specifically.
- 6:43Correct. You just tell it the parameter is called
- 6:45key and you paste your Gemini API key in there
- 6:48once. Then all four of your nodes can just reference
- 6:51that saved credential. It keeps everything clean
- 6:53and secure. And why is getting that authentication
- 6:55right so important, even if you're just building
- 6:57a quick prototype? Because we should always be
- 6:59building securely from the start. It just prevents
- 7:01you from accidentally exposing your key in a
- 7:03bunch of different places. All right, let's talk
- 7:05about actually running this. You said step three,
- 7:07moving the file into the store, is the critical
- 7:09one. What happens if you forget to do that? The
- 7:12file just stays temporary, just floating out
- 7:14there in the cloud, and it'll get deleted after
- 7:16a little while. It never gets indexed, so your
- 7:18agent can't see it. You have to make that link
- 7:20to the store. Okay, so once it's linked... and
- 7:23we're ready to query it in step four what does
- 7:26that api call look like so we're using the gemini
- 7:302 .5 flash model and the most important part
- 7:32is in the json you send you have to include a
- 7:35search config parameter and paste in the unique
- 7:38store name id that you got from step one that's
- 7:41how you tell the llm exactly where to look so
- 7:43if you get that id wrong The agent just defaults
- 7:46to its general knowledge. It doesn't use your
- 7:48documents at all. Precisely. It's the whole key.
- 7:50And then, of course, you need good prompt engineering.
- 7:53We used a clear instruction. You are a helpful
- 7:55ag agent. Use your knowledge -based tool for
- 7:57truth. Cite your sources. And there was that
- 8:00weirdly specific rule you found. No punctuation,
- 8:03quotation marks, or new lines. Why that? Huh,
- 8:07yeah, that's just a practical little hack. It's
- 8:09to stop the underlying API from throwing a JSON
- 8:12error when it tries to pass data back. It just
- 8:14ensures the data transfer is clean. A strange
- 8:16quirk, but it's necessary for stability right
- 8:19now. So let's get to the results. You threw three
- 8:22really different documents at it. The official
- 8:25rules of golf, an NVIDIA press release, and an
- 8:28Apple 10K filing. How did it do? It did extremely
- 8:31well. For instance, I asked the golf PDF, what
- 8:34happens if your club breaks during the middle
- 8:36of the round? It came back with a perfect cited
- 8:38answer about how you can continue using it or
- 8:41have it repaired legally. And what about across
- 8:43multiple documents? Could it find a specific
- 8:46number from the NVIDIA file? Yep. Asked for the
- 8:49Q1 2025 fiscal summary. It correctly pulled out
- 8:52the $26 billion in total revenue and the $22
- 8:55billion in data center revenue. And it cited
- 8:57the press release correctly. And the overall
- 8:59score. after 10 really tough questions across
- 9:02almost 200 pages of documents, was a 4 .5 out
- 9:05of 5 for correctness. That's amazing for a setup
- 9:08that took minutes. What's so impressive about
- 9:10that 4 .5 out of 5 score is that it got there
- 9:13with basically zero complexity, zero fine -tuning,
- 9:16and zero maintenance from the person building
- 9:18it. So we know it's simple, we know it's cheap,
- 9:21we know it's accurate. But now we have to be
- 9:23realistic. This isn't magic. Where does it fall
- 9:27short? What are the limitations? Okay. Limitation
- 9:29number one is a big one for any real application,
- 9:33data management. Right now, Google doesn't have
- 9:35any kind of version control for the files in
- 9:38your store. So if I have my Q1 report in there
- 9:40and then I upload the Q2 report, now I just have
- 9:43two of them. You have two of them. And the store
- 9:45gets cluttered with old conflicting data. Your
- 9:48agent might pull from the wrong one. So the only
- 9:51solution right now is manual. You have to track
- 9:53your own versions and remember to delete the
- 9:55old file before you upload the new one. I appreciate
- 9:58you sharing that vulnerability. It feels like
- 10:00no matter how advanced the tools get, we're always
- 10:02stuck with data hygiene problems. Oh, yeah. I
- 10:05still wrestle with prompt drift and messy data
- 10:08pipelines in my own complex projects. It's just
- 10:10a constant frustrating challenge in this field.
- 10:13And what about the quality of the documents themselves?
- 10:16Garbage in, garbage out. That rule absolutely
- 10:19still applies. Gemini has OCR, which is great,
- 10:23but it's not a miracle worker. If you upload
- 10:25a blurry, poorly formatted PDF, you're going
- 10:28to get bad answers. You still have to do the
- 10:30cleanup. Okay, and limitation number three. This
- 10:33one's about what it's actually good at. Right.
- 10:35This system is fantastic at finding a needle
- 10:38in a haystack. A specific fact, a number, a rule.
- 10:42It fails completely when you ask it for a holistic
- 10:45summary or to understand the whole document.
- 10:48So you couldn't ask it to, say, summarize a 500
- 10:51-page book. Exactly. We saw this in our tests.
- 10:54I asked it, how many total rules are in the Gulf
- 10:56PDF? And it answered five. It couldn't see the
- 10:59whole document to count them all. It just found
- 11:01the five nearest chunks that mentioned the word
- 11:03rule. And the last one, which is maybe the most
- 11:05important for businesses. You have to remember
- 11:08your documents are on Google servers, so you
- 11:10have to be really careful about what you upload.
- 11:12No sensitive PII, personally identifiable information,
- 11:16and no top secret company data. And you need
- 11:19to think about compliance. Absolutely. GDPR,
- 11:22IAPA, if you have really strict data sovereignty
- 11:26or security needs, you might still need to build
- 11:29your own on -premise solution. This might not
- 11:31be for you. So just to be crystal clear. If your
- 11:34goal is to summarize a huge entire document,
- 11:37should you use this? No. Its architecture is
- 11:41built for finding facts inside chunks, which
- 11:43limits the kind of holistic understanding you
- 11:45need for a good summary. OK, so let's pull all
- 11:48this together. The big takeaway here seems to
- 11:50be that Gemini File Search just massively lowers
- 11:53the barrier to entry for RAG. It's a huge leap
- 11:56in simplicity and cost effectiveness. The verdict
- 11:59is pretty clear. You can set it up in 30 minutes.
- 12:01It's basically free for most normal use cases,
- 12:04and it delivers really high accuracy. That 4
- 12:07.5 out of 5 is no joke. Four simple API calls
- 12:10are automating what used to be weeks of painful
- 12:13infrastructure work. It's pretty incredible.
- 12:15So who should be using this right now? I'd say
- 12:17developers who are prototyping org ideas, small
- 12:20businesses that need a simple internal Q &A bot,
- 12:22or maybe content creators trying to organize
- 12:24a huge library of their own work. And who should
- 12:27maybe hold off for now? Big companies with really
- 12:29strict compliance rules, anyone who needs total
- 12:32control over their data, or use cases that are
- 12:35all about deep, full document summarization instead
- 12:38of fact -finding. It really lets you change your
- 12:40focus. You can stop worrying about the RRAG infrastructure
- 12:43and just start building a valuable agent. Which
- 12:46leads to a really interesting thought. If this
- 12:48is the trend... If R just becomes a cheap built
- 12:52-in feature of these models, what does that mean
- 12:55for the future of, say, a specialized vector
- 12:58database engineer? Is that entire job going to
- 13:00change? That is a fascinating question to think
- 13:03about. It really is. All right. Go out and build
- 13:05value, not infrastructure. We hope this deep
- 13:08dive gave you the clarity you were looking for.
- 13:10Until next time.