zyratlo opened a new issue, #5259:
URL: https://github.com/apache/texera/issues/5259
### Task Summary
Introduce 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. The LLM session uses the already
existing LiteLLM server in Texera.
### Scope
Adds two files under
`frontend/src/app/workspace/service/notebook-migration/`:
- `migration-llm.ts` (~300 lines) — `NotebookMigrationLLM` injectable.
Uses Vercel AI SDK (`createOpenAI` + `generateText`) pointed at the LiteLLM
proxy already exposed on `main` at `/api/chat/completion`.
- Public methods:
- `initialize(modelType, apiKey)` seeds the session with Texera
documentation as system messages
- `verifyConnection()` does a 10-token ping to validate the API key
- `convertNotebookToWorkflow(notebook)` makes two sequential LLM
calls (workflow JSON, then cell↔operator mapping) and assembles a
`PythonUDFV2`-operator workflow + bidirectional mapping
- `close()` clears the session.
- `migration-prompts.ts` (~410 lines, mostly prompt text) — exported
string constants: `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`.
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [ ] Testing / QA
- [ ] Documentation
- [ ] Performance
- [x] Other
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]