Skip to content

Commit fec752e

Browse files
authored
refactor: llamacloud configs (#707)
* refactor: llamacloud configs * refactor (ts-proxy): update create llama for 2 types of server file * update CL for ts * update doc * fix api/files path * update document * Create gorgeous-squids-run.md
1 parent 63f5f6f commit fec752e

File tree

17 files changed

+151
-22
lines changed

17 files changed

+151
-22
lines changed

.changeset/gorgeous-squids-run.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"create-llama": patch
3+
"@llamaindex/server": minor
4+
---
5+
6+
refactor: llamacloud configs

packages/create-llama/helpers/python.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,17 @@ const installLlamaIndexServerTemplate = async ({
439439
});
440440

441441
// copy ts server to ui folder
442-
await copy("**", uiDir, {
442+
const tsProxyDir = path.join(templatesDir, "components", "ts-proxy");
443+
await copy("package.json", uiDir, {
443444
parents: true,
444-
cwd: path.join(templatesDir, "components", "ts-proxy"),
445+
cwd: tsProxyDir,
446+
});
447+
const serverFileLocation = useLlamaParse
448+
? path.join(tsProxyDir, "llamacloud")
449+
: path.join(tsProxyDir);
450+
await copy("index.ts", uiDir, {
451+
parents: true,
452+
cwd: serverFileLocation,
445453
});
446454

447455
// Copy custom UI components to ui/components folder

packages/create-llama/helpers/typescript.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ export const installTSTemplate = async ({
133133
modelConfig,
134134
dataSources,
135135
});
136+
137+
if (vectorDb === "llamacloud") {
138+
// replace index.ts with llamacloud/index.ts
139+
await fs.rm(path.join(root, "src", "index.ts"));
140+
await copy("index.ts", path.join(root, "src"), {
141+
parents: true,
142+
cwd: path.join(root, "src", "llamacloud"),
143+
});
144+
}
145+
146+
// remove llamacloud folder
147+
await fs.rm(path.join(root, "src", "llamacloud"), { recursive: true });
136148
} else {
137149
throw new Error(`Template ${template} not supported`);
138150
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { LlamaIndexServer } from "@llamaindex/server";
2+
3+
new LlamaIndexServer({
4+
uiConfig: {
5+
componentsDir: "components",
6+
layoutDir: "layout",
7+
llamaDeploy: { deployment: "chat", workflow: "workflow" },
8+
},
9+
llamaCloud: {
10+
outputDir: "output/llamacloud",
11+
},
12+
}).start();

packages/create-llama/templates/components/use-cases/python/agentic_rag/README-template.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,16 @@ The following are the available options:
9393
- `starterQuestions`: Predefined questions for chat interface
9494
- `componentsDir`: Directory for custom event components
9595
- `layoutDir`: Directory for custom layout components
96-
- `llamaCloudIndexSelector`: Enable LlamaCloud integration
9796
- `llamaDeploy`: The LlamaDeploy configration (deployment name and workflow name that defined in the [llama_deploy.yml](llama_deploy.yml) file)
9897

98+
## LlamaCloud Integration
99+
100+
You can enable LlamaCloud integration by setting the `llamaCloud` option in the [ui/index.ts](ui/index.ts) file.
101+
102+
The following are the available options:
103+
104+
- `outputDir`: The directory for LlamaCloud output
105+
99106
## Learn More
100107

101108
- [LlamaIndex Documentation](https://docs.llamaindex.ai) - learn about LlamaIndex.

packages/create-llama/templates/components/use-cases/python/code_generator/README-template.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,16 @@ The following are the available options:
8686
- `starterQuestions`: Predefined questions for chat interface
8787
- `componentsDir`: Directory for custom event components
8888
- `layoutDir`: Directory for custom layout components
89-
- `llamaCloudIndexSelector`: Enable LlamaCloud integration
9089
- `llamaDeploy`: The LlamaDeploy configration (deployment name and workflow name that defined in the [llama_deploy.yml](llama_deploy.yml) file)
9190

91+
## LlamaCloud Integration
92+
93+
You can enable LlamaCloud integration by setting the `llamaCloud` option in the [ui/index.ts](ui/index.ts) file.
94+
95+
The following are the available options:
96+
97+
- `outputDir`: The directory for LlamaCloud output
98+
9299
## Learn More
93100

94101
- [LlamaIndex Documentation](https://docs.llamaindex.ai) - learn about LlamaIndex.

packages/create-llama/templates/components/use-cases/python/deep_research/README-template.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,16 @@ The following are the available options:
9393
- `starterQuestions`: Predefined questions for chat interface
9494
- `componentsDir`: Directory for custom event components
9595
- `layoutDir`: Directory for custom layout components
96-
- `llamaCloudIndexSelector`: Enable LlamaCloud integration
9796
- `llamaDeploy`: The LlamaDeploy configration (deployment name and workflow name that defined in the [llama_deploy.yml](llama_deploy.yml) file)
9897

98+
## LlamaCloud Integration
99+
100+
You can enable LlamaCloud integration by setting the `llamaCloud` option in the [ui/index.ts](ui/index.ts) file.
101+
102+
The following are the available options:
103+
104+
- `outputDir`: The directory for LlamaCloud output
105+
99106
## Learn More
100107

101108
- [LlamaIndex Documentation](https://docs.llamaindex.ai) - learn about LlamaIndex.

packages/create-llama/templates/components/use-cases/python/document_generator/README-template.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,18 @@ The following are the available options:
8585
- `starterQuestions`: Predefined questions for chat interface
8686
- `componentsDir`: Directory for custom event components
8787
- `layoutDir`: Directory for custom layout components
88-
- `llamaCloudIndexSelector`: Enable LlamaCloud integration
8988
- `llamaDeploy`: The LlamaDeploy configration (deployment name and workflow name that defined in the [llama_deploy.yml](llama_deploy.yml) file)
9089

9190
To customize the UI, you can start by modifying the [./ui/components/ui_event.jsx](./ui/components/ui_event.jsx) file.
9291

92+
## LlamaCloud Integration
93+
94+
You can enable LlamaCloud integration by setting the `llamaCloud` option in the [ui/index.ts](ui/index.ts) file.
95+
96+
The following are the available options:
97+
98+
- `outputDir`: The directory for LlamaCloud output
99+
93100
## Learn More
94101

95102
- [LlamaIndex Documentation](https://docs.llamaindex.ai) - learn about LlamaIndex.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { LlamaIndexServer } from "@llamaindex/server";
2+
import "dotenv/config";
3+
import { initSettings } from "./app/settings";
4+
import { workflowFactory } from "./app/workflow";
5+
6+
initSettings();
7+
8+
new LlamaIndexServer({
9+
workflow: workflowFactory,
10+
uiConfig: {
11+
componentsDir: "components",
12+
devMode: true,
13+
},
14+
llamaCloud: {
15+
outputDir: "output/llamacloud",
16+
},
17+
}).start();

packages/server/CLAUDE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,11 @@ Server configuration through `LlamaIndexServerOptions`:
128128
- `uiConfig.starterQuestions`: Predefined questions for chat interface
129129
- `uiConfig.componentsDir`: Directory for custom event components
130130
- `uiConfig.layoutDir`: Directory for custom layout components
131-
- `uiConfig.llamaCloudIndexSelector`: Enable LlamaCloud integration
132131
- `uiConfig.devMode`: Enable live code editing
133132
- `suggestNextQuestions`: Auto-suggest follow-up questions
133+
- `llamaCloud`: An object to configure the LlamaCloud integration containing the following properties:
134+
- `outputDir`: The directory for LlamaCloud output
135+
- `indexSelector`: Whether to show the LlamaCloud index selector in the chat UI
134136

135137
## Dependencies
136138

0 commit comments

Comments
 (0)