fix: unused imports and format - #705
Conversation
🦋 Changeset detectedLatest commit: e94fd15 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 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
Sequence Diagram(s)No sequence diagrams generated, as the changes are limited to formatting and import cleanup. Possibly related PRs
Suggested reviewers
Poem
✨ 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.
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 tweakNice cleanup. For consistency with the explicit imports on line 5, you could drop the namespace import and pull in
IOdirectly:-import typing +from typing import IOand 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
📒 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.pypackages/create-llama/templates/components/use-cases/python/deep_research/workflow.pypackages/create-llama/templates/components/use-cases/python/agentic_rag/query.pypackages/create-llama/templates/components/vectordbs/llamaindexserver/llamacloud/python/service.pypackages/create-llama/templates/components/use-cases/python/code_generator/workflow.pypackages/create-llama/templates/components/use-cases/python/document_generator/workflow.pypackages/create-llama/templates/components/use-cases/python/financial_report/utils.pypackages/create-llama/templates/components/use-cases/python/deep_research/utils.pypackages/create-llama/templates/components/use-cases/python/financial_report/workflow.pypackages/create-llama/templates/components/use-cases/python/financial_report/events.pypackages/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 thetemplates/directory.
Templates should be organized by framework, type, and components within thetemplates/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.pypackages/create-llama/templates/components/use-cases/python/deep_research/workflow.pypackages/create-llama/templates/components/use-cases/python/agentic_rag/query.pypackages/create-llama/templates/components/vectordbs/llamaindexserver/llamacloud/python/service.pypackages/create-llama/templates/components/use-cases/python/code_generator/workflow.pypackages/create-llama/templates/components/use-cases/python/document_generator/workflow.pypackages/create-llama/templates/components/use-cases/python/financial_report/utils.pypackages/create-llama/templates/components/use-cases/python/deep_research/utils.pypackages/create-llama/templates/components/use-cases/python/financial_report/workflow.pypackages/create-llama/templates/components/use-cases/python/financial_report/events.pypackages/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 goodAdding 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 correctThe 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 achievedThe 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 addedPOSIX-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
Unionimport 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
ListandEnumimports were correctly removed as they're not used in this file (the code useslistbuilt-in and doesn't define any enums).
10-10: LGTM! Cleaned up unused workflow imports.The
EventandToolSelectionimports 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 fineChanging 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 acknowledgedNo objections; keeps style consistent.
| res: Union[ | ||
| CompletionResponse, | ||
| CompletionResponseAsyncGen, | ||
| AsyncGenerator[ChatResponse, None], | ||
| ], |
There was a problem hiding this comment.
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.
| res: Union[ | ||
| CompletionResponse, | ||
| CompletionResponseAsyncGen, | ||
| AsyncGenerator[ChatResponse, None], | ||
| ], |
There was a problem hiding this comment.
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.
Summary by CodeRabbit