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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: How to Build RAG?

3 点作者 punkpeye6 个月前
I am building another &#x27;ask PDF a question&#x27; RAG.<p>I have successfully converted PDF to markdown.<p>Then I used Jina segmenter to split it into chunks.<p>Each chunk is ~1000 characters long, but sometimes it is as short as just the title of the section.<p>I have then stored all of these chunks in a vector database and use cosine distance to sort chunks, pick the first 100, and include the associated chunks into LLM prompt that&#x27;s used to answer user&#x27;s question.<p>However...<p>I feel like I am missing a step.<p>The chunks that are returned by the query, while mostly relevant, they ...<p>* do not include the full recipe * include snippets of unrelated recipes<p>Is there a step am I missing?

2 条评论

chewz6 个月前
RAG is so yesterday.<p>Upload entire PDF directly[1] to API, don&#x27;t convert PDF to markdown, don&#x27;t vectorise.. Put that in API cache [2] and keep asking questions.<p>Chunking and vector search gives mediocre results [3]. Same with full-time search. Difficult to calibrate when structure of PDF is volatile.<p>[1] - <a href="https:&#x2F;&#x2F;docs.anthropic.com&#x2F;en&#x2F;docs&#x2F;build-with-claude&#x2F;pdf-support" rel="nofollow">https:&#x2F;&#x2F;docs.anthropic.com&#x2F;en&#x2F;docs&#x2F;build-with-claude&#x2F;pdf-sup...</a><p>[2] - <a href="https:&#x2F;&#x2F;docs.anthropic.com&#x2F;en&#x2F;docs&#x2F;build-with-claude&#x2F;prompt-caching" rel="nofollow">https:&#x2F;&#x2F;docs.anthropic.com&#x2F;en&#x2F;docs&#x2F;build-with-claude&#x2F;prompt-...</a><p>[3] - This works but for well formated PDFs where you chunk intelligently and extract reasonable metadata.
评论 #42157671 未加载
lunarcave6 个月前
If you load something into the LLM context, there&#x27;s a non-zero chance that it&#x27;ll be referenced.<p>How are you chunking things? Can you chunk it in a way that sidesteps the problem?<p>It&#x27;s kind of hard to give generic advice without knowing your PDF structure.<p>But generally, you have two ways forward:<p>- Optimise chunking to be more context aware of the chunked content - Allow the LLM to refer to adjacent chunks via some kind of a pointer