Skip to content

Commit 93e2abe

Browse files
authored
fix: unused imports and format (#705)
1 parent 28b46be commit 93e2abe

13 files changed

Lines changed: 33 additions & 18 deletions

File tree

.changeset/lovely-taxis-sniff.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-llama": patch
3+
---
4+
5+
fix: unused imports and format

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from llama_index.core.indices.base import BaseIndex
66
from llama_index.core.tools.query_engine import QueryEngineTool
77

8+
89
def create_query_engine(index: BaseIndex, **kwargs: Any) -> BaseQueryEngine:
910
"""
1011
Create a query engine for the given index.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from pydantic import BaseModel, Field
3030
from dotenv import load_dotenv
3131

32+
3233
def create_workflow() -> Workflow:
3334
load_dotenv()
3435
init_settings()

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99

1010

1111
async def write_response_to_stream(
12-
res: Union[CompletionResponse, CompletionResponseAsyncGen, AsyncGenerator[ChatResponse, None]],
12+
res: Union[
13+
CompletionResponse,
14+
CompletionResponseAsyncGen,
15+
AsyncGenerator[ChatResponse, None],
16+
],
1317
ctx: Context,
1418
current_agent_name: str = "assistant",
1519
) -> str:
@@ -35,7 +39,7 @@ async def write_response_to_stream(
3539
response=final_response,
3640
current_agent_name=current_agent_name,
3741
tool_calls=[],
38-
raw=getattr(chunk, 'raw', None) or "",
42+
raw=getattr(chunk, "raw", None) or "",
3943
)
4044
)
4145
final_response += chunk.delta or ""

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,4 +585,4 @@ def _get_text_node_content_for_citation(node: NodeWithScore) -> str:
585585
return content
586586

587587

588-
workflow = create_workflow()
588+
workflow = create_workflow()

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22
import time
3-
from typing import Any, Literal, Optional, Union
3+
from typing import Any, Literal, Optional
44

55
from llama_index.core import Settings
66
from llama_index.core.llms import LLM, ChatMessage
@@ -29,11 +29,13 @@
2929
from pydantic import BaseModel, Field
3030
from dotenv import load_dotenv
3131

32+
3233
def create_workflow() -> Workflow:
3334
load_dotenv()
3435
init_settings()
3536
return DocumentArtifactWorkflow(timeout=120.0)
3637

38+
3739
class DocumentRequirement(BaseModel):
3840
type: Literal["markdown", "html"]
3941
title: str

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from llama_index.core.tools.function_tool import FunctionTool
99

1010
# use nextjs for file server
11-
WORKFLOW="chat"
11+
WORKFLOW = "chat"
1212

1313
# define nextjs file server url prefix
1414
FILE_SERVER_URL_PREFIX = f"/deployments/{WORKFLOW}/ui/api/files/output/tools"
@@ -19,6 +19,7 @@
1919
LLAMA_DEPLOY_DIR = os.path.join(tempfile.gettempdir(), "llama_deploy", "deployments")
2020
OUTPUT_DIR = os.path.join(LLAMA_DEPLOY_DIR, WORKFLOW, "ui", "output", "tools")
2121

22+
2223
class DocumentType(Enum):
2324
PDF = "pdf"
2425
HTML = "html"
@@ -206,9 +207,7 @@ def generate_document(
206207

207208
self._write_to_file(content, file_path)
208209

209-
return (
210-
f"{self.file_server_url_prefix}/{file_name}.{file_extension}"
211-
)
210+
return f"{self.file_server_url_prefix}/{file_name}.{file_extension}"
212211

213212
@staticmethod
214213
def _write_to_file(content: BytesIO, file_path: str) -> None:

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ class InputEvent(Event):
2525
class ResearchEvent(Event):
2626
input: list[ToolSelection]
2727

28+
2829
class AnalyzeEvent(Event):
2930
input: list[ToolSelection] | ChatMessage
3031

32+
3133
class ReportEvent(Event):
32-
input: list[ToolSelection]
34+
input: list[ToolSelection]

packages/create-llama/templates/components/use-cases/python/financial_report/interpreter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os
44
import re
55
import uuid
6-
from pathlib import Path
76
from typing import Any, List, Optional
87

98
from pydantic import BaseModel

packages/create-llama/templates/components/use-cases/python/financial_report/query.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from llama_index.core.indices.base import BaseIndex
66
from llama_index.core.tools.query_engine import QueryEngineTool
77

8+
89
def create_query_engine(index: BaseIndex, **kwargs: Any) -> BaseQueryEngine:
910
"""
1011
Create a query engine for the given index.

0 commit comments

Comments
 (0)