From a3e396e1f6d047d3889dc05e503b6b691348ea96 Mon Sep 17 00:00:00 2001 From: Terry Zhao Date: Thu, 18 Sep 2025 14:03:17 -0700 Subject: [PATCH 1/8] fix --- src/{{ project_name_snake }}/qa_workflows.py | 4 ++++ test-proj/.copier-answers.yml | 5 ++--- test-proj/src/test_proj/qa_workflows.py | 3 +++ test-proj/ui/src/libs/config.ts | 1 + test-proj/ui/src/pages/Home.tsx | 12 ++---------- ui/src/libs/config.ts | 3 +++ ui/src/libs/config.ts.jinja | 1 + ui/src/pages/Home.tsx | 12 ++---------- 8 files changed, 18 insertions(+), 23 deletions(-) create mode 100644 ui/src/libs/config.ts diff --git a/src/{{ project_name_snake }}/qa_workflows.py b/src/{{ project_name_snake }}/qa_workflows.py index 5363255..4746117 100644 --- a/src/{{ project_name_snake }}/qa_workflows.py +++ b/src/{{ project_name_snake }}/qa_workflows.py @@ -21,6 +21,10 @@ from llama_index.embeddings.openai import OpenAIEmbedding from llama_index.core.memory import ChatMemoryBuffer +from dotenv import load_dotenv + +load_dotenv() + from .clients import ( LLAMA_CLOUD_API_KEY, LLAMA_CLOUD_BASE_URL, diff --git a/test-proj/.copier-answers.yml b/test-proj/.copier-answers.yml index 8463373..f34abb6 100644 --- a/test-proj/.copier-answers.yml +++ b/test-proj/.copier-answers.yml @@ -1,6 +1,5 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: '2405947' +_commit: c9f43f6 _src_path: . -llama_org_id: asdf -llama_project_id: asdf project_name: test-proj +project_title: Test Proj diff --git a/test-proj/src/test_proj/qa_workflows.py b/test-proj/src/test_proj/qa_workflows.py index 5363255..cada912 100644 --- a/test-proj/src/test_proj/qa_workflows.py +++ b/test-proj/src/test_proj/qa_workflows.py @@ -20,6 +20,9 @@ from llama_index.llms.openai import OpenAI from llama_index.embeddings.openai import OpenAIEmbedding from llama_index.core.memory import ChatMemoryBuffer +from dotenv import load_dotenv + +load_dotenv() from .clients import ( LLAMA_CLOUD_API_KEY, diff --git a/test-proj/ui/src/libs/config.ts b/test-proj/ui/src/libs/config.ts index fec32d8..83db88a 100644 --- a/test-proj/ui/src/libs/config.ts +++ b/test-proj/ui/src/libs/config.ts @@ -1,2 +1,3 @@ export const APP_TITLE = "Test Proj"; export const AGENT_NAME = import.meta.env.VITE_LLAMA_DEPLOY_DEPLOYMENT_NAME; +export const INDEX_NAME = "document_qa_index"; diff --git a/test-proj/ui/src/pages/Home.tsx b/test-proj/ui/src/pages/Home.tsx index 89208a0..c8d54b8 100644 --- a/test-proj/ui/src/pages/Home.tsx +++ b/test-proj/ui/src/pages/Home.tsx @@ -1,6 +1,6 @@ import ChatBot from "../components/ChatBot"; import { WorkflowTrigger } from "@llamaindex/ui"; -import { APP_TITLE } from "../libs/config"; +import { APP_TITLE, INDEX_NAME } from "../libs/config"; export default function Home() { return ( @@ -20,18 +20,10 @@ export default function Home() {
{ return { file_id: files[0].fileId, - index_name: fieldValues.index_name, + index_name: INDEX_NAME, }; }} /> diff --git a/ui/src/libs/config.ts b/ui/src/libs/config.ts new file mode 100644 index 0000000..b5fa29e --- /dev/null +++ b/ui/src/libs/config.ts @@ -0,0 +1,3 @@ +export const APP_TITLE = "Test Project"; +export const AGENT_NAME = import.meta.env.VITE_LLAMA_DEPLOY_DEPLOYMENT_NAME; +export const INDEX_NAME = "document_qa_index"; \ No newline at end of file diff --git a/ui/src/libs/config.ts.jinja b/ui/src/libs/config.ts.jinja index acd8c84..f82681d 100644 --- a/ui/src/libs/config.ts.jinja +++ b/ui/src/libs/config.ts.jinja @@ -1,2 +1,3 @@ export const APP_TITLE = "{{ project_title }}"; export const AGENT_NAME = import.meta.env.VITE_LLAMA_DEPLOY_DEPLOYMENT_NAME; +export const INDEX_NAME = "document_qa_index"; diff --git a/ui/src/pages/Home.tsx b/ui/src/pages/Home.tsx index 89208a0..c8d54b8 100644 --- a/ui/src/pages/Home.tsx +++ b/ui/src/pages/Home.tsx @@ -1,6 +1,6 @@ import ChatBot from "../components/ChatBot"; import { WorkflowTrigger } from "@llamaindex/ui"; -import { APP_TITLE } from "../libs/config"; +import { APP_TITLE, INDEX_NAME } from "../libs/config"; export default function Home() { return ( @@ -20,18 +20,10 @@ export default function Home() {
{ return { file_id: files[0].fileId, - index_name: fieldValues.index_name, + index_name: INDEX_NAME, }; }} /> From fbe00836244fcd9ff4d8a920c7f0bebad6de5b00 Mon Sep 17 00:00:00 2001 From: Terry Zhao Date: Thu, 18 Sep 2025 14:04:43 -0700 Subject: [PATCH 2/8] fix --- test-proj/src/test_proj/qa_workflows.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test-proj/src/test_proj/qa_workflows.py b/test-proj/src/test_proj/qa_workflows.py index cada912..4746117 100644 --- a/test-proj/src/test_proj/qa_workflows.py +++ b/test-proj/src/test_proj/qa_workflows.py @@ -20,6 +20,7 @@ from llama_index.llms.openai import OpenAI from llama_index.embeddings.openai import OpenAIEmbedding from llama_index.core.memory import ChatMemoryBuffer + from dotenv import load_dotenv load_dotenv() From 57f0784346fd4cae4f22f767fc133ef96a444434 Mon Sep 17 00:00:00 2001 From: Terry Zhao Date: Thu, 18 Sep 2025 14:06:28 -0700 Subject: [PATCH 3/8] change readme --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 92d1b72..8163f52 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,6 @@ This application uses LlamaDeploy. For more information see [the docs](https://d 1. install `uv` if you haven't `brew install uv` 2. run `uvx llamactl serve` -3. Visit http://localhost:4501/docs and see workflow APIs - # Organization From 68a16171c5827af1f4bbd4a68e58094c04cb645a Mon Sep 17 00:00:00 2001 From: Terry Zhao Date: Thu, 18 Sep 2025 14:06:43 -0700 Subject: [PATCH 4/8] update readme --- test-proj/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/test-proj/README.md b/test-proj/README.md index 92d1b72..8163f52 100644 --- a/test-proj/README.md +++ b/test-proj/README.md @@ -9,8 +9,6 @@ This application uses LlamaDeploy. For more information see [the docs](https://d 1. install `uv` if you haven't `brew install uv` 2. run `uvx llamactl serve` -3. Visit http://localhost:4501/docs and see workflow APIs - # Organization From a044c0990cbf0b653b05fb4a6f62c70039159c82 Mon Sep 17 00:00:00 2001 From: Terry Zhao Date: Thu, 18 Sep 2025 14:18:00 -0700 Subject: [PATCH 5/8] chore: pass empty filter to hatch run --- .github/workflows/check-regeneration.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-regeneration.yml b/.github/workflows/check-regeneration.yml index cb15cea..787a3e1 100644 --- a/.github/workflows/check-regeneration.yml +++ b/.github/workflows/check-regeneration.yml @@ -41,7 +41,9 @@ jobs: uses: astral-sh/setup-uv@v3 - name: Run Python checks - run: uv run hatch run all-check + # Passing an explicit empty filter avoids Click's sentinel default in newer releases + # breaking Hatch's JSON parsing. + run: uv run hatch run --filter '{}' all-check working-directory: test-proj check-ui: @@ -62,8 +64,7 @@ jobs: - name: Activate pnpm version working-directory: test-proj/ui run: corepack prepare --activate - - name: Run UI checks run: pnpm run all-check - working-directory: test-proj/ui \ No newline at end of file + working-directory: test-proj/ui From 8b84904d51b7efc55bc3eeafafb6a6fa17564b1d Mon Sep 17 00:00:00 2001 From: Terry Zhao Date: Thu, 18 Sep 2025 14:26:51 -0700 Subject: [PATCH 6/8] chore: pin click 8.1.7 for hatch --- pyproject.toml.jinja | 1 + test-proj/pyproject.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/pyproject.toml.jinja b/pyproject.toml.jinja index 08d2618..0e4b1af 100644 --- a/pyproject.toml.jinja +++ b/pyproject.toml.jinja @@ -20,6 +20,7 @@ build-backend = "hatchling.build" [dependency-groups] dev = [ + "click==8.1.7", "hatch>=1.14.1", "pytest>=8.4.2", "ruff>=0.13.0", diff --git a/test-proj/pyproject.toml b/test-proj/pyproject.toml index 7206b7e..f7706af 100644 --- a/test-proj/pyproject.toml +++ b/test-proj/pyproject.toml @@ -20,6 +20,7 @@ build-backend = "hatchling.build" [dependency-groups] dev = [ + "click==8.1.7", "hatch>=1.14.1", "pytest>=8.4.2", "ruff>=0.13.0", From 1d312bf0371e4312cf52ec36c00f9a4e47921258 Mon Sep 17 00:00:00 2001 From: Terry Zhao Date: Thu, 18 Sep 2025 14:34:57 -0700 Subject: [PATCH 7/8] chore: remove hatch filter now that click is pinned --- .github/workflows/check-regeneration.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/check-regeneration.yml b/.github/workflows/check-regeneration.yml index 787a3e1..5651e8e 100644 --- a/.github/workflows/check-regeneration.yml +++ b/.github/workflows/check-regeneration.yml @@ -41,9 +41,7 @@ jobs: uses: astral-sh/setup-uv@v3 - name: Run Python checks - # Passing an explicit empty filter avoids Click's sentinel default in newer releases - # breaking Hatch's JSON parsing. - run: uv run hatch run --filter '{}' all-check + run: uv run hatch run all-check working-directory: test-proj check-ui: From 25d72c815b05d0864fe6b3c645a015085c623210 Mon Sep 17 00:00:00 2001 From: Terry Zhao Date: Thu, 18 Sep 2025 14:42:26 -0700 Subject: [PATCH 8/8] fix: ensure dotenv import precedes client import --- src/{{ project_name_snake }}/qa_workflows.py | 20 +++++++++----------- test-proj/src/test_proj/qa_workflows.py | 20 +++++++++----------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/{{ project_name_snake }}/qa_workflows.py b/src/{{ project_name_snake }}/qa_workflows.py index 4746117..a6a5878 100644 --- a/src/{{ project_name_snake }}/qa_workflows.py +++ b/src/{{ project_name_snake }}/qa_workflows.py @@ -1,10 +1,16 @@ import logging import os +import tempfile import httpx +from dotenv import load_dotenv from llama_cloud.types import RetrievalMode -import tempfile +from llama_index.core import Settings from llama_index.core.chat_engine.types import BaseChatEngine, ChatMode +from llama_index.core.memory import ChatMemoryBuffer +from llama_index.embeddings.openai import OpenAIEmbedding +from llama_index.llms.openai import OpenAI +from llama_cloud_services import LlamaCloudIndex from workflows import Workflow, step, Context from workflows.events import ( StartEvent, @@ -15,16 +21,6 @@ ) from workflows.retry_policy import ConstantDelayRetryPolicy -from llama_cloud_services import LlamaCloudIndex -from llama_index.core import Settings -from llama_index.llms.openai import OpenAI -from llama_index.embeddings.openai import OpenAIEmbedding -from llama_index.core.memory import ChatMemoryBuffer - -from dotenv import load_dotenv - -load_dotenv() - from .clients import ( LLAMA_CLOUD_API_KEY, LLAMA_CLOUD_BASE_URL, @@ -34,6 +30,8 @@ LLAMA_CLOUD_PROJECT_ID, ) +load_dotenv() + logger = logging.getLogger(__name__) diff --git a/test-proj/src/test_proj/qa_workflows.py b/test-proj/src/test_proj/qa_workflows.py index 4746117..a6a5878 100644 --- a/test-proj/src/test_proj/qa_workflows.py +++ b/test-proj/src/test_proj/qa_workflows.py @@ -1,10 +1,16 @@ import logging import os +import tempfile import httpx +from dotenv import load_dotenv from llama_cloud.types import RetrievalMode -import tempfile +from llama_index.core import Settings from llama_index.core.chat_engine.types import BaseChatEngine, ChatMode +from llama_index.core.memory import ChatMemoryBuffer +from llama_index.embeddings.openai import OpenAIEmbedding +from llama_index.llms.openai import OpenAI +from llama_cloud_services import LlamaCloudIndex from workflows import Workflow, step, Context from workflows.events import ( StartEvent, @@ -15,16 +21,6 @@ ) from workflows.retry_policy import ConstantDelayRetryPolicy -from llama_cloud_services import LlamaCloudIndex -from llama_index.core import Settings -from llama_index.llms.openai import OpenAI -from llama_index.embeddings.openai import OpenAIEmbedding -from llama_index.core.memory import ChatMemoryBuffer - -from dotenv import load_dotenv - -load_dotenv() - from .clients import ( LLAMA_CLOUD_API_KEY, LLAMA_CLOUD_BASE_URL, @@ -34,6 +30,8 @@ LLAMA_CLOUD_PROJECT_ID, ) +load_dotenv() + logger = logging.getLogger(__name__)