mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-04 03:40:26 -04:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a9ae69390 | |||
| 46cd22b716 | |||
| f60574c3f3 | |||
| b6085183fa |
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"chat-ui": patch
|
||||
---
|
||||
|
||||
Add example using chat-ui components
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@llamaindex/community": patch
|
||||
---
|
||||
|
||||
feat: added support for Haiku 3.5 via Bedrock
|
||||
@@ -119,7 +119,7 @@ jobs:
|
||||
run: pnpm run build
|
||||
- name: Build ${{ matrix.packages }}
|
||||
run: pnpm run build
|
||||
working-directory: e2e/examples/${{ matrix.packages }}
|
||||
working-directory: packages/llamaindex/e2e/examples/${{ matrix.packages }}
|
||||
|
||||
typecheck-examples:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -1,27 +1,5 @@
|
||||
# docs
|
||||
|
||||
## 0.0.111
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.8.7
|
||||
|
||||
## 0.0.110
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [95a5cc6]
|
||||
- llamaindex@0.8.6
|
||||
|
||||
## 0.0.109
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- Updated dependencies [a6db5dd]
|
||||
- Updated dependencies [396b1e1]
|
||||
- llamaindex@0.8.5
|
||||
|
||||
## 0.0.108
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docs",
|
||||
"version": "0.0.111",
|
||||
"version": "0.0.108",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
||||
@@ -1,42 +1,5 @@
|
||||
# @llamaindex/doc
|
||||
|
||||
## 0.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @llamaindex/cloud@2.0.4
|
||||
- @llamaindex/core@0.4.4
|
||||
- llamaindex@0.8.7
|
||||
- @llamaindex/node-parser@0.0.5
|
||||
- @llamaindex/openai@0.1.29
|
||||
- @llamaindex/readers@1.0.5
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [95a5cc6]
|
||||
- @llamaindex/core@0.4.3
|
||||
- llamaindex@0.8.6
|
||||
- @llamaindex/cloud@2.0.3
|
||||
- @llamaindex/node-parser@0.0.4
|
||||
- @llamaindex/openai@0.1.28
|
||||
- @llamaindex/readers@1.0.4
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- Updated dependencies [a6db5dd]
|
||||
- Updated dependencies [396b1e1]
|
||||
- llamaindex@0.8.5
|
||||
- @llamaindex/cloud@2.0.2
|
||||
- @llamaindex/core@0.4.2
|
||||
- @llamaindex/node-parser@0.0.3
|
||||
- @llamaindex/openai@0.1.27
|
||||
- @llamaindex/readers@1.0.3
|
||||
|
||||
## 0.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/doc",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.6",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "pnpm run build:docs && next build",
|
||||
|
||||
@@ -25,16 +25,15 @@ export default function HomePage() {
|
||||
return (
|
||||
<main className="container mx-auto px-4 py-12">
|
||||
<h1 className="text-4xl md:text-6xl font-bold text-center mb-4">
|
||||
Build context-augmented web apps using
|
||||
Build RAG Web App using
|
||||
<br /> <span className="text-blue-500">LlamaIndex.TS</span>
|
||||
</h1>
|
||||
<p className="text-xl text-center text-fd-muted-foreground mb-12 ">
|
||||
LlamaIndex.TS is the JS/TS version of{" "}
|
||||
<a href="https://llamaindex.ai">LlamaIndex</a>, the framework for
|
||||
building agentic generative AI applications connected to your data.
|
||||
LlamaIndex.TS is the JS/TS library from our popular Python library
|
||||
llama-index for building LLM applications
|
||||
</p>
|
||||
<div className="text-center text-lg text-fd-muted-foreground mb-12">
|
||||
<span>Designed for building web applications in </span>
|
||||
<span>Designed for building web applications under </span>
|
||||
<TextEffect />
|
||||
</div>
|
||||
|
||||
@@ -59,8 +58,8 @@ export default function HomePage() {
|
||||
<Feature
|
||||
icon={Footprints}
|
||||
subheading="Progressive"
|
||||
heading="From the simplest to the most complex"
|
||||
description="LlamaIndex.TS is designed to be simple to get started, but powerful enough to build complex, agentic AI applications."
|
||||
heading="Adding AI feature from simple to complex"
|
||||
description="LlamaIndex.TS is designed to be simple to start with and can be extended to build complex AI applications."
|
||||
>
|
||||
<Suspense
|
||||
fallback={
|
||||
@@ -114,9 +113,9 @@ const response = await agent.chat({
|
||||
</Feature>
|
||||
<Feature
|
||||
icon={Bot}
|
||||
subheading="Agents"
|
||||
heading="Build agentic RAG applications"
|
||||
description="Truly powerful retrieval-augmented generation applications use agentic techniques, and LlamaIndex.TS makes it easy to build them."
|
||||
subheading="Agent"
|
||||
heading="Build agent for RAG"
|
||||
description="Build agents for RAG using LlamaIndex.TS. Agents are the core building blocks of RAG applications."
|
||||
>
|
||||
<CodeBlock
|
||||
code={`import { FunctionTool } from "llamaindex";
|
||||
@@ -138,19 +137,19 @@ await agent.chat('...');`}
|
||||
<Feature
|
||||
icon={Blocks}
|
||||
subheading="Providers"
|
||||
heading="LLMs, Data Loaders, Vector Stores and more!"
|
||||
description="LlamaIndex.TS has hundreds of integrations to connect to your data, index it, and query it with LLMs."
|
||||
heading="LLM / Data Loader / Vector Store"
|
||||
description="LlamaIndex.TS provides various providers to turn your data into valuable insights."
|
||||
>
|
||||
<div className="mt-8 flex flex-col gap-8">
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold text-fd-muted-foreground mb-2">
|
||||
LLMs
|
||||
LLM
|
||||
</h3>
|
||||
<InfiniteLLMProviders />
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold text-fd-muted-foreground mb-2">
|
||||
Vector Stores
|
||||
Vector Store
|
||||
</h3>
|
||||
<InfiniteVectorStoreProviders />
|
||||
</div>
|
||||
@@ -158,8 +157,8 @@ await agent.chat('...');`}
|
||||
</Feature>
|
||||
<Feature
|
||||
icon={Terminal}
|
||||
subheading="create-llama CLI"
|
||||
heading="Build a RAG app with a single command"
|
||||
subheading="Create Llama CLI"
|
||||
heading="CLI for starting RAG app with one line"
|
||||
description="A command line tool to generate LlamaIndex apps, the easiest way to get started with LlamaIndex."
|
||||
>
|
||||
<div className="my-6">
|
||||
|
||||
@@ -7,8 +7,9 @@ import { ReactElement } from "react";
|
||||
export function Contributing(): ReactElement {
|
||||
return (
|
||||
<div className="flex flex-col items-center border-x border-t px-4 py-16 text-center">
|
||||
<Heart className="mb-4" />
|
||||
<h2 className="mb-4 text-xl font-semibold sm:text-2xl">
|
||||
Made possible by you <Heart className="inline align-middle" />
|
||||
Made Possible by You.
|
||||
</h2>
|
||||
<p className="mb-4 text-fd-muted-foreground">
|
||||
LlamaIndex.TS is powered by the open source community.
|
||||
|
||||
@@ -53,6 +53,9 @@ export default async function ContributorCounter({
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="text-center text-sm text-fd-muted-foreground">
|
||||
Some of our best contributors.
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
import "dotenv/config";
|
||||
|
||||
import {
|
||||
DefaultAzureCredential,
|
||||
getBearerTokenProvider,
|
||||
} from "@azure/identity";
|
||||
import {
|
||||
AzureCosmosDBNoSqlVectorStore,
|
||||
AzureCosmosNoSqlDocumentStore,
|
||||
AzureCosmosNoSqlIndexStore,
|
||||
Document,
|
||||
OpenAI,
|
||||
OpenAIEmbedding,
|
||||
Settings,
|
||||
storageContextFromDefaults,
|
||||
VectorStoreIndex,
|
||||
} from "llamaindex";
|
||||
/**
|
||||
* This example demonstrates how to use Azure CosmosDB with LlamaIndex.
|
||||
* It uses Azure CosmosDB as IndexStore, DocumentStore, and VectorStore.
|
||||
*
|
||||
* To run this example, create an .env file under /examples and set the following environment variables:
|
||||
*
|
||||
* AZURE_OPENAI_ENDPOINT="https://AOAI-ACCOUNT.openai.azure.com" // Sample Azure OpenAI endpoint.
|
||||
* AZURE_DEPLOYMENT_NAME="gpt-4o" // Sample Azure OpenAI deployment name.
|
||||
* EMBEDDING_MODEL="text-embedding-3-large" // Sample Azure OpenAI embedding model.
|
||||
* AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT = "https://DB-ACCOUNT.documents.azure.com:443/" // Sample CosmosDB account endpoint.
|
||||
*
|
||||
* This example uses managed identity to authenticate with Azure CosmosDB and Azure OpenAI. Make sure to assign the required roles to the managed identity.
|
||||
* You can also use connectionString for Azure CosmosDB and Keys with Azure OpenAI for authentication.
|
||||
*/
|
||||
(async () => {
|
||||
const credential = new DefaultAzureCredential();
|
||||
const azureADTokenProvider = getBearerTokenProvider(
|
||||
credential,
|
||||
"https://cognitiveservices.azure.com/.default",
|
||||
);
|
||||
|
||||
const azure = {
|
||||
azureADTokenProvider,
|
||||
deployment: process.env.AZURE_DEPLOYMENT_NAME,
|
||||
};
|
||||
Settings.llm = new OpenAI({ azure });
|
||||
Settings.embedModel = new OpenAIEmbedding({
|
||||
model: process.env.EMBEDDING_MODEL,
|
||||
azure: {
|
||||
...azure,
|
||||
deployment: process.env.EMBEDDING_MODEL,
|
||||
},
|
||||
});
|
||||
const docStore = AzureCosmosNoSqlDocumentStore.fromAadToken();
|
||||
console.log({ docStore });
|
||||
const indexStore = AzureCosmosNoSqlIndexStore.fromAadToken();
|
||||
console.log({ indexStore });
|
||||
const vectorStore = AzureCosmosDBNoSqlVectorStore.fromUriAndManagedIdentity();
|
||||
console.log({ vectorStore });
|
||||
const storageContext = await storageContextFromDefaults({
|
||||
docStore,
|
||||
indexStore,
|
||||
vectorStore,
|
||||
});
|
||||
console.log({ storageContext });
|
||||
|
||||
const document = new Document({ text: "Test Text" });
|
||||
const index = await VectorStoreIndex.fromDocuments([document], {
|
||||
storageContext,
|
||||
logProgress: true,
|
||||
});
|
||||
|
||||
console.log({ index });
|
||||
})();
|
||||
@@ -6,21 +6,17 @@ import {
|
||||
} from "@llamaindex/readers/cosmosdb";
|
||||
import * as dotenv from "dotenv";
|
||||
import {
|
||||
AzureCosmosDBNoSQLConfig,
|
||||
AzureCosmosDBNoSqlVectorStore,
|
||||
OpenAI,
|
||||
OpenAIEmbedding,
|
||||
Settings,
|
||||
storageContextFromDefaults,
|
||||
VectorStoreIndex,
|
||||
} from "llamaindex";
|
||||
import {
|
||||
createStoresFromConnectionString,
|
||||
createStoresFromManagedIdentity,
|
||||
} from "./utils";
|
||||
// Load environment variables from local .env file
|
||||
dotenv.config();
|
||||
|
||||
const cosmosEndpoint = process.env.AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT!;
|
||||
const cosmosEndpoint = process.env.AZURE_COSMOSDB_NOSQL_ENDPOINT!;
|
||||
const cosmosConnectionString =
|
||||
process.env.AZURE_COSMOSDB_NOSQL_CONNECTION_STRING!;
|
||||
const databaseName =
|
||||
@@ -30,7 +26,7 @@ const collectionName =
|
||||
const vectorCollectionName =
|
||||
process.env.AZURE_COSMOSDB_VECTOR_CONTAINER_NAME || "vectorContainer";
|
||||
|
||||
// This example uses Azure OpenAI llm and embedding models
|
||||
// This exampple uses Azure OpenAI llm and embedding models
|
||||
const llmInit = {
|
||||
azure: {
|
||||
apiVersion: process.env.AZURE_OPENAI_LLM_API_VERSION,
|
||||
@@ -50,48 +46,24 @@ const embedModelInit = {
|
||||
Settings.llm = new OpenAI(llmInit);
|
||||
Settings.embedModel = new OpenAIEmbedding(embedModelInit);
|
||||
|
||||
// Initialize the CosmosDB client
|
||||
async function initializeCosmosClient() {
|
||||
if (cosmosConnectionString) {
|
||||
return new CosmosClient(cosmosConnectionString);
|
||||
} else {
|
||||
const credential = new DefaultAzureCredential();
|
||||
return new CosmosClient({
|
||||
endpoint: cosmosEndpoint,
|
||||
aadCredentials: credential,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize CosmosDB to be used as a vectorStore, docStore, and indexStore
|
||||
async function initializeStores() {
|
||||
// Create a configuration object for the Azure CosmosDB NoSQL Vector Store
|
||||
const dbConfig: AzureCosmosDBNoSQLConfig = {
|
||||
databaseName,
|
||||
containerName: vectorCollectionName,
|
||||
flatMetadata: false,
|
||||
};
|
||||
|
||||
if (cosmosConnectionString) {
|
||||
return createStoresFromConnectionString(cosmosConnectionString, dbConfig);
|
||||
} else {
|
||||
// Use managed identity to authenticate with Azure CosmosDB
|
||||
const credential = new DefaultAzureCredential();
|
||||
return createStoresFromManagedIdentity(
|
||||
cosmosEndpoint,
|
||||
credential,
|
||||
dbConfig,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadVectorData() {
|
||||
if (!cosmosConnectionString && !cosmosEndpoint) {
|
||||
throw new Error(
|
||||
"Azure CosmosDB connection string or endpoint must be set.",
|
||||
);
|
||||
}
|
||||
const cosmosClient = await initializeCosmosClient();
|
||||
|
||||
let cosmosClient: CosmosClient;
|
||||
// initialize the cosmos client
|
||||
if (cosmosConnectionString) {
|
||||
cosmosClient = new CosmosClient(cosmosConnectionString);
|
||||
} else {
|
||||
cosmosClient = new CosmosClient({
|
||||
endpoint: cosmosEndpoint,
|
||||
aadCredentials: new DefaultAzureCredential(),
|
||||
});
|
||||
}
|
||||
|
||||
const reader = new SimpleCosmosDBReader(cosmosClient);
|
||||
// create a configuration object for the reader
|
||||
const simpleCosmosReaderConfig: SimpleCosmosDBReaderLoaderConfig = {
|
||||
@@ -104,15 +76,16 @@ async function loadVectorData() {
|
||||
|
||||
// load objects from cosmos and convert them into LlamaIndex Document objects
|
||||
const documents = await reader.loadData(simpleCosmosReaderConfig);
|
||||
|
||||
// use Azure CosmosDB as a vectorStore, docStore, and indexStore
|
||||
const { vectorStore, docStore, indexStore } = await initializeStores();
|
||||
// Store the embeddings in the CosmosDB container
|
||||
const storageContext = await storageContextFromDefaults({
|
||||
vectorStore,
|
||||
docStore,
|
||||
indexStore,
|
||||
// create Azure CosmosDB as a vector store
|
||||
const vectorStore = new AzureCosmosDBNoSqlVectorStore({
|
||||
client: cosmosClient,
|
||||
databaseName,
|
||||
containerName: vectorCollectionName,
|
||||
flatMetadata: false,
|
||||
});
|
||||
|
||||
// Store the embeddings in the CosmosDB container
|
||||
const storageContext = await storageContextFromDefaults({ vectorStore });
|
||||
await VectorStoreIndex.fromDocuments(documents, { storageContext });
|
||||
console.log(
|
||||
`Successfully created embeddings in the CosmosDB container ${vectorCollectionName}.`,
|
||||
|
||||
@@ -3,21 +3,17 @@ import { DefaultAzureCredential } from "@azure/identity";
|
||||
import * as dotenv from "dotenv";
|
||||
import {
|
||||
AzureCosmosDBNoSQLConfig,
|
||||
AzureCosmosDBNoSqlVectorStore,
|
||||
OpenAI,
|
||||
OpenAIEmbedding,
|
||||
Settings,
|
||||
storageContextFromDefaults,
|
||||
VectorStoreIndex,
|
||||
} from "llamaindex";
|
||||
import {
|
||||
createStoresFromConnectionString,
|
||||
createStoresFromManagedIdentity,
|
||||
} from "./utils";
|
||||
|
||||
// Load environment variables from local .env file
|
||||
dotenv.config();
|
||||
|
||||
const cosmosEndpoint = process.env.AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT!;
|
||||
const cosmosEndpoint = process.env.AZURE_COSMOSDB_NOSQL_ENDPOINT!;
|
||||
const cosmosConnectionString =
|
||||
process.env.AZURE_COSMOSDB_NOSQL_CONNECTION_STRING!;
|
||||
const databaseName =
|
||||
@@ -44,27 +40,6 @@ const embedModelInit = {
|
||||
Settings.llm = new OpenAI(llmInit);
|
||||
Settings.embedModel = new OpenAIEmbedding(embedModelInit);
|
||||
|
||||
async function initializeStores() {
|
||||
// Create a configuration object for the Azure CosmosDB NoSQL Vector Store
|
||||
const dbConfig: AzureCosmosDBNoSQLConfig = {
|
||||
databaseName,
|
||||
containerName,
|
||||
flatMetadata: false,
|
||||
};
|
||||
|
||||
if (cosmosConnectionString) {
|
||||
return createStoresFromConnectionString(cosmosConnectionString, dbConfig);
|
||||
} else {
|
||||
// Use managed identity to authenticate with Azure CosmosDB
|
||||
const credential = new DefaultAzureCredential();
|
||||
return createStoresFromManagedIdentity(
|
||||
cosmosEndpoint,
|
||||
credential,
|
||||
dbConfig,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function query() {
|
||||
if (!cosmosConnectionString && !cosmosEndpoint) {
|
||||
throw new Error(
|
||||
@@ -90,19 +65,10 @@ async function query() {
|
||||
containerName,
|
||||
flatMetadata: false,
|
||||
};
|
||||
|
||||
// use Azure CosmosDB as a vectorStore, docStore, and indexStore
|
||||
const { vectorStore, docStore, indexStore } = await initializeStores();
|
||||
|
||||
// Store the embeddings in the CosmosDB container
|
||||
const storageContext = await storageContextFromDefaults({
|
||||
vectorStore,
|
||||
docStore,
|
||||
indexStore,
|
||||
});
|
||||
const store = new AzureCosmosDBNoSqlVectorStore(dbConfig);
|
||||
|
||||
// create an index from the Azure CosmosDB NoSQL Vector Store
|
||||
const index = await VectorStoreIndex.init({ storageContext });
|
||||
const index = await VectorStoreIndex.fromVectorStore(store);
|
||||
|
||||
// create a retriever and a query engine from the index
|
||||
const retriever = index.asRetriever({ similarityTopK: 20 });
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import { TokenCredential } from "@azure/identity";
|
||||
import {
|
||||
AzureCosmosDBNoSQLConfig,
|
||||
AzureCosmosDBNoSqlVectorStore,
|
||||
AzureCosmosNoSqlDocumentStore,
|
||||
AzureCosmosNoSqlIndexStore,
|
||||
} from "llamaindex";
|
||||
|
||||
/**
|
||||
* Util function to create AzureCosmosDB vectorStore, docStore, indexStore from connection string.
|
||||
*/
|
||||
export const createStoresFromConnectionString = (
|
||||
connectionString: string,
|
||||
dbConfig: AzureCosmosDBNoSQLConfig,
|
||||
) => {
|
||||
const vectorStore = AzureCosmosDBNoSqlVectorStore.fromConnectionString({
|
||||
connectionString,
|
||||
...dbConfig,
|
||||
});
|
||||
const docStore = AzureCosmosNoSqlDocumentStore.fromConnectionString({
|
||||
connectionString,
|
||||
});
|
||||
const indexStore = AzureCosmosNoSqlIndexStore.fromConnectionString({
|
||||
connectionString,
|
||||
});
|
||||
return { vectorStore, docStore, indexStore };
|
||||
};
|
||||
|
||||
/**
|
||||
* Util function to create AzureCosmosDB vectorStore, docStore, indexStore from connection string.
|
||||
*/
|
||||
export const createStoresFromManagedIdentity = (
|
||||
endpoint: string,
|
||||
credential: TokenCredential,
|
||||
dbConfig: AzureCosmosDBNoSQLConfig,
|
||||
) => {
|
||||
const vectorStore = AzureCosmosDBNoSqlVectorStore.fromUriAndManagedIdentity({
|
||||
endpoint,
|
||||
credential,
|
||||
...dbConfig,
|
||||
});
|
||||
const docStore = AzureCosmosNoSqlDocumentStore.fromAadToken({
|
||||
endpoint,
|
||||
credential,
|
||||
});
|
||||
const indexStore = AzureCosmosNoSqlIndexStore.fromAadToken({
|
||||
endpoint,
|
||||
credential,
|
||||
});
|
||||
return { vectorStore, docStore, indexStore };
|
||||
};
|
||||
@@ -1,27 +1,5 @@
|
||||
# @llamaindex/autotool
|
||||
|
||||
## 5.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.8.7
|
||||
|
||||
## 5.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [95a5cc6]
|
||||
- llamaindex@0.8.6
|
||||
|
||||
## 5.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- Updated dependencies [a6db5dd]
|
||||
- Updated dependencies [396b1e1]
|
||||
- llamaindex@0.8.5
|
||||
|
||||
## 5.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,30 +1,5 @@
|
||||
# @llamaindex/autotool-01-node-example
|
||||
|
||||
## 0.0.50
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.8.7
|
||||
- @llamaindex/autotool@5.0.7
|
||||
|
||||
## 0.0.49
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [95a5cc6]
|
||||
- llamaindex@0.8.6
|
||||
- @llamaindex/autotool@5.0.6
|
||||
|
||||
## 0.0.48
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- Updated dependencies [a6db5dd]
|
||||
- Updated dependencies [396b1e1]
|
||||
- llamaindex@0.8.5
|
||||
- @llamaindex/autotool@5.0.5
|
||||
|
||||
## 0.0.47
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
"scripts": {
|
||||
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
|
||||
},
|
||||
"version": "0.0.50"
|
||||
"version": "0.0.47"
|
||||
}
|
||||
|
||||
@@ -1,30 +1,5 @@
|
||||
# @llamaindex/autotool-02-next-example
|
||||
|
||||
## 0.1.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.8.7
|
||||
- @llamaindex/autotool@5.0.7
|
||||
|
||||
## 0.1.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [95a5cc6]
|
||||
- llamaindex@0.8.6
|
||||
- @llamaindex/autotool@5.0.6
|
||||
|
||||
## 0.1.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- Updated dependencies [a6db5dd]
|
||||
- Updated dependencies [396b1e1]
|
||||
- llamaindex@0.8.5
|
||||
- @llamaindex/autotool@5.0.5
|
||||
|
||||
## 0.1.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/autotool-02-next-example",
|
||||
"private": true,
|
||||
"version": "0.1.94",
|
||||
"version": "0.1.91",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/autotool",
|
||||
"type": "module",
|
||||
"version": "5.0.7",
|
||||
"version": "5.0.4",
|
||||
"description": "auto transpile your JS function to LLM Agent compatible",
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -1,28 +1,5 @@
|
||||
# @llamaindex/cloud
|
||||
|
||||
## 2.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a8d3fa6]
|
||||
- @llamaindex/env@0.1.18
|
||||
- @llamaindex/core@0.4.4
|
||||
|
||||
## 2.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [95a5cc6]
|
||||
- @llamaindex/core@0.4.3
|
||||
|
||||
## 2.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- @llamaindex/env@0.1.17
|
||||
- @llamaindex/core@0.4.2
|
||||
|
||||
## 2.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/cloud",
|
||||
"version": "2.0.4",
|
||||
"version": "2.0.1",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,35 +1,5 @@
|
||||
# @llamaindex/community
|
||||
|
||||
## 0.0.62
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a8d3fa6]
|
||||
- @llamaindex/env@0.1.18
|
||||
- @llamaindex/core@0.4.4
|
||||
|
||||
## 0.0.61
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 487782c: Add missing inference endpoints for Haiku 3.5
|
||||
- Updated dependencies [95a5cc6]
|
||||
- @llamaindex/core@0.4.3
|
||||
|
||||
## 0.0.60
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- @llamaindex/env@0.1.17
|
||||
- @llamaindex/core@0.4.2
|
||||
|
||||
## 0.0.59
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 47a7c3e: feat: added support for Haiku 3.5 via Bedrock
|
||||
|
||||
## 0.0.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/community",
|
||||
"description": "Community package for LlamaIndexTS",
|
||||
"version": "0.0.62",
|
||||
"version": "0.0.58",
|
||||
"type": "module",
|
||||
"types": "dist/type/index.d.ts",
|
||||
"main": "dist/cjs/index.js",
|
||||
|
||||
@@ -87,7 +87,6 @@ export type BEDROCK_MODELS =
|
||||
|
||||
export const INFERENCE_BEDROCK_MODELS = {
|
||||
US_ANTHROPIC_CLAUDE_3_HAIKU: "us.anthropic.claude-3-haiku-20240307-v1:0",
|
||||
US_ANTHROPIC_CLAUDE_3_5_HAIKU: "us.anthropic.claude-3-5-haiku-20241022-v1:0",
|
||||
US_ANTHROPIC_CLAUDE_3_OPUS: "us.anthropic.claude-3-opus-20240229-v1:0",
|
||||
US_ANTHROPIC_CLAUDE_3_SONNET: "us.anthropic.claude-3-sonnet-20240229-v1:0",
|
||||
US_ANTHROPIC_CLAUDE_3_5_SONNET:
|
||||
@@ -100,7 +99,6 @@ export const INFERENCE_BEDROCK_MODELS = {
|
||||
US_META_LLAMA_3_2_90B_INSTRUCT: "us.meta.llama3-2-90b-instruct-v1:0",
|
||||
|
||||
EU_ANTHROPIC_CLAUDE_3_HAIKU: "eu.anthropic.claude-3-haiku-20240307-v1:0",
|
||||
EU_ANTHROPIC_CLAUDE_3_5_HAIKU: "eu.anthropic.claude-3-5-haiku-20240307-v1:0",
|
||||
EU_ANTHROPIC_CLAUDE_3_SONNET: "eu.anthropic.claude-3-sonnet-20240229-v1:0",
|
||||
EU_ANTHROPIC_CLAUDE_3_5_SONNET:
|
||||
"eu.anthropic.claude-3-5-sonnet-20240620-v1:0",
|
||||
@@ -125,8 +123,6 @@ export const INFERENCE_TO_BEDROCK_MAP: Record<
|
||||
BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_5_SONNET,
|
||||
[INFERENCE_BEDROCK_MODELS.US_ANTHROPIC_CLAUDE_3_5_SONNET_V2]:
|
||||
BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_5_SONNET_V2,
|
||||
[INFERENCE_BEDROCK_MODELS.US_ANTHROPIC_CLAUDE_3_5_HAIKU]:
|
||||
BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_5_HAIKU,
|
||||
[INFERENCE_BEDROCK_MODELS.US_META_LLAMA_3_2_1B_INSTRUCT]:
|
||||
BEDROCK_MODELS.META_LLAMA3_2_1B_INSTRUCT,
|
||||
[INFERENCE_BEDROCK_MODELS.US_META_LLAMA_3_2_3B_INSTRUCT]:
|
||||
|
||||
@@ -1,25 +1,5 @@
|
||||
# @llamaindex/core
|
||||
|
||||
## 0.4.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a8d3fa6]
|
||||
- @llamaindex/env@0.1.18
|
||||
|
||||
## 0.4.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 95a5cc6: refactor: move storage into core
|
||||
|
||||
## 0.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- @llamaindex/env@0.1.17
|
||||
|
||||
## 0.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/core",
|
||||
"type": "module",
|
||||
"version": "0.4.4",
|
||||
"version": "0.4.1",
|
||||
"description": "LlamaIndex Core Module",
|
||||
"exports": {
|
||||
"./agent": {
|
||||
@@ -214,48 +214,6 @@
|
||||
"default": "./storage/chat-store/dist/index.js"
|
||||
}
|
||||
},
|
||||
"./storage/doc-store": {
|
||||
"require": {
|
||||
"types": "./storage/doc-store/dist/index.d.cts",
|
||||
"default": "./storage/doc-store/dist/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./storage/doc-store/dist/index.d.ts",
|
||||
"default": "./storage/doc-store/dist/index.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./storage/doc-store/dist/index.d.ts",
|
||||
"default": "./storage/doc-store/dist/index.js"
|
||||
}
|
||||
},
|
||||
"./storage/index-store": {
|
||||
"require": {
|
||||
"types": "./storage/index-store/dist/index.d.cts",
|
||||
"default": "./storage/index-store/dist/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./storage/index-store/dist/index.d.ts",
|
||||
"default": "./storage/index-store/dist/index.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./storage/index-store/dist/index.d.ts",
|
||||
"default": "./storage/index-store/dist/index.js"
|
||||
}
|
||||
},
|
||||
"./storage/kv-store": {
|
||||
"require": {
|
||||
"types": "./storage/kv-store/dist/index.d.cts",
|
||||
"default": "./storage/kv-store/dist/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./storage/kv-store/dist/index.d.ts",
|
||||
"default": "./storage/kv-store/dist/index.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./storage/kv-store/dist/index.d.ts",
|
||||
"default": "./storage/kv-store/dist/index.js"
|
||||
}
|
||||
},
|
||||
"./response-synthesizers": {
|
||||
"require": {
|
||||
"types": "./response-synthesizers/dist/index.d.cts",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { randomUUID } from "@llamaindex/env";
|
||||
import type { UUID } from "../global";
|
||||
import { BaseNode } from "../schema";
|
||||
import { IndexStructType } from "./struct-type";
|
||||
|
||||
export abstract class IndexStruct {
|
||||
@@ -66,48 +65,3 @@ export class KeywordTable extends IndexStruct {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class IndexDict extends IndexStruct {
|
||||
nodesDict: Record<string, BaseNode> = {};
|
||||
type: IndexStructType = IndexStructType.SIMPLE_DICT;
|
||||
|
||||
addNode(node: BaseNode, textId?: string) {
|
||||
const vectorId = textId ?? node.id_;
|
||||
this.nodesDict[vectorId] = node;
|
||||
}
|
||||
|
||||
toJson(): Record<string, unknown> {
|
||||
const nodesDict: Record<string, unknown> = {};
|
||||
|
||||
for (const [key, node] of Object.entries(this.nodesDict)) {
|
||||
nodesDict[key] = node.toJSON();
|
||||
}
|
||||
|
||||
return {
|
||||
...super.toJson(),
|
||||
nodesDict,
|
||||
type: this.type,
|
||||
};
|
||||
}
|
||||
|
||||
delete(nodeId: string) {
|
||||
delete this.nodesDict[nodeId];
|
||||
}
|
||||
}
|
||||
|
||||
export class IndexList extends IndexStruct {
|
||||
nodes: string[] = [];
|
||||
type: IndexStructType = IndexStructType.LIST;
|
||||
|
||||
addNode(node: BaseNode) {
|
||||
this.nodes.push(node.id_);
|
||||
}
|
||||
|
||||
toJson(): Record<string, unknown> {
|
||||
return {
|
||||
...super.toJson(),
|
||||
nodes: this.nodes,
|
||||
type: this.type,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,2 @@
|
||||
export {
|
||||
IndexDict,
|
||||
IndexList,
|
||||
IndexStruct,
|
||||
KeywordTable,
|
||||
} from "./data-structs";
|
||||
export { jsonToIndexStruct } from "./json-to-index-struct";
|
||||
export { IndexStruct, KeywordTable } from "./data-structs";
|
||||
export { IndexStructType } from "./struct-type";
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import type { BaseNode } from "../schema";
|
||||
import { jsonToNode } from "../schema";
|
||||
import { IndexDict, IndexList, IndexStruct } from "./data-structs";
|
||||
import { IndexStructType } from "./struct-type";
|
||||
|
||||
export function jsonToIndexStruct(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
json: any,
|
||||
): IndexStruct {
|
||||
if (json.type === IndexStructType.LIST) {
|
||||
const indexList = new IndexList(json.indexId, json.summary);
|
||||
indexList.nodes = json.nodes;
|
||||
return indexList;
|
||||
} else if (json.type === IndexStructType.SIMPLE_DICT) {
|
||||
const indexDict = new IndexDict(json.indexId, json.summary);
|
||||
indexDict.nodesDict = Object.entries(json.nodesDict).reduce<
|
||||
Record<string, BaseNode>
|
||||
>((acc, [key, value]) => {
|
||||
acc[key] = jsonToNode(value);
|
||||
return acc;
|
||||
}, {});
|
||||
return indexDict;
|
||||
} else {
|
||||
throw new Error(`Unknown index struct type: ${json.type}`);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { MessageContent } from "../llms";
|
||||
import type { BaseNodePostprocessor } from "../postprocessor";
|
||||
import { BaseQueryEngine, type QueryType } from "../query-engine";
|
||||
import {
|
||||
type BaseSynthesizer,
|
||||
getResponseSynthesizer,
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
import { BaseRetriever } from "../retriever";
|
||||
import type { NodeWithScore } from "../schema";
|
||||
import { extractText } from "../utils";
|
||||
import { BaseQueryEngine, type QueryType } from "./base";
|
||||
|
||||
export class RetrieverQueryEngine extends BaseQueryEngine {
|
||||
retriever: BaseRetriever;
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
export * from "./node";
|
||||
export {
|
||||
FileReader,
|
||||
TransformComponent,
|
||||
type BaseReader,
|
||||
type StoredValue,
|
||||
} from "./type";
|
||||
export { FileReader, TransformComponent, type BaseReader } from "./type";
|
||||
export type { BaseOutputParser } from "./type/base-output-parser";
|
||||
export { EngineResponse } from "./type/engine–response";
|
||||
export * from "./zod";
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { fs, path, randomUUID } from "@llamaindex/env";
|
||||
import type { BaseNode, Document } from "./node";
|
||||
|
||||
// fixme: remove any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type StoredValue = Record<string, any> | null;
|
||||
|
||||
interface TransformComponentSignature<
|
||||
Result extends BaseNode[] | Promise<BaseNode[]>,
|
||||
> {
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
import { path } from "@llamaindex/env";
|
||||
import {
|
||||
DEFAULT_DOC_STORE_PERSIST_FILENAME,
|
||||
DEFAULT_PERSIST_DIR,
|
||||
} from "../../global";
|
||||
import type { StoredValue } from "../../schema";
|
||||
import { BaseNode, Document, ObjectType, TextNode } from "../../schema";
|
||||
|
||||
const TYPE_KEY = "__type__";
|
||||
const DATA_KEY = "__data__";
|
||||
|
||||
export interface Serializer<T> {
|
||||
toPersistence(data: Record<string, unknown>): T;
|
||||
|
||||
fromPersistence(data: T): Record<string, unknown>;
|
||||
}
|
||||
|
||||
export const jsonSerializer: Serializer<string> = {
|
||||
toPersistence(data) {
|
||||
return JSON.stringify(data);
|
||||
},
|
||||
fromPersistence(data) {
|
||||
return JSON.parse(data);
|
||||
},
|
||||
};
|
||||
|
||||
export const noneSerializer: Serializer<Record<string, unknown>> = {
|
||||
toPersistence(data) {
|
||||
return data;
|
||||
},
|
||||
fromPersistence(data) {
|
||||
return data;
|
||||
},
|
||||
};
|
||||
|
||||
type DocJson<Data> = {
|
||||
[TYPE_KEY]: ObjectType;
|
||||
[DATA_KEY]: Data;
|
||||
};
|
||||
|
||||
export function isValidDocJson(
|
||||
docJson: StoredValue | null | undefined,
|
||||
): docJson is DocJson<unknown> {
|
||||
return (
|
||||
typeof docJson === "object" &&
|
||||
docJson !== null &&
|
||||
docJson[TYPE_KEY] !== undefined &&
|
||||
docJson[DATA_KEY] !== undefined
|
||||
);
|
||||
}
|
||||
|
||||
export function docToJson(
|
||||
doc: BaseNode,
|
||||
serializer: Serializer<unknown>,
|
||||
): DocJson<unknown> {
|
||||
return {
|
||||
[DATA_KEY]: serializer.toPersistence(doc.toJSON()),
|
||||
[TYPE_KEY]: doc.type,
|
||||
};
|
||||
}
|
||||
|
||||
export function jsonToDoc<Data>(
|
||||
docDict: DocJson<Data>,
|
||||
serializer: Serializer<Data>,
|
||||
): BaseNode {
|
||||
const docType = docDict[TYPE_KEY];
|
||||
// fixme: zod type check this
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const dataDict: any = serializer.fromPersistence(docDict[DATA_KEY]);
|
||||
let doc: BaseNode;
|
||||
|
||||
if (docType === ObjectType.DOCUMENT) {
|
||||
doc = new Document({
|
||||
text: dataDict.text,
|
||||
id_: dataDict.id_,
|
||||
embedding: dataDict.embedding,
|
||||
hash: dataDict.hash,
|
||||
metadata: dataDict.metadata,
|
||||
});
|
||||
} else if (docType === ObjectType.TEXT) {
|
||||
doc = new TextNode({
|
||||
text: dataDict.text,
|
||||
id_: dataDict.id_,
|
||||
hash: dataDict.hash,
|
||||
metadata: dataDict.metadata,
|
||||
relationships: dataDict.relationships,
|
||||
});
|
||||
} else {
|
||||
throw new Error(`Unknown doc type: ${docType}`);
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
const DEFAULT_PERSIST_PATH = path.join(
|
||||
DEFAULT_PERSIST_DIR,
|
||||
DEFAULT_DOC_STORE_PERSIST_FILENAME,
|
||||
);
|
||||
|
||||
export interface RefDocInfo {
|
||||
nodeIds: string[];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
extraInfo: Record<string, any>;
|
||||
}
|
||||
|
||||
export abstract class BaseDocumentStore {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
serializer: Serializer<any> = jsonSerializer;
|
||||
|
||||
// Save/load
|
||||
persist(persistPath: string = DEFAULT_PERSIST_PATH): void {
|
||||
// Persist the docstore to a file.
|
||||
}
|
||||
|
||||
// Main interface
|
||||
abstract docs(): Promise<Record<string, BaseNode>>;
|
||||
|
||||
abstract addDocuments(docs: BaseNode[], allowUpdate: boolean): Promise<void>;
|
||||
|
||||
abstract getDocument(
|
||||
docId: string,
|
||||
raiseError: boolean,
|
||||
): Promise<BaseNode | undefined>;
|
||||
|
||||
abstract deleteDocument(docId: string, raiseError: boolean): Promise<void>;
|
||||
|
||||
abstract documentExists(docId: string): Promise<boolean>;
|
||||
|
||||
// Hash
|
||||
abstract setDocumentHash(docId: string, docHash: string): Promise<void>;
|
||||
|
||||
abstract getDocumentHash(docId: string): Promise<string | undefined>;
|
||||
|
||||
abstract getAllDocumentHashes(): Promise<Record<string, string>>;
|
||||
|
||||
// Ref Docs
|
||||
abstract getAllRefDocInfo(): Promise<Record<string, RefDocInfo> | undefined>;
|
||||
|
||||
abstract getRefDocInfo(refDocId: string): Promise<RefDocInfo | undefined>;
|
||||
|
||||
abstract deleteRefDoc(refDocId: string, raiseError: boolean): Promise<void>;
|
||||
|
||||
// Nodes
|
||||
getNodes(nodeIds: string[], raiseError: boolean = true): Promise<BaseNode[]> {
|
||||
return Promise.all(
|
||||
nodeIds.map((nodeId) => this.getNode(nodeId, raiseError)),
|
||||
);
|
||||
}
|
||||
|
||||
async getNode(nodeId: string, raiseError: boolean = true): Promise<BaseNode> {
|
||||
const doc = await this.getDocument(nodeId, raiseError);
|
||||
if (!(doc instanceof BaseNode)) {
|
||||
throw new Error(`Document ${nodeId} is not a Node.`);
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
async getNodeDict(nodeIdDict: {
|
||||
[index: number]: string;
|
||||
}): Promise<Record<number, BaseNode>> {
|
||||
const result: Record<number, BaseNode> = {};
|
||||
for (const index in nodeIdDict) {
|
||||
result[index] = await this.getNode(nodeIdDict[index]!);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
import { path } from "@llamaindex/env";
|
||||
import { IndexStruct, jsonToIndexStruct } from "../../data-structs";
|
||||
import {
|
||||
DEFAULT_INDEX_STORE_PERSIST_FILENAME,
|
||||
DEFAULT_NAMESPACE,
|
||||
DEFAULT_PERSIST_DIR,
|
||||
} from "../../global";
|
||||
import {
|
||||
BaseInMemoryKVStore,
|
||||
BaseKVStore,
|
||||
type DataType,
|
||||
SimpleKVStore,
|
||||
} from "../kv-store";
|
||||
|
||||
export const DEFAULT_PERSIST_PATH = path.join(
|
||||
DEFAULT_PERSIST_DIR,
|
||||
DEFAULT_INDEX_STORE_PERSIST_FILENAME,
|
||||
);
|
||||
|
||||
export abstract class BaseIndexStore {
|
||||
abstract getIndexStructs(): Promise<IndexStruct[]>;
|
||||
|
||||
abstract addIndexStruct(indexStruct: IndexStruct): Promise<void>;
|
||||
|
||||
abstract deleteIndexStruct(key: string): Promise<void>;
|
||||
|
||||
abstract getIndexStruct(structId?: string): Promise<IndexStruct | undefined>;
|
||||
|
||||
async persist(persistPath: string = DEFAULT_PERSIST_PATH): Promise<void> {
|
||||
// Persist the index store to disk.
|
||||
}
|
||||
}
|
||||
|
||||
export class KVIndexStore extends BaseIndexStore {
|
||||
private _kvStore: BaseKVStore;
|
||||
private _collection: string;
|
||||
|
||||
constructor(kvStore: BaseKVStore, namespace: string = DEFAULT_NAMESPACE) {
|
||||
super();
|
||||
this._kvStore = kvStore;
|
||||
this._collection = `${namespace}/data`;
|
||||
}
|
||||
|
||||
async addIndexStruct(indexStruct: IndexStruct): Promise<void> {
|
||||
const key = indexStruct.indexId;
|
||||
const data = indexStruct.toJson();
|
||||
await this._kvStore.put(key, data, this._collection);
|
||||
}
|
||||
|
||||
async deleteIndexStruct(key: string): Promise<void> {
|
||||
await this._kvStore.delete(key, this._collection);
|
||||
}
|
||||
|
||||
async getIndexStruct(structId?: string): Promise<IndexStruct | undefined> {
|
||||
if (!structId) {
|
||||
const structs = await this.getIndexStructs();
|
||||
if (structs.length !== 1) {
|
||||
throw new Error("More than one index struct found");
|
||||
}
|
||||
return structs[0];
|
||||
} else {
|
||||
const json = await this._kvStore.get(structId, this._collection);
|
||||
if (json == null) {
|
||||
return;
|
||||
}
|
||||
return jsonToIndexStruct(json);
|
||||
}
|
||||
}
|
||||
|
||||
async getIndexStructs(): Promise<IndexStruct[]> {
|
||||
const jsons = await this._kvStore.getAll(this._collection);
|
||||
return Object.values(jsons).map((json) => jsonToIndexStruct(json));
|
||||
}
|
||||
}
|
||||
|
||||
export class SimpleIndexStore extends KVIndexStore {
|
||||
private kvStore: BaseInMemoryKVStore;
|
||||
|
||||
constructor(kvStore?: BaseInMemoryKVStore) {
|
||||
kvStore = kvStore || new SimpleKVStore();
|
||||
super(kvStore);
|
||||
this.kvStore = kvStore;
|
||||
}
|
||||
|
||||
static async fromPersistDir(
|
||||
persistDir: string = DEFAULT_PERSIST_DIR,
|
||||
): Promise<SimpleIndexStore> {
|
||||
const persistPath = path.join(
|
||||
persistDir,
|
||||
DEFAULT_INDEX_STORE_PERSIST_FILENAME,
|
||||
);
|
||||
return this.fromPersistPath(persistPath);
|
||||
}
|
||||
|
||||
static async fromPersistPath(persistPath: string): Promise<SimpleIndexStore> {
|
||||
const simpleKVStore = await SimpleKVStore.fromPersistPath(persistPath);
|
||||
return new SimpleIndexStore(simpleKVStore);
|
||||
}
|
||||
|
||||
async persist(persistPath: string = DEFAULT_PERSIST_DIR): Promise<void> {
|
||||
this.kvStore.persist(persistPath);
|
||||
}
|
||||
|
||||
static fromDict(saveDict: DataType): SimpleIndexStore {
|
||||
const simpleKVStore = SimpleKVStore.fromDict(saveDict);
|
||||
return new SimpleIndexStore(simpleKVStore);
|
||||
}
|
||||
|
||||
toDict(): Record<string, unknown> {
|
||||
if (!(this.kvStore instanceof SimpleKVStore)) {
|
||||
throw new Error("KVStore is not a SimpleKVStore");
|
||||
}
|
||||
return this.kvStore.toDict();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": "./dist/index.js",
|
||||
"private": true
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": "./dist/index.js",
|
||||
"private": true
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": "./dist/index.js",
|
||||
"private": true
|
||||
}
|
||||
Vendored
-12
@@ -1,17 +1,5 @@
|
||||
# @llamaindex/env
|
||||
|
||||
## 0.1.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- a8d3fa6: fix: exports in package.json
|
||||
|
||||
## 0.1.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 14cc9eb: chore: move multi-model into single sub module
|
||||
|
||||
## 0.1.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"browser": "./dist/index.browser.js",
|
||||
"edge-light": "./dist/index.edge-light.js",
|
||||
"workerd": "./dist/index.workerd.js"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
Vendored
+2
-29
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/env",
|
||||
"description": "environment wrapper, supports all JS environment including node, deno, bun, edge runtime, and cloudflare worker",
|
||||
"version": "0.1.18",
|
||||
"version": "0.1.16",
|
||||
"type": "module",
|
||||
"types": "dist/index.d.ts",
|
||||
"module": "dist/index.js",
|
||||
@@ -28,7 +28,7 @@
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.cjs",
|
||||
"default": "./dist/index.js"
|
||||
"default": "./dist/index.cjs"
|
||||
},
|
||||
"workerd": {
|
||||
"types": "./dist/index.workerd.d.ts",
|
||||
@@ -50,36 +50,9 @@
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"./multi-model": {
|
||||
"workerd": {
|
||||
"types": "./multi-model/dist/index.workerd.d.ts",
|
||||
"default": "./multi-model/dist/index.workerd.js"
|
||||
},
|
||||
"edge-light": {
|
||||
"types": "./multi-model/dist/index.edge-light.d.ts",
|
||||
"default": "./multi-model/dist/index.edge-light.js"
|
||||
},
|
||||
"browser": {
|
||||
"types": "./multi-model/dist/index.browser.d.ts",
|
||||
"default": "./multi-model/dist/index.browser.js"
|
||||
},
|
||||
"import": {
|
||||
"types": "./multi-model/dist/index.d.ts",
|
||||
"default": "./multi-model/dist/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./multi-model/dist/index.d.cts",
|
||||
"default": "./multi-model/dist/index.cjs"
|
||||
},
|
||||
"default": {
|
||||
"types": "./multi-model/dist/index.d.ts",
|
||||
"default": "./multi-model/dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"multi-model",
|
||||
"dist",
|
||||
"CHANGELOG.md",
|
||||
"!**/*.tsbuildinfo"
|
||||
|
||||
Vendored
+6
@@ -6,6 +6,12 @@
|
||||
import "./global-check.js";
|
||||
|
||||
export { consoleLogger, emptyLogger, type Logger } from "./logger/index.js";
|
||||
export {
|
||||
loadTransformers,
|
||||
setTransformers,
|
||||
type LoadTransformerEvent,
|
||||
type OnLoad,
|
||||
} from "./multi-model/index.browser.js";
|
||||
export { Tokenizers, tokenizers, type Tokenizer } from "./tokenizers/js.js";
|
||||
export { NotSupportCurrentRuntimeClass } from "./utils/shared.js";
|
||||
export * from "./web-polyfill.js";
|
||||
|
||||
Vendored
+6
@@ -5,6 +5,12 @@
|
||||
*/
|
||||
import "./global-check.js";
|
||||
export { consoleLogger, emptyLogger, type Logger } from "./logger/index.js";
|
||||
export {
|
||||
loadTransformers,
|
||||
setTransformers,
|
||||
type LoadTransformerEvent,
|
||||
type OnLoad,
|
||||
} from "./multi-model/index.non-nodejs.js";
|
||||
export * from "./node-polyfill.js";
|
||||
export { Tokenizers, tokenizers, type Tokenizer } from "./tokenizers/js.js";
|
||||
export { NotSupportCurrentRuntimeClass } from "./utils/shared.js";
|
||||
|
||||
Vendored
+6
@@ -35,6 +35,12 @@ export function createSHA256(): SHA256 {
|
||||
}
|
||||
|
||||
export { consoleLogger, emptyLogger, type Logger } from "./logger/index.js";
|
||||
export {
|
||||
loadTransformers,
|
||||
setTransformers,
|
||||
type LoadTransformerEvent,
|
||||
type OnLoad,
|
||||
} from "./multi-model/index.js";
|
||||
export { Tokenizers, tokenizers, type Tokenizer } from "./tokenizers/node.js";
|
||||
export {
|
||||
AsyncLocalStorage,
|
||||
|
||||
Vendored
+6
@@ -16,4 +16,10 @@ export function getEnv(name: string): string | undefined {
|
||||
}
|
||||
|
||||
export { consoleLogger, emptyLogger, type Logger } from "./logger/index.js";
|
||||
export {
|
||||
loadTransformers,
|
||||
setTransformers,
|
||||
type LoadTransformerEvent,
|
||||
type OnLoad,
|
||||
} from "./multi-model/index.non-nodejs.js";
|
||||
export { Tokenizers, tokenizers, type Tokenizer } from "./tokenizers/js.js";
|
||||
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
export {
|
||||
loadTransformers,
|
||||
setTransformers,
|
||||
type LoadTransformerEvent,
|
||||
type OnLoad,
|
||||
} from "./internal/multi-model/browser.js";
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
export {
|
||||
loadTransformers,
|
||||
setTransformers,
|
||||
type LoadTransformerEvent,
|
||||
type OnLoad,
|
||||
} from "./internal/multi-model/non-node.js";
|
||||
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
export {
|
||||
loadTransformers,
|
||||
setTransformers,
|
||||
type LoadTransformerEvent,
|
||||
type OnLoad,
|
||||
} from "./internal/multi-model/node.js";
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
export {
|
||||
loadTransformers,
|
||||
setTransformers,
|
||||
type LoadTransformerEvent,
|
||||
type OnLoad,
|
||||
} from "./internal/multi-model/non-node.js";
|
||||
Vendored
Vendored
-8
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"outputs": ["**/dist/**"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,5 @@
|
||||
# @llamaindex/experimental
|
||||
|
||||
## 0.0.119
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.8.7
|
||||
|
||||
## 0.0.118
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [95a5cc6]
|
||||
- llamaindex@0.8.6
|
||||
|
||||
## 0.0.117
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- Updated dependencies [a6db5dd]
|
||||
- Updated dependencies [396b1e1]
|
||||
- llamaindex@0.8.5
|
||||
|
||||
## 0.0.116
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/experimental",
|
||||
"description": "Experimental package for LlamaIndexTS",
|
||||
"version": "0.0.119",
|
||||
"version": "0.0.116",
|
||||
"type": "module",
|
||||
"types": "dist/type/index.d.ts",
|
||||
"main": "dist/cjs/index.js",
|
||||
|
||||
@@ -1,68 +1,5 @@
|
||||
# llamaindex
|
||||
|
||||
## 0.8.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a8d3fa6]
|
||||
- @llamaindex/env@0.1.18
|
||||
- @llamaindex/cloud@2.0.4
|
||||
- @llamaindex/core@0.4.4
|
||||
- @llamaindex/node-parser@0.0.5
|
||||
- @llamaindex/anthropic@0.0.13
|
||||
- @llamaindex/clip@0.0.13
|
||||
- @llamaindex/deepinfra@0.0.13
|
||||
- @llamaindex/groq@0.0.28
|
||||
- @llamaindex/huggingface@0.0.13
|
||||
- @llamaindex/ollama@0.0.20
|
||||
- @llamaindex/openai@0.1.29
|
||||
- @llamaindex/portkey-ai@0.0.13
|
||||
- @llamaindex/replicate@0.0.13
|
||||
- @llamaindex/readers@1.0.5
|
||||
|
||||
## 0.8.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 95a5cc6: refactor: move storage into core
|
||||
- Updated dependencies [95a5cc6]
|
||||
- @llamaindex/core@0.4.3
|
||||
- @llamaindex/cloud@2.0.3
|
||||
- @llamaindex/node-parser@0.0.4
|
||||
- @llamaindex/anthropic@0.0.12
|
||||
- @llamaindex/clip@0.0.12
|
||||
- @llamaindex/deepinfra@0.0.12
|
||||
- @llamaindex/huggingface@0.0.12
|
||||
- @llamaindex/ollama@0.0.19
|
||||
- @llamaindex/openai@0.1.28
|
||||
- @llamaindex/portkey-ai@0.0.12
|
||||
- @llamaindex/replicate@0.0.12
|
||||
- @llamaindex/readers@1.0.4
|
||||
- @llamaindex/groq@0.0.27
|
||||
|
||||
## 0.8.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 14cc9eb: chore: move multi-model into single sub module
|
||||
- a6db5dd: feat: add baseUrl and timeout option in cohere rerank
|
||||
- 396b1e1: feat: add Azure Cosmos DB DocumentStore, IndexStore, KVStore, update vectorStore and examples
|
||||
- Updated dependencies [14cc9eb]
|
||||
- @llamaindex/env@0.1.17
|
||||
- @llamaindex/clip@0.0.11
|
||||
- @llamaindex/huggingface@0.0.11
|
||||
- @llamaindex/cloud@2.0.2
|
||||
- @llamaindex/core@0.4.2
|
||||
- @llamaindex/node-parser@0.0.3
|
||||
- @llamaindex/anthropic@0.0.11
|
||||
- @llamaindex/deepinfra@0.0.11
|
||||
- @llamaindex/groq@0.0.26
|
||||
- @llamaindex/ollama@0.0.18
|
||||
- @llamaindex/openai@0.1.27
|
||||
- @llamaindex/portkey-ai@0.0.11
|
||||
- @llamaindex/replicate@0.0.11
|
||||
- @llamaindex/readers@1.0.3
|
||||
|
||||
## 0.8.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
-22
@@ -1,27 +1,5 @@
|
||||
# @llamaindex/cloudflare-worker-agent-test
|
||||
|
||||
## 0.0.103
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.8.7
|
||||
|
||||
## 0.0.102
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [95a5cc6]
|
||||
- llamaindex@0.8.6
|
||||
|
||||
## 0.0.101
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- Updated dependencies [a6db5dd]
|
||||
- Updated dependencies [396b1e1]
|
||||
- llamaindex@0.8.5
|
||||
|
||||
## 0.0.100
|
||||
|
||||
### Patch Changes
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/cloudflare-worker-agent-test",
|
||||
"version": "0.0.103",
|
||||
"version": "0.0.100",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
-18
@@ -1,23 +1,5 @@
|
||||
# @llamaindex/llama-parse-browser-test
|
||||
|
||||
## 0.0.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @llamaindex/cloud@2.0.4
|
||||
|
||||
## 0.0.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @llamaindex/cloud@2.0.3
|
||||
|
||||
## 0.0.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @llamaindex/cloud@2.0.2
|
||||
|
||||
## 0.0.21
|
||||
|
||||
### Patch Changes
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/llama-parse-browser-test",
|
||||
"private": true,
|
||||
"version": "0.0.24",
|
||||
"version": "0.0.21",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"extends": "../../../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
@@ -20,7 +20,7 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../packages/cloud/tsconfig.json"
|
||||
"path": "../../../../cloud/tsconfig.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
-22
@@ -1,27 +1,5 @@
|
||||
# @llamaindex/next-agent-test
|
||||
|
||||
## 0.1.103
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.8.7
|
||||
|
||||
## 0.1.102
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [95a5cc6]
|
||||
- llamaindex@0.8.6
|
||||
|
||||
## 0.1.101
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- Updated dependencies [a6db5dd]
|
||||
- Updated dependencies [396b1e1]
|
||||
- llamaindex@0.8.5
|
||||
|
||||
## 0.1.100
|
||||
|
||||
### Patch Changes
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/next-agent-test",
|
||||
"version": "0.1.103",
|
||||
"version": "0.1.100",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 629 B After Width: | Height: | Size: 629 B |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"extends": "../../../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
-22
@@ -1,27 +1,5 @@
|
||||
# test-edge-runtime
|
||||
|
||||
## 0.1.102
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.8.7
|
||||
|
||||
## 0.1.101
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [95a5cc6]
|
||||
- llamaindex@0.8.6
|
||||
|
||||
## 0.1.100
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14cc9eb]
|
||||
- Updated dependencies [a6db5dd]
|
||||
- Updated dependencies [396b1e1]
|
||||
- llamaindex@0.8.5
|
||||
|
||||
## 0.1.99
|
||||
|
||||
### Patch Changes
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user