Skip to content

fix: unused imports and format - #705

Merged
marcusschiesser merged 2 commits into
mainfrom
tp/fix-format
Jul 11, 2025
Merged

fix: unused imports and format#705
marcusschiesser merged 2 commits into
mainfrom
tp/fix-format

Conversation

@thucpn

@thucpn thucpn commented Jul 11, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Style
    • Improved formatting and code readability in several Python files, including consistent spacing, blank lines, and type annotation formatting.
    • Updated string quote usage for consistency.
  • Chores
    • Removed unused imports across multiple files to streamline the codebase.
    • Added a changeset file documenting these updates.

@thucpn
thucpn requested a review from marcusschiesser July 11, 2025 04:04
@changeset-bot

changeset-bot Bot commented Jul 11, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e94fd15

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-llama Patch

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

@coderabbitai

coderabbitai Bot commented Jul 11, 2025

Copy link
Copy Markdown

Walkthrough

This update applies formatting improvements and removes unused imports across several Python files within the project. Changes are limited to code style, such as adding blank lines, adjusting type annotations for readability, and cleaning up import statements. No logic, control flow, or public interface modifications are introduced.

Changes

Files/Groups Change Summary
.changeset/lovely-taxis-sniff.md Added changeset file documenting formatting and unused import fixes as a patch.
.../python/agentic_rag/query.py
.../python/code_generator/workflow.py
.../python/financial_report/query.py
Added blank lines after imports for improved readability.
.../python/deep_research/utils.py
.../python/financial_report/utils.py
Reformatted type annotations for readability; changed string quotes in getattr calls.
.../python/deep_research/workflow.py Added newline at end of file.
.../python/document_generator/workflow.py Removed unused Union import; added blank lines for spacing.
.../python/financial_report/document_generator.py Added spaces around assignment, blank lines, and simplified return statement formatting.
.../python/financial_report/events.py Added blank lines after class declarations and at file end.
.../python/financial_report/interpreter.py Removed unused Path import.
.../python/financial_report/workflow.py Removed unused imports: List, Enum, ToolSelection, Event.
.../vectordbs/llamaindexserver/llamacloud/python/service.py Removed unused imports: os, Any, List, Set; simplified typing imports.

Sequence Diagram(s)

No sequence diagrams generated, as the changes are limited to formatting and import cleanup.

Possibly related PRs

  • fix lint for release #682: Both PRs involve removing unused imports in the same file packages/create-llama/templates/components/use-cases/python/deep_research/workflow.py, indicating related cleanup changes.

Suggested reviewers

  • leehuwuj
  • marcusschiesser

Poem

Hopping through the code so neat,
Tidying imports, skipping a beat.
Blank lines bloom where logic rests,
Formatting fixed—no more guess!
A rabbit’s touch, with paws so light,
Keeps the codebase clean and bright.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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 docstrings to generate docstrings for this 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.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/create-llama/templates/components/vectordbs/llamaindexserver/llamacloud/python/service.py (1)

3-6: Unused imports trimmed – consider one more readability tweak

Nice cleanup. For consistency with the explicit imports on line 5, you could drop the namespace import and pull in IO directly:

-import typing
+from typing import IO

and in the signature below:

-        upload_file: Union[typing.IO, Tuple[str, BytesIO]],
+        upload_file: Union[IO, Tuple[str, BytesIO]],

No functional impact, purely stylistic.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 28b46be and e94fd15.

📒 Files selected for processing (13)
  • .changeset/lovely-taxis-sniff.md (1 hunks)
  • packages/create-llama/templates/components/use-cases/python/agentic_rag/query.py (1 hunks)
  • packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py (1 hunks)
  • packages/create-llama/templates/components/use-cases/python/deep_research/utils.py (2 hunks)
  • packages/create-llama/templates/components/use-cases/python/deep_research/workflow.py (1 hunks)
  • packages/create-llama/templates/components/use-cases/python/document_generator/workflow.py (2 hunks)
  • packages/create-llama/templates/components/use-cases/python/financial_report/document_generator.py (3 hunks)
  • packages/create-llama/templates/components/use-cases/python/financial_report/events.py (1 hunks)
  • packages/create-llama/templates/components/use-cases/python/financial_report/interpreter.py (0 hunks)
  • packages/create-llama/templates/components/use-cases/python/financial_report/query.py (1 hunks)
  • packages/create-llama/templates/components/use-cases/python/financial_report/utils.py (2 hunks)
  • packages/create-llama/templates/components/use-cases/python/financial_report/workflow.py (1 hunks)
  • packages/create-llama/templates/components/vectordbs/llamaindexserver/llamacloud/python/service.py (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/create-llama/templates/components/use-cases/python/financial_report/interpreter.py
🧰 Additional context used
📓 Path-based instructions (2)
`packages/create-llama/templates/**/*`: Templates for the CLI should be organize...

packages/create-llama/templates/**/*: Templates for the CLI should be organized under 'packages/create-llama/templates/', with 'types/' for base project structures and 'components/' for reusable framework components.

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • packages/create-llama/templates/components/use-cases/python/financial_report/query.py
  • packages/create-llama/templates/components/use-cases/python/deep_research/workflow.py
  • packages/create-llama/templates/components/use-cases/python/agentic_rag/query.py
  • packages/create-llama/templates/components/vectordbs/llamaindexserver/llamacloud/python/service.py
  • packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py
  • packages/create-llama/templates/components/use-cases/python/document_generator/workflow.py
  • packages/create-llama/templates/components/use-cases/python/financial_report/utils.py
  • packages/create-llama/templates/components/use-cases/python/deep_research/utils.py
  • packages/create-llama/templates/components/use-cases/python/financial_report/workflow.py
  • packages/create-llama/templates/components/use-cases/python/financial_report/events.py
  • packages/create-llama/templates/components/use-cases/python/financial_report/document_generator.py
`packages/create-llama/templates/**/*`: Project templates for different framewor...

packages/create-llama/templates/**/*: Project templates for different frameworks and use cases should be stored in the templates/ directory.
Templates should be organized by framework, type, and components within the templates/ directory.

📄 Source: CodeRabbit Inference Engine (packages/create-llama/CLAUDE.md)

List of files the instruction was applied to:

  • packages/create-llama/templates/components/use-cases/python/financial_report/query.py
  • packages/create-llama/templates/components/use-cases/python/deep_research/workflow.py
  • packages/create-llama/templates/components/use-cases/python/agentic_rag/query.py
  • packages/create-llama/templates/components/vectordbs/llamaindexserver/llamacloud/python/service.py
  • packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py
  • packages/create-llama/templates/components/use-cases/python/document_generator/workflow.py
  • packages/create-llama/templates/components/use-cases/python/financial_report/utils.py
  • packages/create-llama/templates/components/use-cases/python/deep_research/utils.py
  • packages/create-llama/templates/components/use-cases/python/financial_report/workflow.py
  • packages/create-llama/templates/components/use-cases/python/financial_report/events.py
  • packages/create-llama/templates/components/use-cases/python/financial_report/document_generator.py
🧠 Learnings (9)
📓 Common learnings
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/**/*.py : All Python code should be formatted using black.
packages/create-llama/templates/components/use-cases/python/deep_research/workflow.py (1)
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/gen_ui/main.py : AI-powered component generation using LLM workflows should be implemented in gen_ui/main.py, including GenUIWorkflow, planning, aggregation, code generation, and validation.
packages/create-llama/templates/components/vectordbs/llamaindexserver/llamacloud/python/service.py (10)
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/llama_index/server/__init__.py : Package exports, including LlamaIndexServer, UIConfig, and UIEvent, should be defined in llama_index/server/__init__.py.
Learnt from: CR
PR: run-llama/create-llama#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:26.711Z
Learning: Applies to python/llama-index-server/**/*.py : Python server code should be located in 'python/llama-index-server/' and use FastAPI, with the core server logic implemented in a 'LlamaIndexServer' class.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/services/**/* : Business logic for file handling, LlamaCloud integration, and UI generation should be implemented within the services/ directory.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/**/*.py : All Python code should be type-checked using mypy with strict settings.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/**/*.py : All Python code should be linted using ruff and pylint.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/**/pyproject.toml : Package configuration, dependencies, and build settings must be specified in pyproject.toml.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/tools/**/* : Document generation, interpreter tools, and index querying utilities should be implemented within the tools/ directory.
Learnt from: CR
PR: run-llama/create-llama#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:26.711Z
Learning: Applies to python/llama-index-server/**/*test*.py : Python unit tests should use pytest and provide comprehensive API and service coverage.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/**/*.py : All Python code should be formatted using black.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/**/.env : Environment variables should be managed using .env files for API keys and configuration.
packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py (4)
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/gen_ui/main.py : AI-powered component generation using LLM workflows should be implemented in gen_ui/main.py, including GenUIWorkflow, planning, aggregation, code generation, and validation.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/server/examples/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:19:29.893Z
Learning: Applies to packages/server/examples/{simple-workflow/calculator.ts,agentic-rag/index.ts,custom-layout/index.ts,devmode/index.ts,src/app/workflow.ts} : Use the workflow factory pattern for workflow creation, i.e., define `workflowFactory` as a function returning an agent instance, optionally async.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Use factory functions for stateless workflow creation.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/examples/**/* : Sample workflows demonstrating different features should be placed in the examples/ directory.
packages/create-llama/templates/components/use-cases/python/document_generator/workflow.py (7)
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/gen_ui/main.py : AI-powered component generation using LLM workflows should be implemented in gen_ui/main.py, including GenUIWorkflow, planning, aggregation, code generation, and validation.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:57.724Z
Learning: Applies to packages/server/src/types.ts : Type definitions for WorkflowFactory, UIConfig, and LlamaIndexServerOptions should be implemented in src/types.ts.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/api/routers/chat.py : The /api/chat endpoint must support streaming responses compatible with Vercel, background tasks for file downloads, and LlamaCloud integration if enabled.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/api/routers/chat.py : The /api/chat endpoint should be implemented in api/routers/chat.py and support streaming responses, message format conversion, background tasks, and optional LlamaCloud integration.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Use factory functions for stateless workflow creation.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Workflow factory functions should accept a ChatRequest and return a Workflow instance, following the documented contract.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/server/examples/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:19:29.893Z
Learning: Applies to packages/server/examples/{simple-workflow/calculator.ts,agentic-rag/index.ts,custom-layout/index.ts,devmode/index.ts,src/app/workflow.ts} : Use the workflow factory pattern for workflow creation, i.e., define `workflowFactory` as a function returning an agent instance, optionally async.
.changeset/lovely-taxis-sniff.md (10)
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/create-llama/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:39.549Z
Learning: Applies to packages/create-llama/**/package.json : The package should support a `pack-install` script in `package.json` for creating and installing the local package for testing.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/create-llama/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:39.549Z
Learning: Applies to packages/create-llama/**/package.json : Build scripts should be defined in `package.json` for building, cleaning, and developing the CLI.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/create-llama/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:39.549Z
Learning: Applies to packages/create-llama/**/index.ts : The main CLI entry point should be implemented in `index.ts` using Commander.js for argument parsing.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/create-llama/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:39.549Z
Learning: Applies to packages/create-llama/**/create-app.ts : Core application creation logic and orchestration should be implemented in `create-app.ts`.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/create-llama/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:39.549Z
Learning: Applies to packages/create-llama/**/package.json : The package configuration and binary entry point should be defined in `package.json`, with the binary pointing to `./dist/index.js`.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/create-llama/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:39.549Z
Learning: Applies to packages/create-llama/helpers/**/* : Utility functions for package management, file operations, and configuration should be placed in the `helpers/` directory.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/create-llama/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:39.549Z
Learning: Applies to packages/create-llama/**/package.json : Testing scripts for end-to-end, Python-specific, and TypeScript-specific templates should be defined in `package.json`.
Learnt from: CR
PR: run-llama/create-llama#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:26.711Z
Learning: CLI build artifacts and template caches should be cleaned using the 'npm run clean' script in 'packages/create-llama/'.
Learnt from: CR
PR: run-llama/create-llama#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:26.711Z
Learning: Applies to packages/create-llama/e2e/**/* : Playwright end-to-end tests should be placed in 'packages/create-llama/e2e/' and validate both Python and TypeScript generated projects.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/**/pyproject.toml : Package configuration, dependencies, and build settings must be specified in pyproject.toml.
packages/create-llama/templates/components/use-cases/python/financial_report/workflow.py (4)
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/gen_ui/main.py : AI-powered component generation using LLM workflows should be implemented in gen_ui/main.py, including GenUIWorkflow, planning, aggregation, code generation, and validation.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/layout/**/* : Use shared layout components across workflows for layout consistency.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/api/routers/chat.py : The /api/chat endpoint must support streaming responses compatible with Vercel, background tasks for file downloads, and LlamaCloud integration if enabled.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/**/.env : Environment variables should be managed using .env files for API keys and configuration.
packages/create-llama/templates/components/use-cases/python/financial_report/events.py (2)
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/api/models.py : Structured event types for workflow communication, including UIEvent, ArtifactEvent, SourceNodesEvent, and AgentRunEvent, should be defined in api/models.py using Pydantic data models.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/api/models.py : Design clear Pydantic models for UI event schemas.
packages/create-llama/templates/components/use-cases/python/financial_report/document_generator.py (12)
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/gen_ui/main.py : AI-powered component generation using LLM workflows should be implemented in gen_ui/main.py, including GenUIWorkflow, planning, aggregation, code generation, and validation.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/server/examples/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:19:29.893Z
Learning: Applies to packages/server/examples/**/*.ts : Use the `agent()` function from `@llamaindex/workflow` with tool arrays for agent creation.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/server/examples/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:19:29.893Z
Learning: Applies to packages/server/examples/{simple-workflow/calculator.ts,agentic-rag/index.ts,custom-layout/index.ts,devmode/index.ts,src/app/workflow.ts} : Use the standard server setup pattern: instantiate `LlamaIndexServer` with `workflow`, `uiConfig`, and `port`, then call `.start()`.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: The LlamaIndexServer should be configured using the workflow_factory parameter, with environment and UI configuration options as shown in the provided example.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/server/examples/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:19:29.893Z
Learning: Applies to packages/server/examples/src/app/workflow*.ts : Organize workflow files separately in development mode, e.g., `src/app/workflow.ts`.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/server/examples/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:19:29.893Z
Learning: Applies to packages/server/examples/{simple-workflow/calculator.ts,agentic-rag/index.ts,custom-layout/index.ts,devmode/index.ts,src/app/workflow.ts} : Configure UI with options such as `starterQuestions`, `layoutDir`, `devMode`, and `suggestNextQuestions` in the server setup.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/examples/**/* : Sample workflows demonstrating different features should be placed in the examples/ directory.
Learnt from: CR
PR: run-llama/create-llama#0
File: packages/server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:57.724Z
Learning: Applies to packages/server/next/api/{chat,components,layout,files/**}/route.ts : API route handlers for chat, components, layout, and file serving should be implemented in next/api/{chat,components,layout,files/**}/route.ts.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/tools/**/* : Document generation, interpreter tools, and index querying utilities should be implemented within the tools/ directory.
Learnt from: CR
PR: run-llama/create-llama#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:26.711Z
Learning: Applies to packages/server/**/*.{ts,tsx} : TypeScript server code should be located in 'packages/server/' and use Next.js as the framework, with the core server logic implemented in a 'LlamaIndexServer' class.
Learnt from: CR
PR: run-llama/create-llama#0
File: python/llama-index-server/CLAUDE.md:0-0
Timestamp: 2025-06-30T10:20:25.875Z
Learning: Applies to python/llama-index-server/layout/**/* : Use shared layout components across workflows for layout consistency.
Learnt from: CR
PR: run-llama/create-llama#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:18:26.711Z
Learning: Applies to packages/create-llama/templates/**/* : Templates for the CLI should be organized under 'packages/create-llama/templates/', with 'types/' for base project structures and 'components/' for reusable framework components.
🧬 Code Graph Analysis (1)
packages/create-llama/templates/components/use-cases/python/document_generator/workflow.py (5)
packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py (1)
  • create_workflow (33-36)
packages/create-llama/templates/components/use-cases/python/deep_research/workflow.py (1)
  • create_workflow (48-61)
packages/create-llama/templates/components/use-cases/python/financial_report/workflow.py (1)
  • create_workflow (35-57)
packages/create-llama/templates/components/use-cases/python/agentic_rag/workflow.py (1)
  • create_workflow (12-32)
packages/create-llama/templates/types/llamaindexserver/fastapi/src/settings.py (1)
  • init_settings (8-12)
⏰ 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). (15)
  • GitHub Check: Unit Tests (ubuntu-latest, 3.9)
  • GitHub Check: Unit Tests (windows-latest, 3.9)
  • GitHub Check: typescript (22, macos-latest, nextjs, llamacloud)
  • GitHub Check: typescript (22, ubuntu-22.04, nextjs, llamacloud)
  • GitHub Check: typescript (22, windows-latest, nextjs, none)
  • GitHub Check: typescript (22, ubuntu-22.04, nextjs, none)
  • GitHub Check: typescript (22, windows-latest, nextjs, llamacloud)
  • GitHub Check: typescript (22, macos-latest, nextjs, none)
  • GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, none)
  • GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, llamacloud)
  • GitHub Check: python (20, 3.11, windows-latest, fastapi, llamacloud)
  • GitHub Check: python (20, 3.11, macos-latest, fastapi, llamacloud)
  • GitHub Check: python (20, 3.11, windows-latest, fastapi, none)
  • GitHub Check: python (20, 3.11, macos-latest, fastapi, none)
  • GitHub Check: lint
🔇 Additional comments (15)
packages/create-llama/templates/components/use-cases/python/financial_report/query.py (1)

7-9: PEP 8-compliant spacing – all good

Adding the second blank line cleanly separates the import block from the first top-level function, matching PEP 8. No further action needed.

packages/create-llama/templates/components/use-cases/python/agentic_rag/query.py (1)

7-9: Import / definition separation looks correct

The additional blank line brings the file in line with PEP 8’s “two blank lines before a top-level definition” rule. ✅

packages/create-llama/templates/components/use-cases/python/code_generator/workflow.py (1)

30-34: Consistent top-level spacing achieved

The blank line after the last import ensures consistent formatting across the codebase. Nice touch.

packages/create-llama/templates/components/use-cases/python/deep_research/workflow.py (1)

586-589: Terminal newline added

POSIX-style newline at end of file is now present; this prevents formatter warnings.

.changeset/lovely-taxis-sniff.md (1)

1-6: LGTM! Standard changeset documentation.

The changeset properly documents the formatting and import cleanup changes.

packages/create-llama/templates/components/use-cases/python/financial_report/events.py (1)

28-34: LGTM! Improved class separation formatting.

The added blank lines between class definitions improve readability and follow Python style conventions.

packages/create-llama/templates/components/use-cases/python/financial_report/document_generator.py (3)

11-11: LGTM! Improved assignment operator spacing.

Adding spaces around the assignment operator follows PEP 8 style guidelines.


22-22: LGTM! Improved class definition formatting.

The blank line before the class definition improves readability.


210-210: LGTM! Simplified return statement.

Removing unnecessary parentheses around the return value simplifies the code.

packages/create-llama/templates/components/use-cases/python/document_generator/workflow.py (2)

3-3: LGTM! Removed unused import.

The Union import was correctly removed as it's not used anywhere in the file.


32-38: LGTM! Improved function and class definition formatting.

The added blank lines before the function and class definitions improve readability and follow Python style conventions.

packages/create-llama/templates/components/use-cases/python/financial_report/workflow.py (2)

2-2: LGTM! Cleaned up unused typing imports.

The List and Enum imports were correctly removed as they're not used in this file (the code uses list built-in and doesn't define any enums).


10-10: LGTM! Cleaned up unused workflow imports.

The Event and ToolSelection imports were correctly removed as they're not referenced in this file.

packages/create-llama/templates/components/use-cases/python/financial_report/utils.py (1)

42-42: Stylistic quote change is fine

Changing to double quotes maintains consistency with the surrounding code; no functional impact.

packages/create-llama/templates/components/use-cases/python/deep_research/utils.py (1)

42-42: Quote style change acknowledged

No objections; keeps style consistent.

Comment on lines +12 to +16
res: Union[
CompletionResponse,
CompletionResponseAsyncGen,
AsyncGenerator[ChatResponse, None],
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Replace typing.AsyncGenerator with collections.abc.AsyncGenerator to prevent TypeError at runtime

typing.AsyncGenerator is a typing alias; using it with isinstance (see line 33) raises
TypeError: typing.AsyncGenerator cannot be used with isinstance().
Switch to the concrete class from collections.abc, or adjust the runtime check.

-from typing import AsyncGenerator, Union
+from typing import Union
+from collections.abc import AsyncGenerator
-    res: Union[
-        CompletionResponse,
-        CompletionResponseAsyncGen,
-        AsyncGenerator[ChatResponse, None],
-    ],
+    res: Union[
+        CompletionResponse,
+        CompletionResponseAsyncGen,
+        AsyncGenerator,  # concrete ABC – keeps isinstance() safe
+    ],

Optionally, update the isinstance guard:

-    if isinstance(res, AsyncGenerator):
+    if isinstance(res, AsyncGenerator):

(or if hasattr(res, "__aiter__"): for broader support).

Failing to change this will crash on the very first streaming response.

🤖 Prompt for AI Agents
In
packages/create-llama/templates/components/use-cases/python/financial_report/utils.py
around lines 12 to 16, replace the import of AsyncGenerator from typing with
AsyncGenerator from collections.abc to avoid a TypeError when using isinstance
checks at runtime. Update the import statement accordingly and modify any
isinstance checks on AsyncGenerator to use the collections.abc version or
alternatively use a hasattr check for __aiter__ to support broader async
iterable types.

Comment on lines +12 to +16
res: Union[
CompletionResponse,
CompletionResponseAsyncGen,
AsyncGenerator[ChatResponse, None],
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Same AsyncGenerator runtime-check issue as in financial_report/utils.py

The identical type-hint / isinstance combination will raise TypeError during streaming.
Apply the same fix suggested in the other file (import from collections.abc or drop the runtime check).

🤖 Prompt for AI Agents
In
packages/create-llama/templates/components/use-cases/python/deep_research/utils.py
around lines 12 to 16, the type hint uses AsyncGenerator from typing but the
runtime isinstance check on AsyncGenerator causes a TypeError during streaming.
Fix this by importing AsyncGenerator from collections.abc instead of typing or
remove the runtime isinstance check on AsyncGenerator to avoid the TypeError.

@marcusschiesser
marcusschiesser merged commit 93e2abe into main Jul 11, 2025
18 checks passed
@marcusschiesser
marcusschiesser deleted the tp/fix-format branch July 11, 2025 04:08
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.

2 participants