Skip to content

Commit bb3c4b9

Browse files
committed
bump llama-index-callbacks-arize-phoenix package and add test
1 parent 51dc0e4 commit bb3c4b9

File tree

4 files changed

+99
-47
lines changed

4 files changed

+99
-47
lines changed

.changeset/perfect-bags-greet.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-llama": patch
3+
---
4+
5+
Bump package for llamatrace observability

e2e/python/resolve_dependencies.spec.ts

+88-46
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fs from "fs";
44
import path from "path";
55
import util from "util";
66
import { TemplateFramework, TemplateVectorDB } from "../../helpers/types";
7-
import { createTestDir, runCreateLlama } from "../utils";
7+
import { RunCreateLlamaOptions, createTestDir, runCreateLlama } from "../utils";
88

99
const execAsync = util.promisify(exec);
1010

@@ -42,62 +42,69 @@ if (
4242
"--db-source mysql+pymysql://user:pass@localhost:3306/mydb",
4343
];
4444

45+
const observabilityOptions = ["llamatrace", "traceloop"];
46+
47+
// Run separate tests for each observability option to reduce CI runtime
48+
test.describe("Test resolve python dependencies with observability", () => {
49+
// Testing with streaming template, vectorDb: none, tools: none, and dataSource: --example-file
50+
for (const observability of observabilityOptions) {
51+
test(`observability: ${observability}`, async () => {
52+
const cwd = await createTestDir();
53+
54+
await createAndCheckLlamaProject({
55+
options: {
56+
cwd,
57+
templateType: "streaming",
58+
templateFramework,
59+
dataSource,
60+
vectorDb: "none",
61+
tools: "none",
62+
port: 3000, // port, not used
63+
externalPort: 8000, // externalPort, not used
64+
postInstallAction: "none", // postInstallAction
65+
templateUI: undefined, // ui
66+
appType: "--no-frontend", // appType
67+
llamaCloudProjectName: undefined, // llamaCloudProjectName
68+
llamaCloudIndexName: undefined, // llamaCloudIndexName
69+
observability,
70+
},
71+
});
72+
});
73+
}
74+
});
75+
4576
test.describe("Test resolve python dependencies", () => {
4677
for (const vectorDb of vectorDbs) {
4778
for (const tool of toolOptions) {
4879
for (const dataSource of dataSources) {
4980
const dataSourceType = dataSource.split(" ")[0];
50-
const optionDescription = `vectorDb: ${vectorDb}, tools: ${tool}, dataSource: ${dataSourceType}`;
81+
const toolDescription = tool === "none" ? "no tools" : tool;
82+
const optionDescription = `vectorDb: ${vectorDb}, ${toolDescription}, dataSource: ${dataSourceType}`;
5183

5284
test(`options: ${optionDescription}`, async () => {
5385
const cwd = await createTestDir();
5486

55-
const result = await runCreateLlama({
56-
cwd,
57-
templateType: "streaming",
58-
templateFramework,
59-
dataSource,
60-
vectorDb,
61-
port: 3000, // port
62-
externalPort: 8000, // externalPort
63-
postInstallAction: "none", // postInstallAction
64-
templateUI: undefined, // ui
65-
appType: "--no-frontend", // appType
66-
llamaCloudProjectName: undefined, // llamaCloudProjectName
67-
llamaCloudIndexName: undefined, // llamaCloudIndexName
68-
tools: tool,
69-
});
70-
const name = result.projectName;
71-
72-
// Check if the app folder exists
73-
const dirExists = fs.existsSync(path.join(cwd, name));
74-
expect(dirExists).toBeTruthy();
75-
76-
// Check if pyproject.toml exists
77-
const pyprojectPath = path.join(cwd, name, "pyproject.toml");
78-
const pyprojectExists = fs.existsSync(pyprojectPath);
79-
expect(pyprojectExists).toBeTruthy();
80-
81-
// Run poetry lock
82-
try {
83-
const { stdout, stderr } = await execAsync(
84-
"poetry config virtualenvs.in-project true && poetry lock --no-update",
85-
{
86-
cwd: path.join(cwd, name),
87+
const { pyprojectPath, projectPath } =
88+
await createAndCheckLlamaProject({
89+
options: {
90+
cwd,
91+
templateType: "streaming",
92+
templateFramework,
93+
dataSource,
94+
vectorDb,
95+
tools: tool,
96+
port: 3000, // port, not used
97+
externalPort: 8000, // externalPort, not used
98+
postInstallAction: "none", // postInstallAction
99+
templateUI: undefined, // ui
100+
appType: "--no-frontend", // appType
101+
llamaCloudProjectName: undefined, // llamaCloudProjectName
102+
llamaCloudIndexName: undefined, // llamaCloudIndexName
103+
observability: undefined, // observability
87104
},
88-
);
89-
console.log("poetry lock stdout:", stdout);
90-
console.error("poetry lock stderr:", stderr);
91-
} catch (error) {
92-
console.error("Error running poetry lock:", error);
93-
throw error;
94-
}
105+
});
95106

96-
// Check if poetry.lock file was created
97-
const poetryLockExists = fs.existsSync(
98-
path.join(cwd, name, "poetry.lock"),
99-
);
100-
expect(poetryLockExists).toBeTruthy();
107+
// Additional checks for specific dependencies
101108

102109
// Verify that specific dependencies are in pyproject.toml
103110
const pyprojectContent = fs.readFileSync(pyprojectPath, "utf-8");
@@ -136,3 +143,38 @@ if (
136143
}
137144
});
138145
}
146+
147+
async function createAndCheckLlamaProject({
148+
options,
149+
}: {
150+
options: RunCreateLlamaOptions;
151+
}): Promise<{ pyprojectPath: string; projectPath: string }> {
152+
const result = await runCreateLlama(options);
153+
const name = result.projectName;
154+
const projectPath = path.join(options.cwd, name);
155+
156+
// Check if the app folder exists
157+
expect(fs.existsSync(projectPath)).toBeTruthy();
158+
159+
// Check if pyproject.toml exists
160+
const pyprojectPath = path.join(projectPath, "pyproject.toml");
161+
expect(fs.existsSync(pyprojectPath)).toBeTruthy();
162+
163+
// Run poetry lock
164+
try {
165+
const { stdout, stderr } = await execAsync(
166+
"poetry config virtualenvs.in-project true && poetry lock --no-update",
167+
{ cwd: projectPath },
168+
);
169+
console.log("poetry lock stdout:", stdout);
170+
console.error("poetry lock stderr:", stderr);
171+
} catch (error) {
172+
console.error("Error running poetry lock:", error);
173+
throw error;
174+
}
175+
176+
// Check if poetry.lock file was created
177+
expect(fs.existsSync(path.join(projectPath, "poetry.lock"))).toBeTruthy();
178+
179+
return { pyprojectPath, projectPath };
180+
}

e2e/utils.ts

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export type RunCreateLlamaOptions = {
3333
llamaCloudIndexName?: string;
3434
tools?: string;
3535
useLlamaParse?: boolean;
36+
observability?: string;
3637
};
3738

3839
export async function runCreateLlama({
@@ -50,6 +51,7 @@ export async function runCreateLlama({
5051
llamaCloudIndexName,
5152
tools,
5253
useLlamaParse,
54+
observability,
5355
}: RunCreateLlamaOptions): Promise<CreateLlamaResult> {
5456
if (!process.env.OPENAI_API_KEY || !process.env.LLAMA_CLOUD_API_KEY) {
5557
throw new Error(
@@ -114,6 +116,9 @@ export async function runCreateLlama({
114116
} else {
115117
commandArgs.push("--no-llama-parse");
116118
}
119+
if (observability) {
120+
commandArgs.push("--observability", observability);
121+
}
117122

118123
const command = commandArgs.join(" ");
119124
console.log(`running command '${command}' in ${cwd}`);

helpers/python.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ export const installPythonTemplate = async ({
463463
if (observability === "llamatrace") {
464464
addOnDependencies.push({
465465
name: "llama-index-callbacks-arize-phoenix",
466-
version: "^0.1.6",
466+
version: "^0.2.1",
467467
});
468468
}
469469

0 commit comments

Comments
 (0)