-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add dependencies for pg vector store (#312)
- Loading branch information
1 parent
b31fa80
commit 0213fe0
Showing
23 changed files
with
181 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"create-llama": patch | ||
--- | ||
|
||
Update dependencies for vector stores and add e2e test to ensure that they work as expected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# coderabbit.yml | ||
reviews: | ||
path_instructions: | ||
- path: "templates/**" | ||
instructions: | | ||
For files under the `templates` folder, do not report 'Missing Dependencies Detected' errors. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { expect, test } from "@playwright/test"; | ||
import { exec } from "child_process"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
import util from "util"; | ||
import { TemplateFramework, TemplateVectorDB } from "../helpers/types"; | ||
import { createTestDir, runCreateLlama } from "./utils"; | ||
|
||
const execAsync = util.promisify(exec); | ||
|
||
const templateFramework: TemplateFramework = process.env.FRAMEWORK | ||
? (process.env.FRAMEWORK as TemplateFramework) | ||
: "nextjs"; | ||
const dataSource: string = process.env.DATASOURCE | ||
? process.env.DATASOURCE | ||
: "--example-file"; | ||
|
||
if ( | ||
templateFramework == "nextjs" || | ||
templateFramework == "express" // test is only relevant for TS projects | ||
) { | ||
// vectorDBs combinations to test | ||
const vectorDbs: TemplateVectorDB[] = [ | ||
"mongo", | ||
"pg", | ||
"qdrant", | ||
"pinecone", | ||
"milvus", | ||
"astra", | ||
"chroma", | ||
"llamacloud", | ||
"weaviate", | ||
]; | ||
|
||
test.describe("Test resolve TS dependencies", () => { | ||
for (const vectorDb of vectorDbs) { | ||
const optionDescription = `vectorDb: ${vectorDb}, dataSource: ${dataSource}`; | ||
|
||
test(`options: ${optionDescription}`, async () => { | ||
const cwd = await createTestDir(); | ||
|
||
const result = await runCreateLlama( | ||
cwd, | ||
"streaming", | ||
templateFramework, | ||
dataSource, | ||
vectorDb, | ||
3000, // port | ||
8000, // externalPort | ||
"none", // postInstallAction | ||
undefined, // ui | ||
templateFramework === "nextjs" ? "" : "--no-frontend", // appType | ||
undefined, // llamaCloudProjectName | ||
undefined, // llamaCloudIndexName | ||
); | ||
const name = result.projectName; | ||
|
||
// Check if the app folder exists | ||
const appDir = path.join(cwd, name); | ||
const dirExists = fs.existsSync(appDir); | ||
expect(dirExists).toBeTruthy(); | ||
|
||
// Install dependencies using pnpm | ||
try { | ||
const { stderr: installStderr } = await execAsync( | ||
"pnpm install --prefer-offline", | ||
{ | ||
cwd: appDir, | ||
}, | ||
); | ||
expect(installStderr).toBeFalsy(); | ||
} catch (error) { | ||
console.error("Error installing dependencies:", error); | ||
throw error; | ||
} | ||
|
||
// Run tsc type check and capture the output | ||
try { | ||
const { stdout, stderr } = await execAsync( | ||
"pnpm exec tsc -b --diagnostics", | ||
{ | ||
cwd: appDir, | ||
}, | ||
); | ||
// Check if there's any error output | ||
expect(stderr).toBeFalsy(); | ||
|
||
// Log the stdout for debugging purposes | ||
console.log("TypeScript type-check output:", stdout); | ||
} catch (error) { | ||
console.error("Error running tsc:", error); | ||
throw error; | ||
} | ||
}); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters