Session 11 / 15๐Ÿ”Žืขื‘

How to work with the challenges

The challenges here are harder than the practice tasks, and are meant for those who finished and want to go deeper. Try on your own for at least 20 minutes before opening the hints, and the solution only after that. There is no single right solution: if your scenario meets the requirements, it is right.

Broken scenario โ€” find the bug

This is what real work looks like: something broke, and all you have is the History. Read the error, and pick the right fix.

Advanced: Automatic updates

๐Ÿ”ฅ Advancedโฑ๏ธ ~40 min

๐ŸŽฌ The scenario

When a document changes in Drive โ€” the store is updated.

๐ŸŽฏ The requirements

  1. Detect changed files.
  2. Delete old chunks.
  3. Ingest again.

๐ŸŽฏ The desired result โ€” how the scenario should look and work

Click Run once and then each module: you will see its settings, and on the last module โ€” the output you should get.

๐Ÿ“ค Example of the final output
{
  "deleted": 14,
  "upserted": 11
}

๐ŸŽฌ Stuck? To the guided solution with a click simulation โ†’

๐Ÿ’ก Hints (try without them first)
  • Watch files (modified).
  • Delete vectors by prefix / a source filter.

Drive Watch (modified) โ†’ Pinecone Delete vectors (filter: fileId) โ†’ ingestion for the same file. That way even if there are fewer chunks โ€” no old ones are left.

๐ŸŽฌ The guided solution โ€” a click simulation

๐Ÿ“ธ The illustrated guide โ€” step by step, click by click

For every step: a screenshot of the (simulated) Make editor with the click spot marked, and below it exactly what to click and what to type. You can work from here next to an open Make window.

  1. 1
    Detect changed files
    Drive โ†’ Watch files (modified) in the policies folder.
    Marked screenshot โ€” step 1: Detect changed files
    ๐Ÿ“ธ Step 1.1 โ€” the red ring marks where to click
    Marked screenshot โ€” step 1: Detect changed files
    ๐Ÿ“ธ Step 1.2 โ€” the red ring marks where to click
    1. In the left menu click Scenarios โ†’ + Create a new scenario.
    2. Click the scenario name at the top left (New scenario) and type: C11 - Auto update.
    3. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    4. In the search box type Google Drive and click the Google Drive app.
    5. In the list of actions choose Watch Files in a Folder.
    6. In the Watch field type: Modified files
    7. In the Folder field type: Policies
    8. Click OK (or Save) to close the module window.
  2. 2
    Delete the old vectors
    Delete vectors with a fileId filter โ€” before re-inserting.
    Marked screenshot โ€” step 2: Delete the old vectors
    ๐Ÿ“ธ Step 2 โ€” the red ring marks where to click
    1. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    2. In the search box type HTTP and click the HTTP app.
    3. In the list of actions choose Make a request.
    4. In the URL field type: https://index.pinecone.io/vectors/delete
    5. In the Method field choose: POST
    6. In the Body field map (drag from the panel or type): {"filter":{"fileId":"{{1.id}}"}}
    7. Click OK (or Save) to close the module window.
  3. 3
    Ingest again
    Download โ†’ text โ†’ chunks โ†’ embeddings โ†’ upsert (as in the session).
    Marked screenshot โ€” step 3: Ingest again
    ๐Ÿ“ธ Step 3.1 โ€” the red ring marks where to click
    Marked screenshot โ€” step 3: Ingest again
    ๐Ÿ“ธ Step 3.2 โ€” the red ring marks where to click
    1. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    2. In the search box type Google Drive and click the Google Drive app.
    3. In the list of actions choose Download a File.
    4. In the File ID field map (drag from the panel or type): {{1.id}}
    5. Click OK (or Save) to close the module window.
    6. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    7. In the search box type OpenAI and click the OpenAI app.
    8. In the list of actions choose Create embeddings.
    9. In the Input field map (drag from the panel or type): {{chunk}}
    10. Click OK (or Save) to close the module window.
    11. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    12. In the search box type HTTP and click the HTTP app.
    13. In the list of actions choose Make a request.
    14. In the URL field type: https://index.pinecone.io/vectors/upsert
    15. In the Body field map (drag from the panel or type): {"vectors":[{"id":"{{1.id}}-{{i}}","values":โ€ฆ,"metadata":{"fileId":"{{1.id}}"}}]}
    16. Click OK (or Save) to close the module window.
  4. 4
    Run
    Change a document and check that the answer updates.
    Marked screenshot โ€” step 4: Run
    ๐Ÿ“ธ Step 4 โ€” the red ring marks where to click
    1. Click โ–ถ Run once at the bottom left.
    2. When the run ends, bubbles with numbers appear above the modules. Click the bubble of the last module and check the Output.
    3. The output should look roughly like this:
      {
       "deleted": 14,
       "upserted": 11
      }

Experts: Permissions by department

๐Ÿ”ฅ๐Ÿ”ฅ Expertsโฑ๏ธ ~50 min

๐ŸŽฌ The scenario

A kitchen employee sees only kitchen and general procedures.

๐ŸŽฏ The requirements

  1. department in the metadata (by folder).
  2. A filter in the query by the user.
  3. Mapping user โ†’ department.

๐ŸŽฏ The desired result โ€” how the scenario should look and work

Click Run once and then each module: you will see its settings, and on the last module โ€” the output you should get.

๐Ÿ“ค Example of the final output
{
  "matches": 5,
  "departments": [
    "kitchen",
    "general"
  ]
}

๐ŸŽฌ Stuck? To the guided solution with a click simulation โ†’

๐Ÿ’ก Hints (try without them first)
  • Data store: chat_id โ†’ department.
  • Pinecone filter: {"department": {"$in": ["kitchen","general"]}}.

Ingestion: department by the parent folder's name. Query: Data store Get (chat_id) โ†’ a filter in the query. The permission is enforced in the store โ€” not in the instructions to the LLM.

๐ŸŽฌ The guided solution โ€” a click simulation

๐Ÿ“ธ The illustrated guide โ€” step by step, click by click

For every step: a screenshot of the (simulated) Make editor with the click spot marked, and below it exactly what to click and what to type. You can work from here next to an open Make window.

  1. 1
    department in the metadata
    In ingestion: the parent folder name = the department.
    Marked screenshot โ€” step 1: department in the metadata
    ๐Ÿ“ธ Step 1.1 โ€” the red ring marks where to click
    Marked screenshot โ€” step 1: department in the metadata
    ๐Ÿ“ธ Step 1.2 โ€” the red ring marks where to click
    1. In the left menu click Scenarios โ†’ + Create a new scenario.
    2. Click the scenario name at the top left (New scenario) and type: C11 - Permissions.
    3. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    4. In the search box type Google Drive and click the Google Drive app.
    5. In the list of actions choose Watch Files in a Folder.
    6. Keep the defaults.
    7. Click OK (or Save) to close the module window.
    8. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    9. In the search box type Tools and click the Tools app.
    10. In the list of actions choose Set variable.
    11. In the Variable name field type: department
    12. In the Variable value field map (drag from the panel or type): {{1.parents[1].name}}
    13. Click OK (or Save) to close the module window.
  2. 2
    Map user โ†’ department
    In the questions scenario: Data store Get by chat_id.
    Marked screenshot โ€” step 2: Map user โ†’ department
    ๐Ÿ“ธ Step 2.1 โ€” the red ring marks where to click
    Marked screenshot โ€” step 2: Map user โ†’ department
    ๐Ÿ“ธ Step 2.2 โ€” the red ring marks where to click
    1. In the left menu click Scenarios โ†’ + Create a new scenario.
    2. Click the scenario name at the top left (New scenario) and type: C11 - Question.
    3. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    4. In the search box type Telegram Bot and click the Telegram Bot app.
    5. In the list of actions choose Watch Updates.
    6. Keep the defaults.
    7. Click OK (or Save) to close the module window.
    8. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    9. In the search box type Data store and click the Data store app.
    10. In the list of actions choose Get a record.
    11. In the Data store field type: staff
    12. In the Key field map (drag from the panel or type): {{1.message.chat.id}}
    13. Click OK (or Save) to close the module window.
  3. 3
    A filter in the query
    department โˆˆ [the user's department, general] โ€” enforced in the store.
    Marked screenshot โ€” step 3: A filter in the query
    ๐Ÿ“ธ Step 3.1 โ€” the red ring marks where to click
    Marked screenshot โ€” step 3: A filter in the query
    ๐Ÿ“ธ Step 3.2 โ€” the red ring marks where to click
    1. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    2. In the search box type HTTP and click the HTTP app.
    3. In the list of actions choose Make a request.
    4. In the URL field type: https://index.pinecone.io/query
    5. In the Body field map (drag from the panel or type): {"topK":5,"filter":{"department":{"$in":["{{2.department}}","general"]}}}
    6. Click OK (or Save) to close the module window.
    7. Click โ–ถ Run once at the bottom left.
    8. When the run ends, bubbles with numbers appear above the modules. Click the bubble of the last module and check the Output.
    9. The output should look roughly like this:
      {
       "matches": 5,
       "departments": [
        "kitchen",
        "general"
       ]
      }

Boss challenge: pgvector instead of Pinecone

๐Ÿ‘‘ Boss challengeโฑ๏ธ ~60 min

๐ŸŽฌ The scenario

Move the store to Supabase.

๐ŸŽฏ The requirements

  1. The vector extension and a table.
  2. A match_documents function.
  3. A call from Make.

๐ŸŽฏ The desired result โ€” how the scenario should look and work

Click Run once and then each module: you will see its settings, and on the last module โ€” the output you should get.

๐Ÿ“ค Example of the final output
{
  "rows": 5
}

๐ŸŽฌ Stuck? To the guided solution with a click simulation โ†’

๐Ÿ’ก Hints (try without them first)
  • create extension vector;
  • order by embedding <=> query_embedding limit k.

A table documents(id text pk, content text, metadata jsonb, embedding vector(1536)). A function match_documents(query_embedding, match_count, filter jsonb). Make: HTTP to the rpc or Execute a query with parameters. An advantage: a JOIN with the CRM tables.

๐ŸŽฌ The guided solution โ€” a click simulation

๐Ÿ“ธ The illustrated guide โ€” step by step, click by click

For every step: a screenshot of the (simulated) Make editor with the click spot marked, and below it exactly what to click and what to type. You can work from here next to an open Make window.

  1. 1
    An extension and a table in Supabase
    create extension vector; a documents table with embedding vector(1536).
    Marked screenshot โ€” step 1: An extension and a table in Supabase
    ๐Ÿ“ธ Step 1 โ€” the red ring marks where to click
    1. Open supabase.com/dashboard in your browser (the โ€œSQL editorโ€ screen).
    2. On the screen you will see: create extension if not exists vector; ยท create table documents (id text primary key, content text, metadata jsonb, embedding vector(1536));
    3. Click the Run button.
  2. 2
    A match_documents function
    Search by cosine distance with a filter.
    Marked screenshot โ€” step 2: A match_documents function
    ๐Ÿ“ธ Step 2 โ€” the red ring marks where to click
    1. Open supabase.com/dashboard in your browser (the โ€œSQL editorโ€ screen).
    2. On the screen you will see: create function match_documents(query_embedding vector(1536), match_count int, filter jsonb) returns table(โ€ฆ) โ€ฆ
    3. Click the Run button.
  3. 3
    Call from Make
    An embedding for the question โ†’ HTTP to rpc/match_documents.
    Marked screenshot โ€” step 3: Call from Make
    ๐Ÿ“ธ Step 3.1 โ€” the red ring marks where to click
    Marked screenshot โ€” step 3: Call from Make
    ๐Ÿ“ธ Step 3.2 โ€” the red ring marks where to click
    1. In the left menu click Scenarios โ†’ + Create a new scenario.
    2. Click the scenario name at the top left (New scenario) and type: C11 - pgvector.
    3. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    4. In the search box type OpenAI and click the OpenAI app.
    5. In the list of actions choose Create embeddings.
    6. In the Input field map (drag from the panel or type): {{question}}
    7. Click OK (or Save) to close the module window.
    8. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    9. In the search box type HTTP and click the HTTP app.
    10. In the list of actions choose Make a request.
    11. In the URL field type: https://xyz.supabase.co/rest/v1/rpc/match_documents
    12. In the Method field choose: POST
    13. In the Body field map (drag from the panel or type): {"query_embedding": {{1.embedding}}, "match_count": 5, "filter": {}}
    14. Click OK (or Save) to close the module window.
    15. Click โ–ถ Run once at the bottom left.
    16. When the run ends, bubbles with numbers appear above the modules. Click the bubble of the last module and check the Output.
    17. The output should look roughly like this:
      {
       "rows": 5
      }