Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run in Deno Deploy and Supabase Edge Functions #1572

Open
2 of 14 tasks
savy-91 opened this issue Dec 18, 2024 · 2 comments
Open
2 of 14 tasks

Unable to run in Deno Deploy and Supabase Edge Functions #1572

savy-91 opened this issue Dec 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@savy-91
Copy link

savy-91 commented Dec 18, 2024

Describe the bug
I am trying to run a simple RAG endpoint in Deno Deploy/Supabase Edge Functions and this import makes the bundled function too heavy:
Deploying Function: analyze (script size: 167.8MB)

I tried to import each part individually:

import {
    OpenAI,
    OpenAIAgent,
} from "llamaindex/llm/openai";

import {
    QueryEngineTool,
} from "llamaindex/tools/QueryEngineTool";

import {
    PDFReader,
} from "llamaindex/readers/index";

import {
    FunctionTool,
} from "llamaindex/tools/index";

import {
    VectorStoreIndex,
} from "llamaindex/indices/vectorStore/index";

import {
    Settings,
} from "llamaindex/Settings";

with no significant change.

To Reproduce

import {
    VectorStoreIndex,
    PDFReader,
    Settings,
    OpenAI,
    FunctionTool,
    OpenAIAgent,
    QueryEngineTool,
    Document,
    Metadata
} from "npm:llamaindex@^0.8.30";

Expected behavior
The documentation does not mention any specific procedure to run this in an edge environment like this so I would expect this to run.

Desktop (please complete the following information):

  • OS: [e.g. macOS, Linux]
  • JS Runtime / Framework / Bundler (select all applicable)
  • Node.js
  • Deno
  • Bun
  • Next.js
  • ESBuild
  • Rollup
  • Webpack
  • Turbopack
  • Vite
  • Waku
  • Edge Runtime
  • AWS Lambda
  • Cloudflare Worker
  • Others (please elaborate on this)
  • Version [e.g. 0.8.30]
@savy-91 savy-91 added the bug Something isn't working label Dec 18, 2024
@savy-91
Copy link
Author

savy-91 commented Dec 18, 2024

Update:

import {
    OpenAI,
    OpenAIAgent,
} from "@llamaindex/openai";
import {Settings} from "@llamaindex/core/global";
import {FunctionTool} from "@llamaindex/core/tools";
import {PDFReader} from "@llamaindex/readers/pdf";

I was able to locate these from different submodules.

However I can't find any correspondence for these:

import { VectorStoreIndex } from "llamaindex";
import { QueryEngineTool } from "llamaindex";

@savy-91
Copy link
Author

savy-91 commented Dec 19, 2024

Update 2:

Apparently the main culprit of the size of the bundle is @llamaindex/clip.

As a hacky solution i was able to copy over from this repo all of the missing implementations related to VectorStoreIndex and QueryEngineTool, removing all dependencies on clip, and importing them from a local path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant