Skip to content

Commit 9e7bfbb

Browse files
authored
Terry/qa template (#2)
* fix * fix * change readme * update readme * chore: pass empty filter to hatch run * chore: pin click 8.1.7 for hatch * chore: remove hatch filter now that click is pinned * fix: ensure dotenv import precedes client import
1 parent 215aa69 commit 9e7bfbb

File tree

13 files changed

+32
-43
lines changed

13 files changed

+32
-43
lines changed

.github/workflows/check-regeneration.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ jobs:
6262
- name: Activate pnpm version
6363
working-directory: test-proj/ui
6464
run: corepack prepare --activate
65-
6665

6766
- name: Run UI checks
6867
run: pnpm run all-check
69-
working-directory: test-proj/ui
68+
working-directory: test-proj/ui

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ This application uses LlamaDeploy. For more information see [the docs](https://d
99

1010
1. install `uv` if you haven't `brew install uv`
1111
2. run `uvx llamactl serve`
12-
3. Visit http://localhost:4501/docs and see workflow APIs
13-
1412

1513
# Organization
1614

pyproject.toml.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ build-backend = "hatchling.build"
2020

2121
[dependency-groups]
2222
dev = [
23+
"click==8.1.7",
2324
"hatch>=1.14.1",
2425
"pytest>=8.4.2",
2526
"ruff>=0.13.0",

src/{{ project_name_snake }}/qa_workflows.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import logging
22
import os
3+
import tempfile
34

45
import httpx
6+
from dotenv import load_dotenv
57
from llama_cloud.types import RetrievalMode
6-
import tempfile
8+
from llama_index.core import Settings
79
from llama_index.core.chat_engine.types import BaseChatEngine, ChatMode
10+
from llama_index.core.memory import ChatMemoryBuffer
11+
from llama_index.embeddings.openai import OpenAIEmbedding
12+
from llama_index.llms.openai import OpenAI
13+
from llama_cloud_services import LlamaCloudIndex
814
from workflows import Workflow, step, Context
915
from workflows.events import (
1016
StartEvent,
@@ -15,12 +21,6 @@
1521
)
1622
from workflows.retry_policy import ConstantDelayRetryPolicy
1723

18-
from llama_cloud_services import LlamaCloudIndex
19-
from llama_index.core import Settings
20-
from llama_index.llms.openai import OpenAI
21-
from llama_index.embeddings.openai import OpenAIEmbedding
22-
from llama_index.core.memory import ChatMemoryBuffer
23-
2424
from .clients import (
2525
LLAMA_CLOUD_API_KEY,
2626
LLAMA_CLOUD_BASE_URL,
@@ -30,6 +30,8 @@
3030
LLAMA_CLOUD_PROJECT_ID,
3131
)
3232

33+
load_dotenv()
34+
3335

3436
logger = logging.getLogger(__name__)
3537

test-proj/.copier-answers.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2-
_commit: '2405947'
2+
_commit: c9f43f6
33
_src_path: .
4-
llama_org_id: asdf
5-
llama_project_id: asdf
64
project_name: test-proj
5+
project_title: Test Proj

test-proj/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ This application uses LlamaDeploy. For more information see [the docs](https://d
99

1010
1. install `uv` if you haven't `brew install uv`
1111
2. run `uvx llamactl serve`
12-
3. Visit http://localhost:4501/docs and see workflow APIs
13-
1412

1513
# Organization
1614

test-proj/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ build-backend = "hatchling.build"
2020

2121
[dependency-groups]
2222
dev = [
23+
"click==8.1.7",
2324
"hatch>=1.14.1",
2425
"pytest>=8.4.2",
2526
"ruff>=0.13.0",

test-proj/src/test_proj/qa_workflows.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import logging
22
import os
3+
import tempfile
34

45
import httpx
6+
from dotenv import load_dotenv
57
from llama_cloud.types import RetrievalMode
6-
import tempfile
8+
from llama_index.core import Settings
79
from llama_index.core.chat_engine.types import BaseChatEngine, ChatMode
10+
from llama_index.core.memory import ChatMemoryBuffer
11+
from llama_index.embeddings.openai import OpenAIEmbedding
12+
from llama_index.llms.openai import OpenAI
13+
from llama_cloud_services import LlamaCloudIndex
814
from workflows import Workflow, step, Context
915
from workflows.events import (
1016
StartEvent,
@@ -15,12 +21,6 @@
1521
)
1622
from workflows.retry_policy import ConstantDelayRetryPolicy
1723

18-
from llama_cloud_services import LlamaCloudIndex
19-
from llama_index.core import Settings
20-
from llama_index.llms.openai import OpenAI
21-
from llama_index.embeddings.openai import OpenAIEmbedding
22-
from llama_index.core.memory import ChatMemoryBuffer
23-
2424
from .clients import (
2525
LLAMA_CLOUD_API_KEY,
2626
LLAMA_CLOUD_BASE_URL,
@@ -30,6 +30,8 @@
3030
LLAMA_CLOUD_PROJECT_ID,
3131
)
3232

33+
load_dotenv()
34+
3335

3436
logger = logging.getLogger(__name__)
3537

test-proj/ui/src/libs/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export const APP_TITLE = "Test Proj";
22
export const AGENT_NAME = import.meta.env.VITE_LLAMA_DEPLOY_DEPLOYMENT_NAME;
3+
export const INDEX_NAME = "document_qa_index";

test-proj/ui/src/pages/Home.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ChatBot from "../components/ChatBot";
22
import { WorkflowTrigger } from "@llamaindex/ui";
3-
import { APP_TITLE } from "../libs/config";
3+
import { APP_TITLE, INDEX_NAME } from "../libs/config";
44

55
export default function Home() {
66
return (
@@ -20,18 +20,10 @@ export default function Home() {
2020
<div className="flex mb-4">
2121
<WorkflowTrigger
2222
workflowName="upload"
23-
inputFields={[
24-
{
25-
key: "index_name",
26-
label: "Index Name",
27-
placeholder: "e.g. document_qa_index",
28-
required: true,
29-
},
30-
]}
3123
customWorkflowInput={(files, fieldValues) => {
3224
return {
3325
file_id: files[0].fileId,
34-
index_name: fieldValues.index_name,
26+
index_name: INDEX_NAME,
3527
};
3628
}}
3729
/>

0 commit comments

Comments
 (0)