-
Notifications
You must be signed in to change notification settings - Fork 191
refactor: split artifacts use case into document generator and code generator #617
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
Conversation
🦋 Changeset detectedLatest commit: 66ee887 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis change splits the previous "artifacts" use case into two separate use cases: "code_generator" and "document_generator". It updates types, tests, prompts, workflow logic, documentation, and UI components to reflect this separation. Obsolete artifact-related files are removed, and new workflow and UI files are introduced for each new use case. Dependency versions and model identifiers are also updated. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant WorkflowFactory
participant Workflow
User->>App: Selects use case ("code_generator" or "document_generator")
App->>WorkflowFactory: Passes chat/request data
WorkflowFactory->>Workflow: Instantiates workflow for selected use case
Workflow-->>App: Handles workflow logic (code or document generation)
App-->>User: Displays progress and results (via UI component)
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (55)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (17)
packages/create-llama/templates/components/use-cases/typescript/document_generator/src/app/workflow.ts (1)
15-19: Add documentation and consider removing unnecessary asyncThe new
workflowFactoryfunction lacks documentation comments that would help other developers understand its purpose in the document generator workflow. Additionally, the function is marked asasyncbut doesn't contain anyawaitoperations, making the async keyword unnecessary in this case.-export const workflowFactory = async (reqBody: any) => { +/** + * Creates a document artifact workflow instance with the provided request body + * @param reqBody The request data containing chat history and other information + * @returns A document generation workflow instance + */ +export const workflowFactory = (reqBody: any) => { const workflow = createDocumentArtifactWorkflow(reqBody); return workflow; };packages/create-llama/templates/components/use-cases/python/document_generator/README-template.md (1)
36-38: Fix missing period and clarify workflow purposeThe description lacks a period at the end of the first sentence, and the second sentence should provide more specific guidance about what aspects of the workflow can be modified.
-AI-powered document generator that can help you generate documents with a chat interface and simple markdown editor. +AI-powered document generator that can help you generate documents with a chat interface and simple markdown editor. -To update the workflow, you can modify the code in [`workflow.py`](app/workflow.py). +To update the document generation process, prompt templates, or UI events, you can modify the code in [`workflow.py`](app/workflow.py).🧰 Tools
🪛 LanguageTool
[uncategorized] ~38-~38: A punctuation mark might be missing here.
Context: ...he workflow, you can modify the code inworkflow.py. You can...(AI_EN_LECTOR_MISSING_PUNCTUATION)
packages/create-llama/templates/components/use-cases/typescript/code_generator/README-template.md (1)
33-35: Fix missing article and add more specific guidanceThe description is missing the article "an" before "app" and would benefit from more specific guidance about what aspects of the workflow can be modified.
-AI-powered code generator that can help you generate app with a chat interface, code editor and app preview. +AI-powered code generator that can help you generate an app with a chat interface, code editor and app preview. -To update the workflow, you can modify the code in [`workflow.ts`](app/workflow.ts). +To update the code generation process, prompt templates, or UI events, you can modify the code in [`workflow.ts`](src/app/workflow.ts).🧰 Tools
🪛 LanguageTool
[uncategorized] ~33-~33: Possible missing article found.
Context: ...de generator that can help you generate app with a chat interface, code editor and ...(AI_HYDRA_LEO_MISSING_AN)
packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py (1)
30-36: Consider making the model configurable.The workflow factory function correctly creates the
CodeArtifactWorkflowinstance, but it hardcodes the OpenAI model to "gpt-4.1". Consider making this configurable via parameters or environment variables for better flexibility.Additionally, adding a docstring to explain the function's purpose and parameters would improve readability.
+def create_workflow(chat_request: ChatRequest) -> Workflow: + """ + Create a code generation workflow instance. + + Args: + chat_request: The chat request containing messages and configuration. + + Returns: + A configured CodeArtifactWorkflow instance. + """ workflow = CodeArtifactWorkflow( - llm=OpenAI(model="gpt-4.1"), + llm=OpenAI(model=os.getenv("CODE_GENERATOR_MODEL", "gpt-4.1")), chat_request=chat_request, timeout=120.0, ) return workflowpackages/create-llama/templates/components/use-cases/python/document_generator/workflow.py (1)
30-36: Consider making the model configurable and adding documentation.The workflow factory function correctly creates the
DocumentArtifactWorkflowinstance, but similarly to the code generator workflow, it hardcodes the OpenAI model to "gpt-4.1". Consider making this configurable for better flexibility.Adding a docstring would also improve code documentation:
+def create_workflow(chat_request: ChatRequest) -> Workflow: + """ + Create a document generation workflow instance. + + Args: + chat_request: The chat request containing messages and configuration. + + Returns: + A configured DocumentArtifactWorkflow instance. + """ workflow = DocumentArtifactWorkflow( - llm=OpenAI(model="gpt-4.1"), + llm=OpenAI(model=os.getenv("DOCUMENT_GENERATOR_MODEL", "gpt-4.1")), chat_request=chat_request, timeout=120.0, ) return workflowDon't forget to add the import for
osif you implement this change.packages/create-llama/templates/components/use-cases/python/code_generator/README-template.md (5)
5-11: Add language specifier to fenced code blocks.The code block on line 10 is missing a language specifier, which would improve syntax highlighting in markdown renderers.
-```shell +```shell
13-28: Missing "Second" step in the instructions.The instructions jump from "First, setup the environment" to "Then, run the development server" without a "Second" step, which makes the numbering inconsistent.
First, setup the environment with uv: > **_Note:_** This step is not needed if you are using the dev-container. ```shell uv syncThen check the parameters that have been pre-configured in the
.envfile in this directory.
Make sure you have set theOPENAI_API_KEYfor the LLM.-Then, run the development server:
+Second, run the development server:Also, add language specifiers to the code block on lines 27-28: ```diff -``` +```shell uv run fastapi run🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
26-26: Fenced code blocks should have a language specified
null(MD040, fenced-code-language)
34-36: Grammar error in use case description.There's a missing article in the description of the use case.
-AI-powered code generator that can help you generate app with a chat interface, code editor and app preview. +AI-powered code generator that can help you generate an app with a chat interface, code editor and app preview.🧰 Tools
🪛 LanguageTool
[uncategorized] ~35-~35: Possible missing article found.
Context: ...de generator that can help you generate app with a chat interface, code editor and ...(AI_HYDRA_LEO_MISSING_AN)
39-45: Fix grammatical error and add language specifier to code block.There's a grammar error in line 39 and the code block is missing a language specifier.
-You can start by sending an request on the [chat UI](http://localhost:8000) or you can test the `/api/chat` endpoint with the following curl request: +You can start by sending a request on the [chat UI](http://localhost:8000) or you can test the `/api/chat` endpoint with the following curl request: -``` +```shell curl --location 'localhost:8000/api/chat' \ --header 'Content-Type: application/json' \ --data '{ "messages": [{ "role": "user", "content": "Create a report comparing the finances of Apple and Tesla" }] }'Additionally, consider updating the example prompt to be more relevant to code generation rather than financial reporting.
🧰 Tools
🪛 LanguageTool
[misspelling] ~39-~39: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...workflow.py). You can start by sending an request on the [chat UI](http://localho...(EN_A_VS_AN)
🪛 markdownlint-cli2 (0.17.2)
41-41: Fenced code blocks should have a language specified
null(MD040, fenced-code-language)
51-55: Add language specifier to code block.The code block is missing a language specifier.
You can also generate a new code for the workflow using LLM by running the following command: -``` +```shell uv run generate_ui<details> <summary>🧰 Tools</summary> <details> <summary>🪛 markdownlint-cli2 (0.17.2)</summary> 53-53: Fenced code blocks should have a language specified null (MD040, fenced-code-language) </details> </details> </blockquote></details> <details> <summary>packages/create-llama/templates/components/use-cases/typescript/document_generator/README-template.md (5)</summary><blockquote> `5-9`: **Add language specifier to code block.** The code block is missing a language specifier. ```diff First, install the dependencies: -``` +```bash npm install--- `11-15`: **Fix instruction numbering and add language specifier.** The instructions skip from "First" to "Third" without a "Second" step, which is confusing. Also, the code block needs a language specifier. ```diff -Third, run the development server: +Second, run the development server: -``` +```bash npm run dev--- `23-29`: **Fix grammar and add language specifier.** There's a minor grammar issue in the UI components description, and the code block needs a language specifier. ```diff -We have a custom component located in `components/ui_event.jsx`. This is used to display the state of artifact workflows in UI. You can regenerate a new UI component from the workflow event schema by running the following command: +We have a custom component located in `components/ui_event.jsx`. This is used to display the state of artifact workflows in the UI. You can regenerate a new UI component from the workflow event schema by running the following command: -``` +```bash npm run generate:ui<details> <summary>🧰 Tools</summary> <details> <summary>🪛 LanguageTool</summary> [uncategorized] ~25-~25: You might be missing the article “the” here. Context: ...play the state of artifact workflows in UI. You can regenerate a new UI component ... (AI_EN_LECTOR_MISSING_DETERMINER_THE) </details> </details> --- `33-36`: **Fix grammar error and correct file path.** There's a missing article in the use case description and an inconsistent file path reference. ```diff -AI-powered document generator that can help you generate documents with a chat interface and simple markdown editor. +AI-powered document generator that can help you generate documents with a chat interface and a simple markdown editor. -To update the workflow, you can modify the code in [`workflow.ts`](app/workflow.ts). +To update the workflow, you can modify the code in [`workflow.ts`](src/app/workflow.ts).
37-43: Fix grammar error in request instructions.There's a grammar error in the request instructions.
-You can start by sending an request on the [chat UI](http://localhost:3000) or you can test the `/api/chat` endpoint with the following curl request: +You can start by sending a request on the [chat UI](http://localhost:3000) or you can test the `/api/chat` endpoint with the following curl request:🧰 Tools
🪛 LanguageTool
[misspelling] ~37-~37: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...workflow.ts). You can start by sending an request on the [chat UI](http://localho...(EN_A_VS_AN)
packages/create-llama/templates/components/ui/use-cases/document_generator/ui_event.jsx (2)
29-48: Consider adding type definitions for the event prop.While the component logic is sound, adding TypeScript type definitions would improve code robustness and developer experience.
// Add at the top of the file /** * @typedef {Object} WorkflowEvent * @property {('plan'|'generate'|'completed')} state - The current state of the workflow * @property {string} [requirement] - The current requirement being processed (optional) */ /** * @param {Object} props * @param {WorkflowEvent} props.event - The workflow event object */ function ArtifactWorkflowCard({ event }) { // ...existing code }
128-137: Consider adding error handling for unexpected event states.The component doesn't explicitly handle unexpected event states (beyond "plan" and "generate"). While the current implementation gracefully returns null when the state doesn't match, a more explicit approach might be beneficial.
export default function Component({ events }) { const aggregateEvents = () => { if (!events || events.length === 0) return null; - return events[events.length - 1]; + const lastEvent = events[events.length - 1]; + // Validate that the event state is one of the expected values + if (lastEvent && lastEvent.state && !['plan', 'generate', 'completed'].includes(lastEvent.state)) { + console.warn(`Unexpected workflow state: ${lastEvent.state}`); + } + return lastEvent; }; const event = aggregateEvents(); return <ArtifactWorkflowCard event={event} />; }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
.changeset/calm-women-repair.md(1 hunks)packages/create-llama/e2e/python/resolve_dependencies.spec.ts(1 hunks)packages/create-llama/e2e/typescript/resolve_dependencies.spec.ts(2 hunks)packages/create-llama/helpers/types.ts(1 hunks)packages/create-llama/helpers/typescript.ts(1 hunks)packages/create-llama/questions/simple.ts(4 hunks)packages/create-llama/templates/components/ui/use-cases/document_generator/ui_event.jsx(1 hunks)packages/create-llama/templates/components/use-cases/python/artifacts/workflow.py(0 hunks)packages/create-llama/templates/components/use-cases/python/code_generator/README-template.md(1 hunks)packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py(2 hunks)packages/create-llama/templates/components/use-cases/python/document_generator/README-template.md(1 hunks)packages/create-llama/templates/components/use-cases/python/document_generator/workflow.py(2 hunks)packages/create-llama/templates/components/use-cases/typescript/artifacts/src/app/workflow.ts(0 hunks)packages/create-llama/templates/components/use-cases/typescript/code_generator/README-template.md(1 hunks)packages/create-llama/templates/components/use-cases/typescript/code_generator/src/app/workflow.ts(1 hunks)packages/create-llama/templates/components/use-cases/typescript/document_generator/README-template.md(1 hunks)packages/create-llama/templates/components/use-cases/typescript/document_generator/src/app/workflow.ts(1 hunks)packages/create-llama/templates/types/llamaindexserver/nextjs/src/app/settings.ts(1 hunks)
💤 Files with no reviewable changes (2)
- packages/create-llama/templates/components/use-cases/python/artifacts/workflow.py
- packages/create-llama/templates/components/use-cases/typescript/artifacts/src/app/workflow.ts
🧰 Additional context used
🧬 Code Graph Analysis (4)
packages/create-llama/templates/components/use-cases/typescript/code_generator/src/app/workflow.ts (1)
packages/create-llama/templates/components/use-cases/typescript/document_generator/src/app/workflow.ts (1)
workflowFactory(15-19)
packages/create-llama/templates/components/use-cases/typescript/document_generator/src/app/workflow.ts (1)
packages/create-llama/templates/components/use-cases/typescript/code_generator/src/app/workflow.ts (1)
workflowFactory(15-19)
packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py (2)
packages/create-llama/templates/components/use-cases/python/document_generator/workflow.py (1)
create_workflow(30-36)python/llama-index-server/tests/api/test_event_stream.py (1)
chat_request(23-26)
packages/create-llama/templates/components/use-cases/python/document_generator/workflow.py (3)
packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py (1)
create_workflow(30-36)python/llama-index-server/tests/api/test_event_stream.py (1)
chat_request(23-26)python/llama-index-server/llama_index/server/api/models.py (1)
ChatRequest(32-41)
🪛 LanguageTool
packages/create-llama/templates/components/use-cases/typescript/code_generator/README-template.md
[uncategorized] ~33-~33: Possible missing article found.
Context: ...de generator that can help you generate app with a chat interface, code editor and ...
(AI_HYDRA_LEO_MISSING_AN)
packages/create-llama/templates/components/use-cases/python/document_generator/README-template.md
[uncategorized] ~38-~38: A punctuation mark might be missing here.
Context: ...he workflow, you can modify the code in workflow.py. You can...
(AI_EN_LECTOR_MISSING_PUNCTUATION)
packages/create-llama/templates/components/use-cases/typescript/document_generator/README-template.md
[uncategorized] ~25-~25: You might be missing the article “the” here.
Context: ...play the state of artifact workflows in UI. You can regenerate a new UI component ...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[misspelling] ~37-~37: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...workflow.ts). You can start by sending an request on the [chat UI](http://localho...
(EN_A_VS_AN)
packages/create-llama/templates/components/use-cases/python/code_generator/README-template.md
[uncategorized] ~35-~35: Possible missing article found.
Context: ...de generator that can help you generate app with a chat interface, code editor and ...
(AI_HYDRA_LEO_MISSING_AN)
[uncategorized] ~37-~37: A punctuation mark might be missing here.
Context: ...he workflow, you can modify the code in workflow.py. You can...
(AI_EN_LECTOR_MISSING_PUNCTUATION)
[misspelling] ~39-~39: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...workflow.py). You can start by sending an request on the [chat UI](http://localho...
(EN_A_VS_AN)
🪛 markdownlint-cli2 (0.17.2)
packages/create-llama/templates/components/use-cases/python/code_generator/README-template.md
26-26: Fenced code blocks should have a language specified
null
(MD040, fenced-code-language)
41-41: Fenced code blocks should have a language specified
null
(MD040, fenced-code-language)
53-53: Fenced code blocks should have a language specified
null
(MD040, fenced-code-language)
⏰ Context from checks skipped due to timeout of 90000ms (56)
- GitHub Check: build
- GitHub Check: typescript (22, 3.11, ubuntu-22.04, nextjs, --llamacloud, llamaindexserver)
- GitHub Check: typescript (22, 3.11, ubuntu-22.04, nextjs, --llamacloud, streaming)
- GitHub Check: typescript (22, 3.11, ubuntu-22.04, nextjs, --example-file, llamaindexserver)
- GitHub Check: typescript (22, 3.11, ubuntu-22.04, nextjs, --example-file, streaming)
- GitHub Check: typescript (22, 3.11, ubuntu-22.04, nextjs, --no-files, llamaindexserver)
- GitHub Check: typescript (22, 3.11, ubuntu-22.04, nextjs, --no-files, streaming)
- GitHub Check: typescript (22, 3.11, windows-latest, nextjs, --llamacloud, llamaindexserver)
- GitHub Check: typescript (22, 3.11, windows-latest, nextjs, --llamacloud, streaming)
- GitHub Check: typescript (22, 3.11, windows-latest, nextjs, --example-file, llamaindexserver)
- GitHub Check: typescript (22, 3.11, windows-latest, nextjs, --example-file, streaming)
- GitHub Check: typescript (22, 3.11, windows-latest, nextjs, --no-files, llamaindexserver)
- GitHub Check: typescript (22, 3.11, windows-latest, nextjs, --no-files, streaming)
- GitHub Check: typescript (22, 3.11, macos-latest, nextjs, --llamacloud, llamaindexserver)
- GitHub Check: typescript (22, 3.11, macos-latest, nextjs, --llamacloud, streaming)
- GitHub Check: typescript (22, 3.11, macos-latest, nextjs, --example-file, llamaindexserver)
- GitHub Check: typescript (22, 3.11, macos-latest, nextjs, --example-file, streaming)
- GitHub Check: typescript (22, 3.11, macos-latest, nextjs, --no-files, llamaindexserver)
- GitHub Check: typescript (22, 3.11, macos-latest, nextjs, --no-files, streaming)
- GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, --llamacloud, llamaindexserver)
- GitHub Check: typescript (20, 3.11, ubuntu-22.04, nextjs, --llamacloud, llamaindexserver)
- GitHub Check: typescript (20, 3.11, ubuntu-22.04, nextjs, --llamacloud, streaming)
- GitHub Check: typescript (20, 3.11, ubuntu-22.04, nextjs, --example-file, llamaindexserver)
- GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, --llamacloud, streaming)
- GitHub Check: typescript (20, 3.11, ubuntu-22.04, nextjs, --example-file, streaming)
- GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, --example-file, llamaindexserver)
- GitHub Check: typescript (20, 3.11, ubuntu-22.04, nextjs, --no-files, llamaindexserver)
- GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, --example-file, streaming)
- GitHub Check: typescript (20, 3.11, ubuntu-22.04, nextjs, --no-files, streaming)
- GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, --no-files, llamaindexserver)
- GitHub Check: typescript (20, 3.11, windows-latest, nextjs, --llamacloud, llamaindexserver)
- GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, --no-files, streaming)
- GitHub Check: typescript (20, 3.11, windows-latest, nextjs, --llamacloud, streaming)
- GitHub Check: python (20, 3.11, windows-latest, fastapi, --llamacloud, llamaindexserver)
- GitHub Check: typescript (20, 3.11, windows-latest, nextjs, --example-file, llamaindexserver)
- GitHub Check: python (20, 3.11, windows-latest, fastapi, --llamacloud, streaming)
- GitHub Check: typescript (20, 3.11, windows-latest, nextjs, --example-file, streaming)
- GitHub Check: python (20, 3.11, windows-latest, fastapi, --example-file, llamaindexserver)
- GitHub Check: typescript (20, 3.11, windows-latest, nextjs, --no-files, llamaindexserver)
- GitHub Check: python (20, 3.11, windows-latest, fastapi, --example-file, streaming)
- GitHub Check: typescript (20, 3.11, windows-latest, nextjs, --no-files, streaming)
- GitHub Check: python (20, 3.11, windows-latest, fastapi, --no-files, llamaindexserver)
- GitHub Check: typescript (20, 3.11, macos-latest, nextjs, --llamacloud, llamaindexserver)
- GitHub Check: python (20, 3.11, windows-latest, fastapi, --no-files, streaming)
- GitHub Check: typescript (20, 3.11, macos-latest, nextjs, --llamacloud, streaming)
- GitHub Check: python (20, 3.11, macos-latest, fastapi, --llamacloud, llamaindexserver)
- GitHub Check: typescript (20, 3.11, macos-latest, nextjs, --example-file, llamaindexserver)
- GitHub Check: python (20, 3.11, macos-latest, fastapi, --llamacloud, streaming)
- GitHub Check: typescript (20, 3.11, macos-latest, nextjs, --example-file, streaming)
- GitHub Check: python (20, 3.11, macos-latest, fastapi, --example-file, llamaindexserver)
- GitHub Check: typescript (20, 3.11, macos-latest, nextjs, --no-files, llamaindexserver)
- GitHub Check: python (20, 3.11, macos-latest, fastapi, --example-file, streaming)
- GitHub Check: typescript (20, 3.11, macos-latest, nextjs, --no-files, streaming)
- GitHub Check: python (20, 3.11, macos-latest, fastapi, --no-files, llamaindexserver)
- GitHub Check: python (20, 3.11, macos-latest, fastapi, --no-files, streaming)
- GitHub Check: lint
🔇 Additional comments (20)
.changeset/calm-women-repair.md (1)
1-6: LGTM! The changeset properly documents the PR purpose.The changeset correctly describes the split of the artifacts use case into code_generator and document_generator, which aligns with the PR title and objectives. This is important for tracking and versioning.
packages/create-llama/templates/components/use-cases/typescript/code_generator/src/app/workflow.ts (1)
15-19: Implementation of workflowFactory looks good.The workflowFactory function follows the same pattern as used in the document_generator workflow. It properly takes a request body parameter and returns the created workflow.
packages/create-llama/helpers/types.ts (1)
61-62:✅ Verification successful
Type definition updated correctly to support the split use cases.
The TemplateUseCase type has been properly updated to replace "artifacts" with "code_generator" and "document_generator", which aligns with the overall refactoring goal of this PR.
🏁 Script executed:
#!/bin/bash # Verify that all previous "artifacts" references are properly updated echo "Checking for remaining 'artifacts' references that might need updating..." rg "'artifacts'" --type=ts --type=py rg "\"artifacts\"" --type=ts --type=pyLength of output: 246
Approve TemplateUseCase update—no remaining “artifacts” references
All occurrences of the old
"artifacts"use case have been removed and replaced with"code_generator"and"document_generator", in line with the PR’s refactoring goal.• Verified via:
rg "'artifacts'" --type=ts --type=pyrg "\"artifacts\"" --type=ts --type=py
(no matches found)• File confirmed:
packages/create-llama/helpers/types.ts(Lines 61–62)packages/create-llama/e2e/python/resolve_dependencies.spec.ts (1)
21-22: LGTM! Properly updated use cases in test suiteThe changes correctly replace the "artifacts" use case with the split "code_generator" and "document_generator" use cases in the test suite, consistent with the overall refactoring approach.
packages/create-llama/helpers/typescript.ts (1)
80-80: Updated conditional checks for new use cases correctly.The condition has been properly updated to check for the new
code_generatoranddocument_generatoruse cases instead of the originalartifactsuse case. This change aligns with the refactoring goal of splitting the artifacts use case.packages/create-llama/e2e/typescript/resolve_dependencies.spec.ts (2)
26-27: Successfully updated use cases array.The test suite correctly replaces
artifactswith the two new separate use cases:code_generatoranddocument_generator.
86-86: Properly updated condition for skipping test cases.The condition has been correctly updated to skip the llamaParse test for both new use cases (
code_generatoranddocument_generator) instead of just the originalartifactsuse case.packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py (1)
9-9: Added required OpenAI import for LLM initialization.The import for OpenAI LLM is correctly added to support the new workflow factory function.
packages/create-llama/templates/components/use-cases/python/document_generator/workflow.py (1)
7-7: Added required OpenAI import for LLM initialization.The import for OpenAI LLM is correctly added to support the new workflow factory function.
packages/create-llama/templates/components/use-cases/python/code_generator/README-template.md (2)
1-3: LGTM - Good introduction with important links.The introduction effectively provides links to LlamaIndex and Workflows, which are essential for users to understand the project's foundation.
57-65: LGTM - Good resources section.The Learn More section provides valuable resources for users to deepen their understanding of LlamaIndex and related tools.
packages/create-llama/templates/components/use-cases/typescript/document_generator/README-template.md (2)
1-3: LGTM - Good introduction with important links.The introduction effectively provides links to LlamaIndex and Create Llama, which are essential for users to understand the project's foundation.
45-53: LGTM - Good resources section.The Learn More section provides valuable resources for users to deepen their understanding of LlamaIndex and related tools.
packages/create-llama/questions/simple.ts (4)
9-14: LGTM - Clean type definition update for new use cases.The AppType definition has been appropriately updated to replace "artifacts" with the two new specialized use cases: "code_generator" and "document_generator".
50-59: LGTM - Well-defined choices for new use cases.The choices have been updated with clear titles and descriptions for the new Code Generator and Document Generator options, replacing the previous Artifacts option.
84-84: LGTM - Correctly updated condition for LlamaCloud services exclusion.The condition has been properly updated to exclude both "code_generator" and "document_generator" from the LlamaCloud services prompt, maintaining the previous behavior for the new use cases.
161-172: LGTM - Properly configured new use cases in the lookup object.Both new use cases have been added to the lookup object with the appropriate configuration, maintaining consistency with the other use cases and providing the necessary MODEL_GPT41 configuration.
packages/create-llama/templates/components/ui/use-cases/document_generator/ui_event.jsx (3)
1-9: LGTM - Good imports setup.The component imports all necessary UI components and React hooks needed for the document generator workflow visualization.
10-27: LGTM - Well-organized stage metadata.The STAGE_META constant provides a clear and organized way to manage the different visual elements for each workflow stage, making the component maintainable and easy to understand.
49-126: LGTM - Elegant implementation of workflow card UI.The ArtifactWorkflowCard component handles different workflow states elegantly with appropriate visual feedback and smooth transitions. The conditional rendering based on the workflow state provides a clear user experience.
packages/create-llama/templates/types/llamaindexserver/nextjs/src/app/settings.ts
Show resolved
Hide resolved
82fced3 to
d0ae22e
Compare
packages/create-llama/templates/components/ui/use-cases/document_generator/ui_event.jsx
Outdated
Show resolved
Hide resolved
- Removed unnecessary string conversion for userInput in code_generator and deep_research workflows. - Updated userRequest type to MessageContent for better type safety. - Cleaned up the UI event component by removing redundant indicatorClassName logic.
Summary by CodeRabbit