Skip to content

Better input naming to avoid conflicts with system prompts and guidance messages. #411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2025

Conversation

scosman
Copy link
Collaborator

@scosman scosman commented Jul 9, 2025

Summary by CodeRabbit

  • Refactor
    • Standardized and updated variable names in data generation prompts and input fields for improved clarity and consistency across the user interface.
  • Tests
    • Updated test cases to reflect the new standardized field names in data generation tasks.

scosman added 2 commits July 9, 2025 17:49
…citly named to avoid accidential conflicts with user guidance
…avoid accidential conflicts with user guidance
Copy link
Contributor

coderabbitai bot commented Jul 9, 2025

Walkthrough

The changes standardize variable and field names in the data generation prompt logic, input models, and tests by prefixing them with kiln_data_gen_. This affects prompt string templates, Pydantic model attributes, and corresponding test assertions and schema checks. No logic, control flow, or exported function signatures are modified.

Changes

File(s) Change Summary
libs/core/kiln_ai/adapters/data_gen/data_gen_prompts.py Updated prompt templates to use kiln_data_gen_-prefixed variable names throughout instructions and examples.
libs/core/kiln_ai/adapters/data_gen/data_gen_task.py Renamed Pydantic model fields to kiln_data_gen_-prefixed names; updated docstrings and from_task methods.
libs/core/kiln_ai/adapters/data_gen/test_data_gen_task.py Updated all test assertions, schema checks, and prompt key checks to use the new kiln_data_gen_ field names.

Poem

In the warren where data flows,
New names bloom as the rabbit knows.
Prefixes sprout, clear and long,
In prompts and tests, they now belong.
With every hop, the fields align—
Kiln’s data gen, now by design!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9684fa5 and 00bfbc2.

📒 Files selected for processing (3)
  • libs/core/kiln_ai/adapters/data_gen/data_gen_prompts.py (4 hunks)
  • libs/core/kiln_ai/adapters/data_gen/data_gen_task.py (4 hunks)
  • libs/core/kiln_ai/adapters/data_gen/test_data_gen_task.py (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: leonardmq
PR: Kiln-AI/Kiln#313
File: libs/core/kiln_ai/adapters/extraction/gemini_extractor.py:86-88
Timestamp: 2025-05-15T17:16:16.742Z
Learning: In Kiln's extraction configuration, Pydantic automatically coerces string keys (e.g., "document") into Kind enum values when validating dictionary fields typed as dict[Kind, str], so no manual conversion is needed when accessing these values.
🧬 Code Graph Analysis (1)
libs/core/kiln_ai/adapters/data_gen/data_gen_task.py (1)
libs/core/kiln_ai/adapters/prompt_builders.py (1)
  • build_prompt (29-43)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build Desktop Apps (macos-latest)
  • GitHub Check: Build Desktop Apps (ubuntu-22.04-arm)
  • GitHub Check: Build Desktop Apps (macos-13)
  • GitHub Check: Build Desktop Apps (windows-latest)
  • GitHub Check: Build Desktop Apps (ubuntu-22.04)
🔇 Additional comments (16)
libs/core/kiln_ai/adapters/data_gen/data_gen_task.py (6)

18-19: Clear documentation of naming rationale.

The explanatory note effectively communicates the purpose of the verbose field names, helping future maintainers understand the design decision.


21-30: Consistent field name standardization.

The field renaming from shorter names to kiln_data_gen_ prefixed names is consistently applied and aligns with the PR objective of avoiding conflicts with system prompts.


53-58: Proper update of from_task method.

The method correctly uses the new field names when constructing the DataGenCategoriesTaskInput instance, maintaining consistency with the model definition.


102-103: Consistent documentation pattern.

The same explanatory note is appropriately added to DataGenSampleTaskInput, maintaining consistency in documentation approach.


105-112: Consistent field naming in DataGenSampleTaskInput.

All field names are consistently updated to use the kiln_data_gen_ prefix, maintaining naming consistency across both input models.


134-138: Proper method update for DataGenSampleTaskInput.

The from_task method correctly uses the new field names when constructing the DataGenSampleTaskInput instance.

libs/core/kiln_ai/adapters/data_gen/data_gen_prompts.py (3)

36-60: Consistent example updates in topic tree prompt.

All examples correctly use the new kiln_data_gen_ prefixed field names, maintaining consistency with the updated input model fields.


86-89: Proper instruction updates for field references.

The instructions correctly reference the new field names (kiln_data_gen_system_prompt, kiln_data_gen_topic_path, kiln_data_gen_num_subtopics, kiln_data_gen_existing_topics), ensuring alignment with the updated input model.


111-124: Consistent field name usage in sample generation prompt.

All field references in the sample generation prompt instructions and examples are correctly updated to use the kiln_data_gen_ prefix.

libs/core/kiln_ai/adapters/data_gen/test_data_gen_task.py (7)

49-52: Proper test assertion updates.

The test assertions correctly use the new field names (kiln_data_gen_topic_path, kiln_data_gen_num_subtopics, kiln_data_gen_system_prompt), ensuring test coverage for the renamed fields.


60-61: Consistent default value testing.

The test correctly validates the default values using the new field names.


94-102: Accurate schema validation updates.

The schema validation tests correctly check for the new property names in the JSON schema, ensuring the renamed fields are properly validated.


150-153: Consistent test updates for DataGenSampleTaskInput.

The test assertions for DataGenSampleTaskInput correctly use the new field names, maintaining consistency across all test cases.


161-162: Proper default value validation.

The test correctly validates default values using the new field names for DataGenSampleTaskInput.


186-192: Accurate schema validation for sample task.

The schema validation tests correctly check for the new property names in the DataGenSampleTaskInput schema.


450-452: Consistent prompt content validation.

The test correctly checks for the presence of the new field names in the generated prompt content, ensuring the prompts are properly updated.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@scosman scosman merged commit 8ff942c into main Jul 9, 2025
14 checks passed
@scosman scosman deleted the guidance_templates branch July 9, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant