Skip to content

Commit

Permalink
docs: message
Browse files Browse the repository at this point in the history
  • Loading branch information
thucpn committed Aug 2, 2024
1 parent 7b0cfc5 commit f33aa09
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions templates/components/vectordbs/typescript/llamacloud/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import { LlamaCloudIndex } from "llamaindex/cloud/LlamaCloudIndex";

export async function getDataSource(params?: any) {
type LlamaCloudDataSourceParams = {
llamaCloudPipeline?: {
project: string;
pipeline: string;
};
};

export async function getDataSource(params?: LlamaCloudDataSourceParams) {
const { project, pipeline } = params?.llamaCloudPipeline ?? {};
const projectName = project ?? process.env.LLAMA_CLOUD_PROJECT_NAME;
const pipelineName = pipeline ?? process.env.LLAMA_CLOUD_INDEX_NAME;
const apiKey = process.env.LLAMA_CLOUD_API_KEY;
if (!projectName || !pipelineName || !apiKey) {
throw new Error(
"Set project, pipeline, and api key in the config file or as environment variables.",
"Set project, pipeline, and api key in the params or as environment variables.",
);
}
const index = new LlamaCloudIndex({
Expand Down

0 comments on commit f33aa09

Please sign in to comment.