Conversation
WalkthroughConsolidates per-task prompt-generation models into session-level synthetic-data configs, renames several models (e.g., Changes
Sequence Diagram(s)(Skipped — changes are model/shape refactors without new multi-component control flow that requires visualization.) Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
Summary of ChangesHello @sfierro, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on a significant schema update, primarily aimed at enhancing the clarity and structure of data models related to API interactions and synthetic data generation. It involves renaming existing models to better reflect their API context and introducing dedicated configurations for synthetic data generation steps and sessions. This refactoring improves the expressiveness of the codebase and sets a clearer foundation for future development in data generation capabilities. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
📊 Coverage ReportOverall Coverage: 91% Diff: origin/sfierro/specs...HEAD
Summary
Line-by-lineView line-by-line diff coverageapp/desktop/studio_server/copilot_api.pyLines 264-272 264 status_code=422,
265 detail=f"Validation error: {result.to_dict()}",
266 )
267
! 268 if isinstance(result, RefineSpecApiOutputClient):
269 return RefineSpecApiOutput.model_validate(result.to_dict())
270
271 raise HTTPException(
272 status_code=500,Lines 375-385 375 run.parent = task
376 models_to_save.extend(task_runs)
377
378 # 5. Create the Spec using pre-computed definition and properties from client
! 379 topic_generation_config = request.sdg_session_config.topic_generation_config
! 380 input_generation_config = request.sdg_session_config.input_generation_config
! 381 output_generation_config = request.sdg_session_config.output_generation_config
382
383 spec = Spec(
384 parent=task,
385 name=request.name,
|
There was a problem hiding this comment.
Code Review
This pull request updates the spec schema by renaming several models related to prompt generation and refining specifications. Specifically, RefineSpecOutput is renamed to RefineSpecApiOutput, and PromptGenerationResult is replaced by new SyntheticDataGenerationStepConfig and SyntheticDataGenerationSessionConfig models. These changes are propagated throughout the API client, API models, and UI components. While the core functionality seems preserved, there are opportunities to enhance the clarity and conciseness of docstrings for the newly introduced or renamed models, particularly in the auto-generated client code.
app/desktop/studio_server/api_client/kiln_ai_server_client/models/new_proposed_spec_edit_api.py
Show resolved
Hide resolved
app/desktop/studio_server/api_client/kiln_ai_server_client/models/refine_spec_api_output.py
Show resolved
Hide resolved
...er/api_client/kiln_ai_server_client/models/synthetic_data_generation_session_config_input.py
Show resolved
Hide resolved
...erver/api_client/kiln_ai_server_client/models/synthetic_data_generation_step_config_input.py
Show resolved
Hide resolved
...er/api_client/kiln_ai_server_client/models/synthetic_data_generation_session_config_input.py
Show resolved
Hide resolved
...o_server/api_client/kiln_ai_server_client/models/synthetic_data_generation_session_config.py
Show resolved
Hide resolved
app/desktop/studio_server/api_client/kiln_ai_server_client/models/refine_spec_api_output.py
Show resolved
Hide resolved
app/desktop/studio_server/api_client/kiln_ai_server_client/models/clarify_spec_output.py
Show resolved
Hide resolved
| """ | ||
| client = get_authenticated_client(api_key) | ||
|
|
||
| generate_input = GenerateBatchInput.from_dict( |
There was a problem hiding this comment.
nit: doing model_dump and from_dict is just 2 unnecessary transforms? Or more "slightly different models" issue?
There was a problem hiding this comment.
indeed a slightly different models issue
| provider_name=request.input_generation_info.task_metadata.model_provider_name, | ||
| prompt=request.input_generation_info.prompt, | ||
| synthetic_data_generation_session_config=SyntheticDataGenerationSessionConfig( | ||
| topic_generation_config=SyntheticDataGenerationStepConfig( |
There was a problem hiding this comment.
can't just set "topic_generation_config"?
| prompt: str = Field(description="The prompt used for generation.") | ||
|
|
||
|
|
||
| class SyntheticDataGenerationSessionConfig(BaseModel): |
There was a problem hiding this comment.
Can't the studio_server import this? saves us another dupe definition.
There was a problem hiding this comment.
we technically can but the Api models are supposed to match the server API, whereas we can store stuff on spec however we like and it seemed silly to wrap task model/provider in a TaskMetadata on the spec data model side since it's not used anywhere else (yet?) so I flattened it
There was a problem hiding this comment.
I think the idea is that maybe it grows and changes over time. We add a "server_resource_id" or "magic_potion_formula". We just want whatever comes back from clarify to go to generate, and don't really want to own the details in the client.
There was a problem hiding this comment.
but we're in spec.py here, this is just the model object itself. so if server resource id gets added this is exactly why we have this, to NOT store it on the spec model object on disk.
There was a problem hiding this comment.
we do pass through exactly the same thing from clarify to generate, that is the API object in a different file (copilot_models)
|
|
||
| class PromptGenerationInfo(BaseModel): | ||
| """Information about a prompt generation step during copilot spec creation.""" | ||
| class SyntheticDataGenerationStepConfig(BaseModel): |
There was a problem hiding this comment.
Can't the studio_server import this? saves us another dupe definition.
Summary by CodeRabbit
Refactor
New Features
✏️ Tip: You can customize this high-level summary in your review settings.