diff --git a/.changeset/modern-lemons-applaud.md b/.changeset/modern-lemons-applaud.md new file mode 100644 index 000000000..8be2236e9 --- /dev/null +++ b/.changeset/modern-lemons-applaud.md @@ -0,0 +1,5 @@ +--- +"create-llama": patch +--- + +bump: use LlamaIndexTS 0.6.18 diff --git a/helpers/env-variables.ts b/helpers/env-variables.ts index 5777701cd..0576993c2 100644 --- a/helpers/env-variables.ts +++ b/helpers/env-variables.ts @@ -65,7 +65,7 @@ const getVectorDBEnvs = ( { name: "PG_CONNECTION_STRING", description: - "For generating a connection URI, see https://docs.timescale.com/use-timescale/latest/services/create-a-service\nThe PostgreSQL connection string.", + "For generating a connection URI, see https://supabase.com/vector\nThe PostgreSQL connection string.", }, ]; diff --git a/templates/components/engines/typescript/agent/chat.ts b/templates/components/engines/typescript/agent/chat.ts index 014a0d08f..bf2bb69b1 100644 --- a/templates/components/engines/typescript/agent/chat.ts +++ b/templates/components/engines/typescript/agent/chat.ts @@ -1,6 +1,6 @@ import { + BaseChatEngine, BaseToolWithCall, - ChatEngine, OpenAIAgent, QueryEngineTool, } from "llamaindex"; @@ -45,7 +45,7 @@ export async function createChatEngine(documentIds?: string[], params?: any) { const agent = new OpenAIAgent({ tools, systemPrompt: process.env.SYSTEM_PROMPT, - }) as unknown as ChatEngine; + }) as unknown as BaseChatEngine; return agent; } diff --git a/templates/components/vectordbs/typescript/llamacloud/queryFilter.ts b/templates/components/vectordbs/typescript/llamacloud/queryFilter.ts index 4df8842f5..5f3da346f 100644 --- a/templates/components/vectordbs/typescript/llamacloud/queryFilter.ts +++ b/templates/components/vectordbs/typescript/llamacloud/queryFilter.ts @@ -1,6 +1,6 @@ -import { MetadataFilter, MetadataFilters } from "llamaindex"; +import { CloudRetrieveParams, MetadataFilter } from "llamaindex"; -export function generateFilters(documentIds: string[]): MetadataFilters { +export function generateFilters(documentIds: string[]) { // public documents don't have the "private" field or it's set to "false" const publicDocumentsFilter: MetadataFilter = { key: "private", @@ -8,7 +8,10 @@ export function generateFilters(documentIds: string[]): MetadataFilters { }; // if no documentIds are provided, only retrieve information from public documents - if (!documentIds.length) return { filters: [publicDocumentsFilter] }; + if (!documentIds.length) + return { + filters: [publicDocumentsFilter], + } as CloudRetrieveParams["filters"]; const privateDocumentsFilter: MetadataFilter = { key: "file_id", // Note: LLamaCloud uses "file_id" to reference private document ids as "doc_id" is a restricted field in LlamaCloud @@ -20,5 +23,5 @@ export function generateFilters(documentIds: string[]): MetadataFilters { return { filters: [publicDocumentsFilter, privateDocumentsFilter], condition: "or", - }; + } as CloudRetrieveParams["filters"]; } diff --git a/templates/components/vectordbs/typescript/pg/generate.ts b/templates/components/vectordbs/typescript/pg/generate.ts index 2af9630e2..7f7bbabbf 100644 --- a/templates/components/vectordbs/typescript/pg/generate.ts +++ b/templates/components/vectordbs/typescript/pg/generate.ts @@ -18,7 +18,9 @@ async function loadAndIndex() { // create postgres vector store const vectorStore = new PGVectorStore({ - connectionString: process.env.PG_CONNECTION_STRING, + clientConfig: { + connectionString: process.env.PG_CONNECTION_STRING, + }, schemaName: PGVECTOR_SCHEMA, tableName: PGVECTOR_TABLE, }); diff --git a/templates/components/vectordbs/typescript/pg/index.ts b/templates/components/vectordbs/typescript/pg/index.ts index 0ca1dc46c..632878f6c 100644 --- a/templates/components/vectordbs/typescript/pg/index.ts +++ b/templates/components/vectordbs/typescript/pg/index.ts @@ -9,7 +9,9 @@ import { export async function getDataSource(params?: any) { checkRequiredEnvVars(); const pgvs = new PGVectorStore({ - connectionString: process.env.PG_CONNECTION_STRING, + clientConfig: { + connectionString: process.env.PG_CONNECTION_STRING, + }, schemaName: PGVECTOR_SCHEMA, tableName: PGVECTOR_TABLE, }); diff --git a/templates/types/streaming/express/package.json b/templates/types/streaming/express/package.json index a5eca116f..543bfc2e7 100644 --- a/templates/types/streaming/express/package.json +++ b/templates/types/streaming/express/package.json @@ -21,7 +21,7 @@ "dotenv": "^16.3.1", "duck-duck-scrape": "^2.2.5", "express": "^4.18.2", - "llamaindex": "0.6.2", + "llamaindex": "0.6.18", "pdf2json": "3.0.5", "ajv": "^8.12.0", "@e2b/code-interpreter": "0.0.9-beta.3", diff --git a/templates/types/streaming/nextjs/package.json b/templates/types/streaming/nextjs/package.json index c79a3c651..472f16367 100644 --- a/templates/types/streaming/nextjs/package.json +++ b/templates/types/streaming/nextjs/package.json @@ -27,7 +27,7 @@ "duck-duck-scrape": "^2.2.5", "formdata-node": "^6.0.3", "got": "^14.4.1", - "llamaindex": "0.6.2", + "llamaindex": "0.6.18", "lucide-react": "^0.294.0", "next": "^14.2.4", "react": "^18.2.0",