Skip to content

Search / Retrieve Context for Inference #6

Description

@Dumken1

Main Question

How does the system find the right context before sending a question to the LLM?

Fellow 3 Role

Fellow 3 owns the most inference-related part of Week 2.
This fellow builds the retrieval layer that prepares context for future LLM inference.

Branch

feature/m01w02-search-context

Files Owned

src/python/local_first_ai/storage/search_context.py
assets/screenshots/month-01-week-02/fellow-3-search-context.png

Implementation Specification

Build APIs that search and prepare context.
search_context_items(keyword)
search_context_by_type(context_type, keyword)
get_top_context_for_prompt(keyword, limit=5)
prepare_context_for_inference(keyword, limit=5)
Example search:
User question:
What did we decide about SQLite?

Keyword:
SQLite

Relevant context returned:

  1. Database choice: We chose SQLite because it is local and works offline.
  2. Week 2 goal: Build a Local Context Store.
  3. Previous conversation: User asked how local memory connects to inference.

The output for inference should be formatted like:

Relevant Local Context:
[1] Type: config_decision
Title: Database choice
Content: We chose SQLite because it is local, lightweight, and works offline.

[2] Type: project_note
Title: Week 2 goal
Content: Week 2 builds the Local Context Store for local-first memory.

What Fellow 3 Must Prove

Fellow 3 should prove that:

  1. Search works on title.
  2. Search works on content.
  3. Search can filter by context_type.
  4. Search returns useful results.
  5. Search returns empty result when there is no match.
  6. Retrieved context can be formatted for prompt building.
  7. Fetch timing can be roughly measured.

Metadata

Metadata

Assignees

No one assigned

    Labels

    points:size/mediumFlow Points: medium technical contribution, usually 30 points

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions