feat: dataset-specific prompt addendum (curator notes)#155
Merged
Conversation
Operator-curated free-prose note attached to each Dataset row. Threaded into the chat agent's system prompt in subsequent tasks so its answers are grounded in dataset-specific biological context. Migration is purely additive (nullable, default NULL); existing rows are unaffected and continue to behave identically.
- sa.String -> sa.Text: prose addendum is open-ended free-form text; Text is the semantically correct type (PostgreSQL distinguishes, SQLite is storage-equivalent). - Drop unused 'import sqlmodel' from migration top (cargo-culted from template, never referenced).
DatasetCreate / DatasetUpdate / DatasetAdminResponse gain a new optional prompt_addendum field. POST stores it, PUT updates it (preserving other fields via the existing exclude_unset behavior), GET surfaces it. No frontend UI changes — operators edit via the admin API for now.
- Reorder prompt_addendum above chat_enabled in DatasetCreate / DatasetUpdate / DatasetAdminResponse and the three response- construction call sites, matching the column order in db/models.py. - Add test_create_dataset_prompt_addendum_defaults_null asserting omitted prompt_addendum produces a null in the response. - Add baseline 'created prompt_addendum is None' assertion in test_update_dataset_prompt_addendum so the test fails closed if the create path ever started defaulting non-null.
DatasetContext gains an optional prompt_addendum field. build_dataset_context accepts it as a keyword arg; _build_dataset_context_cached (from #101) forwards it from the Dataset row. The cache key (slug, updated_at) already invalidates when admin PUT bumps updated_at, so changes to prompt_addendum take effect on the next request. Default is None for backward compatibility — datasets without curator notes produce a context byte-identical to before.
When DatasetContext.prompt_addendum is non-empty, build_system_prompt inserts a fenced === Curator notes === block between the description and shape lines so the agent treats operator-supplied context as authoritative. Whitespace-only and None values produce no output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prompt_addendumcolumn toDataset; admin API accepts + returns it viaDatasetCreate/DatasetUpdate/DatasetAdminResponse.DatasetContext→_build_dataset_context_cached(forwarded from the cached DB row).build_system_promptrenders the value as a fenced curator-notes block between the description and the shape line; omits cleanly when None / empty / whitespace-only.Test plan
test_admin_routes.py(create / update / list / null-default)test_chat_session.py(kwarg forwarded intobuild_dataset_context)test_prompt_system.py(present / none / empty-and-whitespace / paragraph isolation)Closes #109.