Skip to content

Commit

Permalink
chore: remove re-exporting packages in llamaindex (#1624)
Browse files Browse the repository at this point in the history
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
  • Loading branch information
thucpn and marcusschiesser authored Feb 12, 2025
1 parent 1564831 commit 6a4a737
Show file tree
Hide file tree
Showing 83 changed files with 4,600 additions and 6,957 deletions.
16 changes: 16 additions & 0 deletions .changeset/large-mugs-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@llamaindex/milvus": minor
"@llamaindex/qdrant": minor
"@llamaindex/next-node-runtime-test": minor
"@llamaindex/azure": minor
"@llamaindex/cloudflare-hono": minor
"@llamaindex/anthropic": minor
"@llamaindex/llamaindex-test": minor
"llamaindex": minor
"@llamaindex/core": minor
"@llamaindex/doc": minor
"@llamaindex/examples": minor
"@llamaindex/e2e": minor
---

Remove re-exports from llamaindex main package
5 changes: 0 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ jobs:
run: pnpm install
- name: Build
run: pnpm run build
- name: Use Build For Examples
run: |
pnpm link ../packages/llamaindex/
cd readers && pnpm link ../../packages/llamaindex/
working-directory: ./examples
- name: Run Type Check
run: pnpm run type-check
- name: Run Circular Dependency Check
Expand Down
4 changes: 1 addition & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
pnpm format
pnpm lint
npx lint-staged
pnpm run lint-staged
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.prettierPath": "./node_modules/prettier"
"prettier.prettierPath": "./node_modules/prettier",
"prettier.configPath": "prettier.config.mjs"
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ In this example, the Context-Aware Agent uses the retriever to fetch relevant co
## Available Context-Aware Agents

- `OpenAIContextAwareAgent`: A context-aware agent using OpenAI's models.
- `AnthropicContextAwareAgent`: A context-aware agent using Anthropic's models.
12 changes: 5 additions & 7 deletions e2e/examples/cloudflare-hono/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,20 @@ app.post("/llm", async (c) => {

const { message } = await c.req.json();

const { extractText } = await import("@llamaindex/core/utils");

const {
extractText,
QueryEngineTool,
serviceContextFromDefaults,
VectorStoreIndex,
OpenAIAgent,
Settings,
OpenAI,
OpenAIEmbedding,
} = await import("llamaindex");

const { PineconeVectorStore } = await import(
"llamaindex/vector-store/PineconeVectorStore"
const { OpenAIAgent, OpenAI, OpenAIEmbedding } = await import(
"@llamaindex/openai"
);

const { PineconeVectorStore } = await import("@llamaindex/pinecone");

const llm = new OpenAI({
model: "gpt-4o-mini",
apiKey: c.env.OPENAI_API_KEY,
Expand Down
1 change: 1 addition & 0 deletions e2e/examples/nextjs-node-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"dependencies": {
"llamaindex": "workspace:*",
"@llamaindex/huggingface": "workspace:*",
"next": "15.0.3",
"react": "18.3.1",
"react-dom": "18.3.1"
Expand Down
2 changes: 1 addition & 1 deletion e2e/examples/nextjs-node-runtime/src/actions/openai.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use server";
import { HuggingFaceEmbedding } from "@llamaindex/huggingface";
import {
OpenAI,
OpenAIAgent,
Expand All @@ -7,7 +8,6 @@ import {
SimpleDirectoryReader,
VectorStoreIndex,
} from "llamaindex";
import { HuggingFaceEmbedding } from "llamaindex/embeddings/HuggingFaceEmbedding";

Settings.llm = new OpenAI({
apiKey: process.env.NEXT_PUBLIC_OPENAI_KEY ?? "FAKE_KEY_TO_PASS_TESTS",
Expand Down
4 changes: 2 additions & 2 deletions e2e/node/claude.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Anthropic, AnthropicAgent } from "@llamaindex/anthropic";
import { extractText } from "@llamaindex/core/utils";
import { consola } from "consola";
import { Anthropic, FunctionTool, Settings, type LLM } from "llamaindex";
import { AnthropicAgent } from "llamaindex/agent/anthropic";
import { FunctionTool, Settings, type LLM } from "llamaindex";
import { ok } from "node:assert";
import { beforeEach, test } from "node:test";
import { getWeatherTool, sumNumbersTool } from "./fixtures/tools.js";
Expand Down
3 changes: 2 additions & 1 deletion e2e/node/embedding/clip.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ClipEmbedding } from "@llamaindex/clip";
import type { LoadTransformerEvent } from "@llamaindex/env/multi-model";
import { setTransformers } from "@llamaindex/env/multi-model";
import { ClipEmbedding, ImageNode, Settings } from "llamaindex";
import { ImageNode, Settings } from "llamaindex";
import assert from "node:assert";
import { type Mock, test } from "node:test";

Expand Down
2 changes: 1 addition & 1 deletion e2e/node/vector-store/pg-vector-store.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PGVectorStore } from "@llamaindex/postgres";
import { config } from "dotenv";
import { Document, VectorStoreQueryMode } from "llamaindex";
import { PGVectorStore } from "llamaindex/vector-store/PGVectorStore";
import assert from "node:assert";
import { test } from "node:test";
import pg from "pg";
Expand Down
8 changes: 3 additions & 5 deletions e2e/node/vector-store/pinecone.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Document, MetadataMode } from "@llamaindex/core/schema";
import { OpenAIEmbedding } from "@llamaindex/openai";
import { PineconeVectorStore } from "@llamaindex/pinecone";
import { config } from "dotenv";
import {
OpenAIEmbedding,
PineconeVectorStore,
VectorStoreIndex,
} from "llamaindex";
import { VectorStoreIndex } from "llamaindex";
import assert from "node:assert";
import { test } from "node:test";

Expand Down
4 changes: 4 additions & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"@llamaindex/env": "workspace:*",
"@llamaindex/ollama": "workspace:*",
"@llamaindex/openai": "workspace:*",
"@llamaindex/pinecone": "workspace:*",
"@llamaindex/postgres": "workspace:*",
"@llamaindex/clip": "workspace:*",
"@llamaindex/anthropic": "workspace:*",
"@types/node": "^22.9.0",
"@types/pg": "^8.11.8",
"@huggingface/transformers": "^3.0.2",
Expand Down
19 changes: 9 additions & 10 deletions examples/multimodal/storage.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { storageContextFromDefaults } from "llamaindex";
import { ClipEmbedding } from "@llamaindex/clip";
import { path } from "@llamaindex/env";
import { SimpleVectorStore, storageContextFromDefaults } from "llamaindex";

// set up store context with two vector stores, one for text, the other for images
export async function getStorageContext() {
return await storageContextFromDefaults({
persistDir: "storage",
storeImages: true,
// if storeImages is true, the following vector store will be added
// vectorStores: {
// IMAGE: SimpleVectorStore.fromPersistDir(
// `${persistDir}/images`,
// fs,
// new ClipEmbedding(),
// ),
// },
vectorStores: {
IMAGE: await SimpleVectorStore.fromPersistDir(
path.join("storage", "images"),
new ClipEmbedding(),
),
},
});
}
3 changes: 1 addition & 2 deletions examples/ollama.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { OllamaEmbedding } from "@llamaindex/ollama";
import { Ollama } from "llamaindex/llm/ollama";
import { Ollama, OllamaEmbedding } from "@llamaindex/ollama";

(async () => {
const llm = new Ollama({
Expand Down
75 changes: 38 additions & 37 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,64 @@
{
"name": "@llamaindex/examples",
"private": true,
"version": "0.1.3",
"private": true,
"scripts": {
"lint": "eslint .",
"start": "tsx ./starter.ts"
},
"dependencies": {
"@ai-sdk/openai": "^1.0.5",
"@azure/cosmos": "^4.1.1",
"@azure/identity": "^4.4.1",
"@azure/search-documents": "^12.1.0",
"@llamaindex/vercel": "^0.0.10",
"@llamaindex/workflow": "^0.0.10",
"@llamaindex/anthropic": "workspace:* || ^0.0.33",
"@llamaindex/astra": "workspace:* || ^0.0.4",
"@llamaindex/azure": "workspace:* || ^0.0.4",
"@llamaindex/chroma": "workspace:* || ^0.0.4",
"@llamaindex/clip": "workspace:* || ^0.0.35",
"@llamaindex/cloud": "workspace:* || ^2.0.24",
"@llamaindex/cohere": "workspace:* || ^0.0.4",
"@llamaindex/deepinfra": "workspace:* || ^0.0.35",
"@llamaindex/env": "workspace:* || ^0.1.27",
"@llamaindex/google": "workspace:* || ^0.0.6",
"@llamaindex/groq": "workspace:* || ^0.0.50",
"@llamaindex/huggingface": "workspace:* || ^0.0.35",
"@llamaindex/milvus": "workspace:* || ^0.0.4",
"@llamaindex/mistral": "workspace:* || ^0.0.4",
"@llamaindex/mixedbread": "workspace:* || ^0.0.4",
"@llamaindex/mongodb": "workspace:* || ^0.0.4",
"@llamaindex/node-parser": "workspace:* || ^0.0.24",
"@llamaindex/ollama": "workspace:* || ^0.0.39",
"@llamaindex/openai": "workspace:* || ^0.1.51",
"@llamaindex/pinecone": "workspace:* || ^0.0.4",
"@llamaindex/portkey-ai": "workspace:* || ^0.0.32",
"@llamaindex/postgres": "workspace:* || ^0.0.32",
"@llamaindex/qdrant": "workspace:* || ^0.0.4",
"@llamaindex/readers": "workspace:* || ^1.0.25",
"@llamaindex/replicate": "workspace:* || ^0.0.32",
"@llamaindex/upstash": "workspace:* || ^0.0.4",
"@llamaindex/vercel": "workspace:* || ^0.0.10",
"@llamaindex/vllm": "workspace:* || ^0.0.21",
"@llamaindex/weaviate": "workspace:* || ^0.0.4",
"@llamaindex/workflow": "workspace:* || ^0.0.10",
"@notionhq/client": "^2.2.15",
"@pinecone-database/pinecone": "^4.0.0",
"@vercel/postgres": "^0.10.0",
"ai": "^4.0.0",
"ajv": "^8.17.1",
"commander": "^12.1.0",
"dotenv": "^16.4.5",
"js-tiktoken": "^1.0.14",
"llamaindex": "^0.8.37",
"llamaindex": "workspace:* || ^0.8.37",
"mongodb": "6.7.0",
"postgres": "^3.4.4",
"ajv": "^8.17.1",
"wikipedia": "^2.1.2",
"@llamaindex/openai": "workspace:*",
"@llamaindex/cloud": "workspace:*",
"@llamaindex/anthropic": "workspace:*",
"@llamaindex/clip": "workspace:*",
"@llamaindex/azure": "workspace:*",
"@llamaindex/deepinfra": "workspace:*",
"@llamaindex/groq": "workspace:*",
"@llamaindex/huggingface": "workspace:*",
"@llamaindex/node-parser": "workspace:*",
"@llamaindex/ollama": "workspace:*",
"@llamaindex/portkey-ai": "workspace:*",
"@llamaindex/readers": "workspace:*",
"@llamaindex/replicate": "workspace:*",
"@llamaindex/vllm": "workspace:*",
"@llamaindex/postgres": "workspace:*",
"@llamaindex/astra": "workspace:*",
"@llamaindex/milvus": "workspace:*",
"@llamaindex/chroma": "workspace:*",
"@llamaindex/mongodb": "workspace:*",
"@llamaindex/pinecone": "workspace:*",
"@llamaindex/qdrant": "workspace:*",
"@llamaindex/upstash": "workspace:*",
"@llamaindex/weaviate": "workspace:*",
"@llamaindex/google": "workspace:*",
"@llamaindex/mistral": "workspace:*",
"@llamaindex/mixedbread": "workspace:*",
"@llamaindex/cohere": "workspace:*"
"wikipedia": "^2.1.2"
},
"devDependencies": {
"@types/node": "^22.9.0",
"tsx": "^4.19.0",
"typescript": "^5.7.2"
},
"scripts": {
"lint": "eslint .",
"start": "tsx ./starter.ts"
},
"stackblitz": {
"startCommand": "npm start"
}
Expand Down
6 changes: 3 additions & 3 deletions examples/readers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"start:obsidian": "node --import tsx ./src/obsidian.ts"
},
"dependencies": {
"@llamaindex/readers": "*",
"llamaindex": "*",
"@llamaindex/cloud": "*"
"@llamaindex/cloud": "workspace:* || ^2.0.24",
"@llamaindex/readers": "workspace:* || ^1.0.25",
"llamaindex": "workspace:* || ^0.8.37"
},
"devDependencies": {
"@types/node": "^22.9.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/vector-store/pg/neon.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PGVectorStore } from "@llamaindex/postgres";
import dotenv from "dotenv";
import { Document, VectorStoreQueryMode } from "llamaindex";
import { PGVectorStore } from "llamaindex/vector-store/PGVectorStore";
import postgres from "postgres";

dotenv.config();
Expand Down
2 changes: 1 addition & 1 deletion examples/vector-store/pg/query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PGVectorStore } from "@llamaindex/postgres";
import { VectorStoreIndex } from "llamaindex";
import { PGVectorStore } from "llamaindex/vector-store/PGVectorStore";

async function main() {
// eslint-disable-next-line @typescript-eslint/no-require-imports
Expand Down
2 changes: 1 addition & 1 deletion examples/vector-store/pg/vercel.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// https://vercel.com/docs/storage/vercel-postgres/sdk
import { PGVectorStore } from "@llamaindex/postgres";
import { sql } from "@vercel/postgres";
import dotenv from "dotenv";
import { Document, VectorStoreQueryMode } from "llamaindex";
import { PGVectorStore } from "llamaindex/vector-store/PGVectorStore";

dotenv.config();

Expand Down
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "@llamaindex/monorepo",
"private": true,
"scripts": {
"build": "turbo run build --filter=\"./packages/*\" --filter=\"./packages/providers/*\"",
"dev": "turbo run dev --filter=\"./packages/*\" --filter=\"./packages/providers/*\"",
"clean": "find . -type d \\( -name .turbo -o -name node_modules -o -name dist -o -name .next -o -name lib \\) -exec rm -rf {} +",
"build": "turbo run build --filter=\"./packages/*\" --filter=\"./packages/providers/**\"",
"dev": "turbo run dev --filter=\"./packages/*\" --filter=\"./packages/providers/**\"",
"format": "prettier --ignore-unknown --cache --check .",
"format:write": "prettier --ignore-unknown --write .",
"lint": "turbo run lint",
Expand All @@ -15,7 +16,8 @@
"release": "pnpm run build && changeset publish",
"release-snapshot": "pnpm run build && changeset publish --tag snapshot",
"new-version": "changeset version && pnpm format:write && pnpm run build",
"new-snapshot": "pnpm run build && changeset version --snapshot"
"new-snapshot": "pnpm run build && changeset version --snapshot",
"lint-staged": "lint-staged"
},
"devDependencies": {
"@changesets/cli": "^2.27.5",
Expand All @@ -36,6 +38,10 @@
},
"packageManager": "pnpm@9.12.3",
"lint-staged": {
"(!apps/docs/i18n/**/docusaurus-plugin-content-docs/current/api/*).{js,jsx,ts,tsx,md}": "prettier --write"
"*.{js,jsx,ts,tsx}": [
"prettier --check",
"eslint"
],
"*.{json,md}": "prettier --check"
}
}
7 changes: 2 additions & 5 deletions packages/autotool/examples/02_nextjs/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,8 @@
}
.background-gradient {
background-color: #fff;
background-image: radial-gradient(
at 21% 11%,
rgba(186, 186, 233, 0.53) 0,
transparent 50%
),
background-image:
radial-gradient(at 21% 11%, rgba(186, 186, 233, 0.53) 0, transparent 50%),
radial-gradient(at 85% 0, hsla(46, 57%, 78%, 0.52) 0, transparent 50%),
radial-gradient(at 91% 36%, rgba(194, 213, 255, 0.68) 0, transparent 50%),
radial-gradient(at 8% 40%, rgba(251, 218, 239, 0.46) 0, transparent 50%);
Expand Down
5 changes: 5 additions & 0 deletions packages/autotool/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"name": "@llamaindex/autotool",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/run-llama/LlamaIndexTS.git",
"directory": "packages/autotool"
},
"version": "5.0.37",
"description": "auto transpile your JS function to LLM Agent compatible",
"files": [
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/global/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const DEFAULT_DOC_STORE_PERSIST_FILENAME = "doc_store.json";
export const DEFAULT_VECTOR_STORE_PERSIST_FILENAME = "vector_store.json";
export const DEFAULT_GRAPH_STORE_PERSIST_FILENAME = "graph_store.json";
export const DEFAULT_NAMESPACE = "docstore";
export const DEFAULT_IMAGE_VECTOR_NAMESPACE = "images";
//#endregion
//#region llama cloud
export const DEFAULT_PROJECT_NAME = "Default";
Expand Down
Loading

0 comments on commit 6a4a737

Please sign in to comment.