chore: remove re-exporting packages in llamaindex (#1624)

Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
This commit is contained in:
Thuc Pham
2025-02-12 12:44:52 +07:00
committed by GitHub
parent 1564831158
commit 6a4a73760b
83 changed files with 4632 additions and 6989 deletions
+16
View File
@@ -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
View File
@@ -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
+1 -3
View File
@@ -1,3 +1 @@
pnpm format
pnpm lint
npx lint-staged
pnpm run lint-staged
+2 -1
View File
@@ -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"
}
@@ -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.
+5 -7
View File
@@ -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,
@@ -9,6 +9,7 @@
},
"dependencies": {
"llamaindex": "workspace:*",
"@llamaindex/huggingface": "workspace:*",
"next": "15.0.3",
"react": "18.3.1",
"react-dom": "18.3.1"
@@ -1,4 +1,5 @@
"use server";
import { HuggingFaceEmbedding } from "@llamaindex/huggingface";
import {
OpenAI,
OpenAIAgent,
@@ -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",
+2 -2
View File
@@ -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";
+2 -1
View File
@@ -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";
+1 -1
View File
@@ -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";
+3 -5
View File
@@ -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";
+4
View File
@@ -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",
+9 -10
View File
@@ -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(),
),
},
});
}
+1 -2
View File
@@ -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({
+38 -37
View File
@@ -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"
}
+3 -3
View File
@@ -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",
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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();
+10 -4
View File
@@ -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",
@@ -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",
@@ -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"
}
}
@@ -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%);
+5
View File
@@ -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": [
-1
View File
@@ -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";
-23
View File
@@ -20,35 +20,12 @@
"llamaindex"
],
"dependencies": {
"@llamaindex/anthropic": "workspace:*",
"@llamaindex/clip": "workspace:*",
"@llamaindex/cloud": "workspace:*",
"@llamaindex/core": "workspace:*",
"@llamaindex/deepinfra": "workspace:*",
"@llamaindex/env": "workspace:*",
"@llamaindex/groq": "workspace:*",
"@llamaindex/huggingface": "workspace:*",
"@llamaindex/node-parser": "workspace:*",
"@llamaindex/ollama": "workspace:*",
"@llamaindex/openai": "workspace:*",
"@llamaindex/portkey-ai": "workspace:*",
"@llamaindex/readers": "workspace:*",
"@llamaindex/replicate": "workspace:*",
"@llamaindex/vllm": "workspace:*",
"@llamaindex/postgres": "workspace:*",
"@llamaindex/azure": "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:*",
"@types/lodash": "^4.17.7",
"@types/node": "^22.9.0",
"ajv": "^8.17.1",
@@ -1,7 +0,0 @@
import { AnthropicAgent } from "@llamaindex/anthropic";
import { withContextAwareness } from "./contextAwareMixin.js";
export const AnthropicContextAwareAgent = withContextAwareness(AnthropicAgent);
export type { ContextAwareConfig } from "./contextAwareMixin.js";
export * from "@llamaindex/anthropic";
@@ -1,7 +1,3 @@
import {
AnthropicAgent,
type AnthropicAgentParams,
} from "@llamaindex/anthropic";
import type {
NonStreamingChatEngineParams,
StreamingChatEngineParams,
@@ -20,29 +16,21 @@ export interface ContextAwareState {
retrievedContext: string | null;
}
export type SupportedAgent = typeof OpenAIAgent | typeof AnthropicAgent;
export type AgentParams<T> = T extends typeof OpenAIAgent
? OpenAIAgentParams
: T extends typeof AnthropicAgent
? AnthropicAgentParams
: never;
// TODO: support any LLMAgent
export type SupportedAgent = typeof OpenAIAgent;
export type AgentParams = OpenAIAgentParams;
/**
* ContextAwareAgentRunner enhances the base AgentRunner with the ability to retrieve and inject relevant context
* for each query. This allows the agent to access and utilize appropriate information from a given index or retriever,
* providing more informed and context-specific responses to user queries.
*/
export function withContextAwareness<T extends SupportedAgent>(Base: T) {
export function withContextAwareness(Base: SupportedAgent) {
return class ContextAwareAgent extends Base {
public readonly contextRetriever: BaseRetriever;
public retrievedContext: string | null = null;
declare public chatHistory: T extends typeof OpenAIAgent
? OpenAIAgent["chatHistory"]
: T extends typeof AnthropicAgent
? AnthropicAgent["chatHistory"]
: never;
constructor(params: AgentParams<T> & ContextAwareConfig) {
constructor(params: AgentParams & ContextAwareConfig) {
super(params);
this.contextRetriever = params.contextRetriever;
}
+2 -17
View File
@@ -1,21 +1,6 @@
export * from "@llamaindex/core/agent";
export {
OllamaAgent,
OllamaAgentWorker,
type OllamaAgentParams,
} from "@llamaindex/ollama";
export {
AnthropicAgent,
AnthropicAgentWorker,
AnthropicContextAwareAgent,
type AnthropicAgentParams,
} from "./anthropic.js";
export {
OpenAIAgent,
OpenAIAgentWorker,
OpenAIContextAwareAgent,
type OpenAIAgentParams,
} from "./openai.js";
export { OpenAIContextAwareAgent } from "./openai.js";
export {
ReACTAgentWorker,
ReActAgent,
@@ -1 +0,0 @@
export * from "@llamaindex/clip";
@@ -1 +0,0 @@
export * from "@llamaindex/deepinfra";
@@ -1 +0,0 @@
export { GEMINI_EMBEDDING_MODEL, GeminiEmbedding } from "@llamaindex/google";
@@ -1 +0,0 @@
export * from "@llamaindex/huggingface";
@@ -1,4 +0,0 @@
export {
MistralAIEmbedding,
MistralAIEmbeddingModelType,
} from "@llamaindex/mistral";
@@ -1,4 +0,0 @@
export {
MixedbreadAIEmbeddings,
type MixedbreadAIEmbeddingsParams,
} from "@llamaindex/mixedbread";
@@ -1 +0,0 @@
export { OllamaEmbedding } from "@llamaindex/ollama";
@@ -1,12 +1,5 @@
export * from "@llamaindex/core/embeddings";
export { ClipEmbedding, ClipEmbeddingModelType } from "./ClipEmbedding.js";
export { DeepInfraEmbedding } from "./DeepInfraEmbedding.js";
export { FireworksEmbedding } from "./fireworks.js";
export { GEMINI_EMBEDDING_MODEL, GeminiEmbedding } from "./GeminiEmbedding.js";
export * from "./HuggingFaceEmbedding.js";
export * from "./JinaAIEmbedding.js";
export * from "./MistralAIEmbedding.js";
export * from "./MixedbreadAIEmbeddings.js";
export { OllamaEmbedding } from "./OllamaEmbedding.js";
export * from "./OpenAIEmbedding.js";
export { TogetherEmbedding } from "./together.js";
-1
View File
@@ -32,7 +32,6 @@ export {
DEFAULT_CONTEXT_WINDOW,
DEFAULT_DOC_STORE_PERSIST_FILENAME,
DEFAULT_GRAPH_STORE_PERSIST_FILENAME,
DEFAULT_IMAGE_VECTOR_NAMESPACE,
DEFAULT_INDEX_STORE_PERSIST_FILENAME,
DEFAULT_NAMESPACE,
DEFAULT_NUM_OUTPUTS,
+1 -13
View File
@@ -1,21 +1,9 @@
export * from "./index.edge.js";
export * from "./readers/index.js";
export * from "./storage/index.js";
// Exports modules that doesn't support non-node.js runtime
export {
HuggingFaceEmbedding,
HuggingFaceEmbeddingModelType,
} from "./embeddings/HuggingFaceEmbedding.js";
export {
GeminiVertexSession,
type VertexGeminiSessionOptions,
} from "@llamaindex/google";
// Expose AzureDynamicSessionTool for node.js runtime only
export { AzureDynamicSessionTool } from "@llamaindex/azure";
export { JinaAIEmbedding } from "./embeddings/JinaAIEmbedding.js";
// Don't export vector store modules for non-node.js runtime on top level,
// Don't export SimpleVectorStore for non-node.js runtime on top level,
// as we cannot guarantee that they will work in other environments
export * from "./vector-store.js";
-1
View File
@@ -1 +0,0 @@
export * from "@llamaindex/anthropic";
-1
View File
@@ -1 +0,0 @@
export * from "@llamaindex/deepinfra";
-1
View File
@@ -1 +0,0 @@
export * from "@llamaindex/google";
-1
View File
@@ -1 +0,0 @@
export * from "@llamaindex/groq";
@@ -1 +0,0 @@
export * from "@llamaindex/huggingface";
+2 -37
View File
@@ -1,39 +1,4 @@
export { VLLM, type VLLMParams } from "@llamaindex/vllm";
export {
ALL_AVAILABLE_ANTHROPIC_LEGACY_MODELS,
ALL_AVAILABLE_ANTHROPIC_MODELS,
ALL_AVAILABLE_V3_MODELS,
Anthropic,
} from "./anthropic.js";
export { FireworksLLM } from "./fireworks.js";
export {
GEMINI_MODEL,
Gemini,
GeminiSession,
type GoogleGeminiSessionOptions,
} from "./google.js";
export * from "./groq.js";
export { HuggingFaceInferenceAPI, HuggingFaceLLM } from "./huggingface.js";
export {
ALL_AVAILABLE_MISTRAL_MODELS,
MistralAI,
MistralAISession,
} from "./mistral.js";
export * from "./openai.js";
export { Portkey } from "./portkey.js";
export * from "./replicate_ai.js";
// Note: The type aliases for replicate are to simplify usage for Llama 2 (we're using replicate for Llama 2 support)
export { DeepInfra } from "./deepinfra.js";
export * from "./ollama.js";
export {
ALL_AVAILABLE_REPLICATE_MODELS,
DeuceChatStrategy,
LlamaDeuce,
ReplicateChatStrategy,
ReplicateLLM,
ReplicateSession,
} from "./replicate_ai.js";
export { DeepSeekLLM } from "./deepseek.js";
export { FireworksLLM } from "./fireworks.js";
export * from "./openai.js";
export { TogetherLLM } from "./together.js";
export * from "./types.js";
-1
View File
@@ -1 +0,0 @@
export * from "@llamaindex/mistral";
-1
View File
@@ -1 +0,0 @@
export { Ollama, type OllamaParams } from "@llamaindex/ollama";
-1
View File
@@ -1 +0,0 @@
export * from "@llamaindex/portkey-ai";
@@ -1 +0,0 @@
export * from "@llamaindex/replicate";
@@ -1,6 +1 @@
export * from "@llamaindex/cohere";
export {
MixedbreadAIReranker,
type MixedbreadAIRerankerParams,
} from "@llamaindex/mixedbread";
export * from "./JinaAIReranker.js";
@@ -1,8 +1,4 @@
import { ClipEmbedding } from "@llamaindex/clip";
import {
DEFAULT_IMAGE_VECTOR_NAMESPACE,
DEFAULT_NAMESPACE,
} from "@llamaindex/core/global";
import { DEFAULT_NAMESPACE } from "@llamaindex/core/global";
import { ModalityType, ObjectType } from "@llamaindex/core/schema";
import type { BaseDocumentStore } from "@llamaindex/core/storage/doc-store";
import {
@@ -13,7 +9,6 @@ import type {
BaseVectorStore,
VectorStoreByType,
} from "@llamaindex/core/vector-store";
import { path } from "@llamaindex/env";
import type { ServiceContext } from "../ServiceContext.js";
import { SimpleVectorStore } from "../vector-store/SimpleVectorStore.js";
import { SimpleDocumentStore } from "./docStore/SimpleDocumentStore.js";
@@ -29,7 +24,6 @@ type BuilderParams = {
indexStore: BaseIndexStore;
vectorStore: BaseVectorStore;
vectorStores: VectorStoreByType;
storeImages: boolean;
persistDir: string;
/**
* @deprecated Please use `Settings` instead
@@ -42,7 +36,6 @@ export async function storageContextFromDefaults({
indexStore,
vectorStore,
vectorStores,
storeImages,
persistDir,
serviceContext,
}: Partial<BuilderParams>): Promise<StorageContext> {
@@ -53,11 +46,6 @@ export async function storageContextFromDefaults({
if (!(ModalityType.TEXT in vectorStores)) {
vectorStores[ModalityType.TEXT] = vectorStore ?? new SimpleVectorStore();
}
if (storeImages && !(ModalityType.IMAGE in vectorStores)) {
vectorStores[ModalityType.IMAGE] = new SimpleVectorStore({
embeddingModel: new ClipEmbedding(),
});
}
} else {
const embedModel = serviceContext?.embedModel;
docStore =
@@ -70,12 +58,6 @@ export async function storageContextFromDefaults({
vectorStore ??
(await SimpleVectorStore.fromPersistDir(persistDir, embedModel));
}
if (storeImages && !(ObjectType.IMAGE in vectorStores)) {
vectorStores[ModalityType.IMAGE] = await SimpleVectorStore.fromPersistDir(
path.join(persistDir, DEFAULT_IMAGE_VECTOR_NAMESPACE),
new ClipEmbedding(),
);
}
}
return {
-7
View File
@@ -1,14 +1,7 @@
export * from "@llamaindex/azure/storage";
export * from "@llamaindex/core/storage/chat-store";
export * from "@llamaindex/core/storage/doc-store";
export * from "@llamaindex/core/storage/index-store";
export * from "@llamaindex/core/storage/kv-store";
export {
PostgresDocumentStore,
PostgresIndexStore,
PostgresKVStore,
} from "@llamaindex/postgres";
export { SimpleDocumentStore } from "./docStore/SimpleDocumentStore.js";
export * from "./FileSystem.js";
export * from "./StorageContext.js";
@@ -1,50 +0,0 @@
import {
AzureDynamicSessionTool,
type AzureDynamicSessionToolParams,
} from "@llamaindex/azure";
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace ToolsFactory {
type ToolsMap = {
[Tools.AzureCodeInterpreter]: typeof AzureDynamicSessionTool;
};
export enum Tools {
AzureCodeInterpreter = "azure_code_interpreter.AzureCodeInterpreterToolSpec",
}
export async function createTool<Tool extends Tools>(
key: Tool,
...params: ConstructorParameters<ToolsMap[Tool]>
): Promise<InstanceType<ToolsMap[Tool]>> {
if (key === Tools.AzureCodeInterpreter) {
return new AzureDynamicSessionTool(
...(params as AzureDynamicSessionToolParams[]),
) as InstanceType<ToolsMap[Tool]>;
}
throw new Error(
`Sorry! Tool ${key} is not supported yet. Options: ${params}`,
);
}
export async function createTools<const Tool extends Tools>(record: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key in Tool]: ConstructorParameters<ToolsMap[Tool]>[1] extends any // backward compatibility for `create-llama` script // if parameters are an array, use them as is
? ConstructorParameters<ToolsMap[Tool]>[0]
: ConstructorParameters<ToolsMap[Tool]>;
}): Promise<InstanceType<ToolsMap[Tool]>[]> {
const tools: InstanceType<ToolsMap[Tool]>[] = [];
for (const key in record) {
const params = record[key];
tools.push(
await createTool(
key,
// @ts-expect-error allow array or single parameter
Array.isArray(params) ? params : [params],
),
);
}
return tools;
}
}
@@ -1 +0,0 @@
export * from "@llamaindex/astra";
@@ -1 +0,0 @@
export * from "@llamaindex/azure";
@@ -1 +0,0 @@
export * from "@llamaindex/chroma";
@@ -1 +0,0 @@
export * from "@llamaindex/milvus";
@@ -1 +0,0 @@
export * from "@llamaindex/mongodb";
@@ -1,7 +0,0 @@
export {
DEFAULT_DIMENSIONS,
PGVECTOR_SCHEMA,
PGVECTOR_TABLE,
PGVectorStore,
type PGVectorStoreConfig,
} from "@llamaindex/postgres";
@@ -1 +0,0 @@
export * from "@llamaindex/pinecone";
@@ -1 +0,0 @@
export * from "@llamaindex/qdrant";
@@ -1 +0,0 @@
export * from "@llamaindex/upstash";
@@ -1 +0,0 @@
export * from "@llamaindex/weaviate";
@@ -1,14 +1,2 @@
export * from "@llamaindex/core/vector-store";
export * from "./SimpleVectorStore.js";
export * from "./AstraDBVectorStore.js";
export * from "./AzureAISearchVectorStore.js";
export * from "./ChromaVectorStore.js";
export * from "./MilvusVectorStore.js";
export * from "./MongoDBAtlasVectorStore.js";
export * from "./PGVectorStore.js";
export * from "./PineconeVectorStore.js";
export * from "./QdrantVectorStore.js";
export * from "./UpstashVectorStore.js";
export * from "./WeaviateVectorStore.js";
-8
View File
@@ -7,15 +7,7 @@
"test": "vitest run"
},
"devDependencies": {
"@azure/cosmos": "^4.1.1",
"@azure/identity": "^4.4.1",
"@azure/search-documents": "^12.1.0",
"@zilliz/milvus2-sdk-node": "^2.4.6",
"@qdrant/js-client-rest": "^1.11.0",
"@faker-js/faker": "^9.2.0",
"dotenv": "^16.4.5",
"llamaindex": "workspace:*",
"msw": "^2.6.5",
"vitest": "^2.1.5"
}
}
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/anthropic",
"description": "Anthropic Adapter for LlamaIndex",
"version": "0.0.33",
"version": "0.0.32",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -31,13 +31,13 @@
"test": "vitest run"
},
"devDependencies": {
"bunchee": "6.2.0"
"bunchee": "6.2.0",
"vitest": "^2.1.5"
},
"dependencies": {
"@anthropic-ai/sdk": "0.32.1",
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"remeda": "^2.17.3",
"vitest": "^2.1.5"
"remeda": "^2.17.3"
}
}
+1 -1
View File
@@ -79,7 +79,7 @@ export class ClipEmbedding extends MultiModalEmbedding {
);
});
if (!this.processor) {
this.processor = await AutoProcessor.from_pretrained(this.modelType);
this.processor = await AutoProcessor.from_pretrained(this.modelType, {});
}
return this.processor;
}
+1 -1
View File
@@ -35,6 +35,6 @@
"dependencies": {
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"openai": "^4.73.1"
"openai": "^4.83.0"
}
}
+15
View File
@@ -78,6 +78,15 @@ export const GPT4_MODELS = {
"gpt-4o-2024-11-20": {
contextWindow: 128000,
},
"gpt-4o-audio-preview-2024-12-17": {
contextWindow: 128000,
},
"gpt-4o-mini-audio-preview": {
contextWindow: 128000,
},
"gpt-4o-mini-audio-preview-2024-12-17": {
contextWindow: 128000,
},
};
// NOTE we don't currently support gpt-3.5-turbo-instruct and don't plan to in the near future
@@ -104,6 +113,12 @@ export const O1_MODELS = {
"o1-mini-2024-09-12": {
contextWindow: 128000,
},
o1: {
contextWindow: 128000,
},
"o1-2024-12-17": {
contextWindow: 128000,
},
};
export const O3_MODELS = {
@@ -1,6 +1,6 @@
import type { BaseNode } from "@llamaindex/core/schema";
import { AzureCosmosDBNoSqlVectorStore } from "llamaindex";
import type { Mocked } from "vitest";
import { AzureCosmosDBNoSqlVectorStore } from "../src/vectorStore/AzureCosmosDBNoSqlVectorStore";
export class TestableAzureCosmosDBNoSqlVectorStore extends AzureCosmosDBNoSqlVectorStore {
public nodes: BaseNode[] = [];
@@ -53,18 +53,22 @@
},
"scripts": {
"build": "bunchee",
"dev": "bunchee --watch"
"dev": "bunchee --watch",
"test": "vitest run"
},
"devDependencies": {
"@llamaindex/openai": "workspace:*",
"@types/node": "^22.9.0",
"bunchee": "6.2.0",
"@types/node": "^22.9.0"
"dotenv": "^16.4.7",
"vitest": "^2.1.5"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"@azure/cosmos": "^4.1.1",
"@azure/identity": "^4.4.1",
"@azure/search-documents": "^12.1.0",
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"mongodb": "^6.7.0"
}
}
@@ -1,9 +1,13 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { SearchClient, SearchIndexClient } from "@azure/search-documents";
import { AzureAISearchVectorStore } from "llamaindex";
import { afterEach, beforeEach } from "node:test";
import { describe, expect, it, vi } from "vitest";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { Settings } from "@llamaindex/core/global";
import { OpenAIEmbedding } from "@llamaindex/openai";
import { AzureAISearchVectorStore } from "../src/vectorStore/AzureAISearchVectorStore";
Settings.embedModel = new OpenAIEmbedding();
// We test only for the initialization of the store, and the search and index clients, will variants of the options provided
const MOCK_ENDPOINT = "https://test-endpoint.com";
@@ -1,10 +1,14 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Settings } from "@llamaindex/core/global";
import type { BaseNode } from "@llamaindex/core/schema";
import { VectorStoreQueryMode } from "@llamaindex/core/vector-store";
import { OpenAIEmbedding } from "@llamaindex/openai";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { VectorStoreQueryMode } from "../../src/vector-store.js";
import { TestableAzureCosmosDBNoSqlVectorStore } from "../mocks/TestableAzureCosmosDBNoSqlVectorStore.js";
import { createMockClient } from "../utility/mockCosmosClient.js"; // Import the mock client
Settings.embedModel = new OpenAIEmbedding();
const createNodes = (n: number) => {
const nodes: BaseNode[] = [];
for (let i = 0; i < n; i += 1) {
@@ -0,0 +1,7 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
exclude: ["**/node_modules/**", "**/*.int.test.ts", "**/dist/**"],
},
});
@@ -1,7 +1,7 @@
import type { BaseNode } from "@llamaindex/core/schema";
import type { MilvusClient } from "@zilliz/milvus2-sdk-node";
import { MilvusVectorStore } from "llamaindex";
import { type Mocked } from "vitest";
import { MilvusVectorStore } from "../src/MilvusVectorStore";
export class TestableMilvusVectorStore extends MilvusVectorStore {
public nodes: BaseNode[] = [];
@@ -35,10 +35,13 @@
},
"scripts": {
"build": "bunchee",
"dev": "bunchee --watch"
"dev": "bunchee --watch",
"test": "vitest run"
},
"devDependencies": {
"bunchee": "6.2.0"
"@llamaindex/openai": "workspace:*",
"bunchee": "6.2.0",
"vitest": "^2.1.5"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
@@ -1,12 +1,16 @@
import { Settings } from "@llamaindex/core/global";
import type { BaseNode } from "@llamaindex/core/schema";
import { TextNode } from "@llamaindex/core/schema";
import {
MilvusVectorStore,
VectorStoreQueryMode,
type MetadataFilters,
} from "llamaindex";
} from "@llamaindex/core/vector-store";
import { OpenAIEmbedding } from "@llamaindex/openai";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { TestableMilvusVectorStore } from "../mocks/TestableMilvusVectorStore.js";
import { TestableMilvusVectorStore } from "../mocks/TestableMilvusVectorStore";
import { MilvusVectorStore } from "../src/MilvusVectorStore";
Settings.embedModel = new OpenAIEmbedding();
type FilterTestCase = {
title: string;
@@ -1,5 +1,5 @@
import type { BaseNode } from "@llamaindex/core/schema";
import { QdrantVectorStore } from "llamaindex";
import { QdrantVectorStore } from "../src/QdrantVectorStore";
export class TestableQdrantVectorStore extends QdrantVectorStore {
public nodes: BaseNode[] = [];
@@ -35,10 +35,13 @@
},
"scripts": {
"build": "bunchee",
"dev": "bunchee --watch"
"dev": "bunchee --watch",
"test": "vitest run"
},
"devDependencies": {
"bunchee": "6.2.0"
"bunchee": "6.2.0",
"vitest": "^2.1.5",
"@llamaindex/openai": "workspace:*"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
@@ -3,10 +3,14 @@ import { TextNode } from "@llamaindex/core/schema";
import type { Mocked } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { VectorStoreQueryMode } from "@llamaindex/core/vector-store";
import { QdrantClient } from "@qdrant/js-client-rest";
import { VectorStoreQueryMode } from "llamaindex/vector-store";
import { TestableQdrantVectorStore } from "../mocks/TestableQdrantVectorStore.js";
import { Settings } from "@llamaindex/core/global";
import { OpenAIEmbedding } from "@llamaindex/openai";
Settings.embedModel = new OpenAIEmbedding();
vi.mock("@qdrant/js-client-rest");
describe("QdrantVectorStore", () => {
+4439 -6611
View File
File diff suppressed because it is too large Load Diff