Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Answering Questions From Your Own Documents (Summary)

In this video, you replayed the finished rules desk on two players’ questions, and looked back at the steps of the course behind each part of it.

What You Can Do Now

You can now split documents into chunks, embed them locally, and search them by meaning. Your desk asks the model to answer only from what the search found, cite its sources, and say when the documents don’t cover the question.

Two Questions at the Desk

Here’s one real run of the finished desk, desk-question.js with rules-desk.js, on OpenAI’s capable model, with the long lines wrapped for display. Your wording, token counts, and cost will differ:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

00:00 You’ve reached the end of Answering Questions From Your Own Documents. You can now chunk documents, embed them locally, and search them by meaning. Your desk asks the model to answer only from what the search found, cite its sources, and say when the documents don’t cover the question.

00:19 Here’s one real OpenAI run of the desk, replayed. Yours will differ.

00:25 Table 3 asks if a runner on the summit path can take the baton. The desk says yes, on space 12, and cites pages 4 to 5, a chunk it was sent. Table 1 asks about a seventh player, and the desk says the rulebooks don’t say.

00:44 Each part of the desk came from a step. Asked directly, the model gave a wrong rule for card 23. The dot product of two embeddings ranked rules by meaning.

00:56 Each vector keeps its model’s name. The rulebooks became chunks with their game and page, embedded once. The search missed card 17, so exact numbers and game names get a bonus.

01:11 The model answers from the top four chunks, not all eight rulebooks, for under a tenth of the tokens. When the field named covered comes back false, the desk declines, though the model can get that wrong.

01:25 That summit question first got a wrong no: the logged chunks showed page 5 was never sent, so you fixed the chunker, not the prompt.

01:35 Things to remember. Use one model for every vector. Keep each chunk’s game and page. Give exact matches a bonus. Let the desk decline. Check that each cited chunk was sent.

01:49 That doesn’t prove it backs the answer. When an answer is wrong, check what was sent first.

01:56 This is the fourth of five courses on building AI features. The last lets a model ask to call your functions within limits you set, and measures features with evals.

02:06 Your model folder comes along.

02:09 Thanks for following along.

Become a Member to join the conversation.