feat(python-notebook-migration): add LLM client for notebook-to-workflow conversion#5260
Open
zyratlo wants to merge 2 commits into
Open
feat(python-notebook-migration): add LLM client for notebook-to-workflow conversion#5260zyratlo wants to merge 2 commits into
zyratlo wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5260 +/- ##
============================================
- Coverage 48.95% 48.95% -0.01%
Complexity 2377 2377
============================================
Files 1048 1048
Lines 40270 40270
Branches 4272 4272
============================================
- Hits 19714 19713 -1
Misses 19402 19402
- Partials 1154 1155 +1
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
What changes were proposed in this PR?
Introduces the frontend LLM session class that converts a Jupyter notebook into a Texera workflow JSON plus a bidirectional cell to operator mapping, along with the prompt library it uses. Two files under
frontend/src/app/workspace/service/notebook-migration/, totalling ~700 lines (~410 of which is prompt text).migration-llm.ts— definesNotebookMigrationLLM, an@Injectableclass wrapping a Vercel AI SDK chat session against the LiteLLM proxy already exposed onmainat/api/chat/completion.initialize(modelType, apiKey)— builds an OpenAI-compatible chat client viacreateOpenAI({ baseURL: AppSettings.getApiEndpoint() }), seeds the message history with Texera documentation assystemmessages.verifyConnection()— does a 10-tokenpingcall to validate that the API key works against the configured model.convertNotebookToWorkflow(notebook)— extracts code cells (each tagged with a UUID inmetadata.uuid), sendsWORKFLOW_PROMPT+ the notebook to get a JSON of UDF operators / edges, then sendsMAPPING_PROMPTto get the cell↔operator mapping. Assembles a complete Texera workflow JSON (PythonUDFV2operators with stub input/output ports, links derived from the LLM's edge list, default settings) plus a bidirectionaloperator_to_cell/cell_to_operatormapping. Returns both as a JSON string.close()— clears the message history and the model reference.migration-prompts.ts— string constants used bymigration-llm.ts:TEXERA_OVERVIEW,TUPLE_DOCUMENTATION,TABLE_DOCUMENTATION,OPERATOR_DOCUMENTATION,UDF_INPUT_PORT_DOCUMENTATION,EXAMPLE_OF_GOOD_CONVERSION,VISUALIZER_DOCUMENTATION,EXAMPLE_OF_MULTIPLE_UDF_CONVERSION,WORKFLOW_PROMPT,MAPPING_PROMPT.Any related issues, documentation, discussions?
Closes #5259
Parent issue #4301
How was this PR tested?
No unit tests were included for these reasons:
migration-llm.tsis parsing a response.However I am open to writing tests based on review feedback.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)