From 60ed8fe080ae4594b17bb78ff5f6184dbbabd68a Mon Sep 17 00:00:00 2001
From: "Huu Le (Lee)" <39040748+leehuwuj@users.noreply.github.com>
Date: Fri, 22 Mar 2024 08:43:23 +0700
Subject: [PATCH] fixed llama-index package versions and add missing env for
 web data source  (#14)

---
 .changeset/khaki-jeans-end.md                    | 5 +++++
 .changeset/popular-berries-stare.md              | 5 +++++
 helpers/env-variables.ts                         | 5 +++++
 templates/types/simple/fastapi/pyproject.toml    | 4 +++-
 templates/types/streaming/fastapi/pyproject.toml | 4 +++-
 5 files changed, 21 insertions(+), 2 deletions(-)
 create mode 100644 .changeset/khaki-jeans-end.md
 create mode 100644 .changeset/popular-berries-stare.md

diff --git a/.changeset/khaki-jeans-end.md b/.changeset/khaki-jeans-end.md
new file mode 100644
index 00000000..8cd9e095
--- /dev/null
+++ b/.changeset/khaki-jeans-end.md
@@ -0,0 +1,5 @@
+---
+"create-llama": patch
+---
+
+Add missing environment variable config for web data source
diff --git a/.changeset/popular-berries-stare.md b/.changeset/popular-berries-stare.md
new file mode 100644
index 00000000..8e8a3834
--- /dev/null
+++ b/.changeset/popular-berries-stare.md
@@ -0,0 +1,5 @@
+---
+"create-llama": patch
+---
+
+Fixed llama-index package versions
diff --git a/helpers/env-variables.ts b/helpers/env-variables.ts
index 2b084f3a..b65b0df2 100644
--- a/helpers/env-variables.ts
+++ b/helpers/env-variables.ts
@@ -5,6 +5,7 @@ import {
   TemplateDataSource,
   TemplateFramework,
   TemplateVectorDB,
+  WebSourceConfig,
 } from "./types";
 
 type EnvVar = {
@@ -105,18 +106,22 @@ const getDataSourceEnvs = (
 ) => {
   switch (dataSource.type) {
     case "web":
+      const config = dataSource.config as WebSourceConfig;
       return [
         {
           name: "BASE_URL",
           description: "The base URL to start web scraping.",
+          value: config.baseUrl,
         },
         {
           name: "URL_PREFIX",
           description: "The prefix of the URL to start web scraping.",
+          value: config.baseUrl,
         },
         {
           name: "MAX_DEPTH",
           description: "The maximum depth to scrape.",
+          value: config.depth?.toString(),
         },
       ];
     case "file":
diff --git a/templates/types/simple/fastapi/pyproject.toml b/templates/types/simple/fastapi/pyproject.toml
index 45c3ae56..5dae9d81 100644
--- a/templates/types/simple/fastapi/pyproject.toml
+++ b/templates/types/simple/fastapi/pyproject.toml
@@ -10,7 +10,9 @@ python = "^3.11,<3.12"
 fastapi = "^0.109.1"
 uvicorn = { extras = ["standard"], version = "^0.23.2" }
 python-dotenv = "^1.0.0"
-llama-index = "^0.10.7"
+llama-index = "0.10.15"
+llama-index-core = "0.10.15"
+llama-index-agent-openai = "0.1.5"
 
 [build-system]
 requires = ["poetry-core"]
diff --git a/templates/types/streaming/fastapi/pyproject.toml b/templates/types/streaming/fastapi/pyproject.toml
index 45c3ae56..5dae9d81 100644
--- a/templates/types/streaming/fastapi/pyproject.toml
+++ b/templates/types/streaming/fastapi/pyproject.toml
@@ -10,7 +10,9 @@ python = "^3.11,<3.12"
 fastapi = "^0.109.1"
 uvicorn = { extras = ["standard"], version = "^0.23.2" }
 python-dotenv = "^1.0.0"
-llama-index = "^0.10.7"
+llama-index = "0.10.15"
+llama-index-core = "0.10.15"
+llama-index-agent-openai = "0.1.5"
 
 [build-system]
 requires = ["poetry-core"]
-- 
GitLab