mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-15 06:52:45 -04:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b2e1df94db | |||
| b4963cabc8 | |||
| 2851024340 | |||
| 7f25a25729 | |||
| acfe23265a | |||
| 2c6fbbd7dd | |||
| f84507f513 | |||
| be6a9e4a48 | |||
| 69e7634619 | |||
| d18748aba4 | |||
| 27c4ef3410 | |||
| a7ee392d3e | |||
| 4415a6fdef | |||
| 1e1e6e96a1 | |||
| 461d1dfbcc | |||
| 5975fafefb | |||
| 71169fd545 | |||
| be895d564d | |||
| f36a27c218 | |||
| 63daf77412 | |||
| df5cbe30a6 | |||
| 9e1a536778 | |||
| a1db8833ef | |||
| 95dd0e0158 | |||
| 2377d1a466 |
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"create-llama": patch
|
||||
---
|
||||
|
||||
Fix Next deployment (thanks @seldo and @marcusschiesser)
|
||||
@@ -0,0 +1,34 @@
|
||||
/* eslint-disable turbo/no-undeclared-env-vars */
|
||||
import * as dotenv from "dotenv";
|
||||
import * as fs from "fs";
|
||||
import { MongoClient } from "mongodb";
|
||||
|
||||
// Load environment variables from local .env file
|
||||
dotenv.config();
|
||||
|
||||
const jsonFile = "tinytweets.json";
|
||||
const mongoUri = process.env.MONGODB_URI!;
|
||||
const databaseName = process.env.MONGODB_DATABASE!;
|
||||
const collectionName = process.env.MONGODB_COLLECTION!;
|
||||
|
||||
async function importJsonToMongo() {
|
||||
// Load the tweets from a local file
|
||||
const tweets = JSON.parse(fs.readFileSync(jsonFile, "utf-8"));
|
||||
|
||||
// Create a new client and connect to the server
|
||||
const client = new MongoClient(mongoUri);
|
||||
|
||||
const db = client.db(databaseName);
|
||||
const collection = db.collection(collectionName);
|
||||
|
||||
// Insert the tweets into mongo
|
||||
await collection.insertMany(tweets);
|
||||
|
||||
console.log(
|
||||
`Data imported successfully to the MongoDB collection ${collectionName}.`,
|
||||
);
|
||||
await client.close();
|
||||
}
|
||||
|
||||
// Run the import function
|
||||
importJsonToMongo();
|
||||
@@ -0,0 +1,50 @@
|
||||
/* eslint-disable turbo/no-undeclared-env-vars */
|
||||
import * as dotenv from "dotenv";
|
||||
import {
|
||||
MongoDBAtlasVectorSearch,
|
||||
SimpleMongoReader,
|
||||
VectorStoreIndex,
|
||||
storageContextFromDefaults,
|
||||
} from "llamaindex";
|
||||
import { MongoClient } from "mongodb";
|
||||
|
||||
// Load environment variables from local .env file
|
||||
dotenv.config();
|
||||
|
||||
const mongoUri = process.env.MONGODB_URI!;
|
||||
const databaseName = process.env.MONGODB_DATABASE!;
|
||||
const collectionName = process.env.MONGODB_COLLECTION!;
|
||||
const vectorCollectionName = process.env.MONGODB_VECTORS!;
|
||||
const indexName = process.env.MONGODB_VECTOR_INDEX!;
|
||||
|
||||
async function loadAndIndex() {
|
||||
// Create a new client and connect to the server
|
||||
const client = new MongoClient(mongoUri);
|
||||
// load objects from mongo and convert them into LlamaIndex Document objects
|
||||
// llamaindex has a special class that does this for you
|
||||
// it pulls every object in a given collection
|
||||
const reader = new SimpleMongoReader(client);
|
||||
const documents = await reader.loadData(databaseName, collectionName, [
|
||||
"full_text",
|
||||
]);
|
||||
|
||||
// create Atlas as a vector store
|
||||
const vectorStore = new MongoDBAtlasVectorSearch({
|
||||
mongodbClient: client,
|
||||
dbName: databaseName,
|
||||
collectionName: vectorCollectionName, // this is where your embeddings will be stored
|
||||
indexName: indexName, // this is the name of the index you will need to create
|
||||
});
|
||||
|
||||
// now create an index from all the Documents and store them in Atlas
|
||||
const storageContext = await storageContextFromDefaults({ vectorStore });
|
||||
await VectorStoreIndex.fromDocuments(documents, { storageContext });
|
||||
console.log(
|
||||
`Successfully created embeddings in the MongoDB collection ${vectorCollectionName}.`,
|
||||
);
|
||||
await client.close();
|
||||
}
|
||||
|
||||
loadAndIndex();
|
||||
|
||||
// you can't query your index yet because you need to create a vector search index in mongodb's UI now
|
||||
@@ -0,0 +1,34 @@
|
||||
/* eslint-disable turbo/no-undeclared-env-vars */
|
||||
import * as dotenv from "dotenv";
|
||||
import {
|
||||
MongoDBAtlasVectorSearch,
|
||||
VectorStoreIndex,
|
||||
serviceContextFromDefaults,
|
||||
} from "llamaindex";
|
||||
import { MongoClient } from "mongodb";
|
||||
|
||||
// Load environment variables from local .env file
|
||||
dotenv.config();
|
||||
|
||||
async function query() {
|
||||
const client = new MongoClient(process.env.MONGODB_URI!);
|
||||
const serviceContext = serviceContextFromDefaults();
|
||||
const store = new MongoDBAtlasVectorSearch({
|
||||
mongodbClient: client,
|
||||
dbName: process.env.MONGODB_DATABASE!,
|
||||
collectionName: process.env.MONGODB_VECTORS!,
|
||||
indexName: process.env.MONGODB_VECTOR_INDEX!,
|
||||
});
|
||||
|
||||
const index = await VectorStoreIndex.fromVectorStore(store, serviceContext);
|
||||
|
||||
const retriever = index.asRetriever({ similarityTopK: 20 });
|
||||
const queryEngine = index.asQueryEngine({ retriever });
|
||||
const result = await queryEngine.query(
|
||||
"What does the author think of web frameworks?",
|
||||
);
|
||||
console.log(result.response);
|
||||
await client.close();
|
||||
}
|
||||
|
||||
query();
|
||||
@@ -0,0 +1,127 @@
|
||||
# LlamaIndexTS retrieval augmented generation with MongoDB
|
||||
|
||||
### Prepare Environment
|
||||
|
||||
Make sure to run `pnpm install` and set your OpenAI environment variable before running these examples.
|
||||
|
||||
```
|
||||
pnpm install
|
||||
export OPENAI_API_KEY="sk-..."
|
||||
```
|
||||
|
||||
### Sign up for MongoDB Atlas
|
||||
|
||||
We'll be using MongoDB's hosted database service, [MongoDB Atlas](https://www.mongodb.com/cloud/atlas/register). You can sign up for free and get a small hosted cluster for free:
|
||||
|
||||

|
||||
|
||||
The signup process will walk you through the process of creating your cluster and ensuring it's configured for you to access. Once the cluster is created, choose "Connect" and then "Connect to your application". Choose Python, and you'll be presented with a connection string that looks like this:
|
||||
|
||||

|
||||
|
||||
### Set up environment variables
|
||||
|
||||
Copy the connection string (make sure you include your password) and put it into a file called `.env` in the root of this repo. It should look like this:
|
||||
|
||||
```
|
||||
MONGODB_URI=mongodb+srv://seldo:xxxxxxxxxxx@llamaindexdemocluster.xfrdhpz.mongodb.net/?retryWrites=true&w=majority
|
||||
```
|
||||
|
||||
You will also need to choose a name for your database, and the collection where we will store the tweets, and also include them in .env. They can be any string, but this is what we used:
|
||||
|
||||
```
|
||||
MONGODB_DATABASE=tiny_tweets_db
|
||||
MONGODB_COLLECTION=tiny_tweets_collection
|
||||
```
|
||||
|
||||
### Import tweets into MongoDB
|
||||
|
||||
You are now ready to import our ready-made data set into Mongo. This is the file `tinytweets.json`, a selection of approximately 1000 tweets from @seldo on Twitter in mid-2019. With your environment set up you can do this by running
|
||||
|
||||
```
|
||||
pnpm ts-node 1_import.ts
|
||||
```
|
||||
|
||||
If you don't want to use tweets, you can replace `json_file` with any other array of JSON objects, but you will need to modify some code later to make sure the correct field gets indexed. There is no LlamaIndex-specific code here; you can load your data into Mongo any way you want to.
|
||||
|
||||
### Load and index your data
|
||||
|
||||
Now we're ready to index our data. To do this, LlamaIndex will pull your text out of Mongo, split it into chunks, and then send those chunks to OpenAI to be turned into [vector embeddings](https://docs.llamaindex.ai/en/stable/understanding/indexing/indexing.html#what-is-an-embedding). The embeddings will then be stored in a new collection in Mongo. This will take a while depending how much text you have, but the good news is that once it's done you will be able to query quickly without needing to re-index.
|
||||
|
||||
We'll be using OpenAI to do the embedding, so now is when you need to [generate an OpenAI API key](https://platform.openai.com/account/api-keys) if you haven't already and add it to your `.env` file like this:
|
||||
|
||||
```
|
||||
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
```
|
||||
|
||||
You'll also need to pick a name for the new collection where the embeddings will be stored, and add it to `.env`, along with the name of a vector search index (we'll be creating this in the next step, after you've indexed your data):
|
||||
|
||||
```
|
||||
MONGODB_VECTORS=tiny_tweets_vectors
|
||||
MONGODB_VECTOR_INDEX=tiny_tweets_vector_index
|
||||
```
|
||||
|
||||
If the data you're indexing is the tweets we gave you, you're ready to go:
|
||||
|
||||
```bash
|
||||
pnpm ts-node 2_load_and_index.ts
|
||||
```
|
||||
|
||||
> Note: this script is running a couple of minutes and currently doesn't show any progress.
|
||||
|
||||
What you're doing here is creating a Reader which loads the data out of Mongo in the collection and database specified. It looks for text in a set of specific keys in each object. In this case we've given it just one key, "full_text".
|
||||
|
||||
Now you're creating a vector search client for Mongo. In addition to a MongoDB client object, you again tell it what database everything is in. This time you give it the name of the collection where you'll store the vector embeddings, and the name of the vector search index you'll create in the next step.
|
||||
|
||||
### Create a vector search index
|
||||
|
||||
Now if all has gone well you should be able to log in to the Mongo Atlas UI and see two collections in your database: the original data in `tiny_tweets_collection`, and the vector embeddings in `tiny_tweets_vectors`.
|
||||
|
||||

|
||||
|
||||
Now it's time to create the vector search index so that you can query the data.
|
||||
It's not yet possible to programmatically create a vector search index using the [`createIndex`](https://www.mongodb.com/docs/manual/reference/method/db.collection.createIndex/) function, therefore we have to create one manually in the UI.
|
||||
To do so, first, click the Search tab, and then click "Create Search Index":
|
||||
|
||||

|
||||
|
||||
We have to use the JSON editor, as the Visual Editor does not yet support to create a vector search index:
|
||||
|
||||

|
||||
|
||||
Now under "database and collection" select `tiny_tweets_db` and within that select `tiny_tweets_vectors`. Then under "Index name" enter `tiny_tweets_vector_index` (or whatever value you put for MONGODB_VECTOR_INDEX in `.env`). Under that, you'll want to enter this JSON object:
|
||||
|
||||
```json
|
||||
{
|
||||
"mappings": {
|
||||
"dynamic": true,
|
||||
"fields": {
|
||||
"embedding": {
|
||||
"dimensions": 1536,
|
||||
"similarity": "cosine",
|
||||
"type": "knnVector"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This tells Mongo that the `embedding` field in each document (in the `tiny_tweets_vectors` collection) is a vector of 1536 dimensions (this is the size of embeddings used by OpenAI), and that we want to use cosine similarity to compare vectors. You don't need to worry too much about these values unless you want to use a different LLM to OpenAI entirely.
|
||||
|
||||
The UI will ask you to review and confirm your choices, then you need to wait a minute or two while it generates the index. If all goes well, you should see something like this screen:
|
||||
|
||||

|
||||
|
||||
Now you're ready to query your data!
|
||||
|
||||
### Run a test query
|
||||
|
||||
You can do this by running
|
||||
|
||||
```bash
|
||||
pnpm ts-node 3_query.ts
|
||||
```
|
||||
|
||||
This sets up a connection to Atlas just like `2_load_and_index.ts` did, then it creates a [query engine](https://docs.llamaindex.ai/en/stable/understanding/querying/querying.html#getting-started) and runs a query against it.
|
||||
|
||||
If all is well, you should get a nuanced opinion about web frameworks.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 141 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 107 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 360 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 230 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 278 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 211 KiB |
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"name": "mongodb-llamaindexts",
|
||||
"dependencies": {
|
||||
"llamaindex": "workspace:*",
|
||||
"dotenv": "^16.3.1",
|
||||
"mongodb": "^6.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.18.6",
|
||||
"ts-node": "^10.9.1"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint ."
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
||||
"dependencies": {
|
||||
"@anthropic-ai/sdk": "^0.9.0",
|
||||
"@notionhq/client": "^2.2.13",
|
||||
"crypto-js": "^4.2.0",
|
||||
"js-tiktoken": "^1.0.7",
|
||||
"lodash": "^4.17.21",
|
||||
"mammoth": "^1.6.0",
|
||||
@@ -22,6 +23,7 @@
|
||||
"wink-nlp": "^1.14.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/crypto-js": "^4.2.1",
|
||||
"@types/lodash": "^4.14.200",
|
||||
"@types/node": "^18.18.8",
|
||||
"@types/papaparse": "^5.3.10",
|
||||
@@ -44,4 +46,4 @@
|
||||
"build": "tsup src/index.ts --format esm,cjs --dts",
|
||||
"dev": "tsup src/index.ts --format esm,cjs --dts --watch"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import crypto from "crypto"; // TODO Node dependency
|
||||
import CryptoJS from "crypto-js";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
export enum NodeRelationship {
|
||||
@@ -175,13 +175,13 @@ export class TextNode<T extends Metadata = Metadata> extends BaseNode<T> {
|
||||
* @returns
|
||||
*/
|
||||
generateHash() {
|
||||
const hashFunction = crypto.createHash("sha256");
|
||||
const hashFunction = CryptoJS.algo.SHA256.create();
|
||||
hashFunction.update(`type=${this.getType()}`);
|
||||
hashFunction.update(
|
||||
`startCharIdx=${this.startCharIdx} endCharIdx=${this.endCharIdx}`,
|
||||
);
|
||||
hashFunction.update(this.getContent(MetadataMode.ALL));
|
||||
return hashFunction.digest("base64");
|
||||
return hashFunction.finalize().toString(CryptoJS.enc.Base64);
|
||||
}
|
||||
|
||||
getType(): ObjectType {
|
||||
@@ -272,12 +272,13 @@ export class Document<T extends Metadata = Metadata> extends TextNode<T> {
|
||||
}
|
||||
}
|
||||
|
||||
export function jsonToNode(json: any) {
|
||||
if (!json.type) {
|
||||
export function jsonToNode(json: any, type?: ObjectType) {
|
||||
if (!json.type && !type) {
|
||||
throw new Error("Node type not found");
|
||||
}
|
||||
const nodeType = type || json.type;
|
||||
|
||||
switch (json.type) {
|
||||
switch (nodeType) {
|
||||
case ObjectType.TEXT:
|
||||
return new TextNode(json);
|
||||
case ObjectType.INDEX:
|
||||
@@ -285,7 +286,7 @@ export function jsonToNode(json: any) {
|
||||
case ObjectType.DOCUMENT:
|
||||
return new Document(json);
|
||||
default:
|
||||
throw new Error(`Invalid node type: ${json.type}`);
|
||||
throw new Error(`Invalid node type: ${nodeType}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,5 +25,6 @@ export * from "./readers/MarkdownReader";
|
||||
export * from "./readers/NotionReader";
|
||||
export * from "./readers/PDFReader";
|
||||
export * from "./readers/SimpleDirectoryReader";
|
||||
export * from "./readers/SimpleMongoReader";
|
||||
export * from "./readers/base";
|
||||
export * from "./storage";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MongoClient } from "mongodb";
|
||||
import { Document } from "../Node";
|
||||
import { Document, Metadata } from "../Node";
|
||||
import { BaseReader } from "./base";
|
||||
|
||||
/**
|
||||
@@ -13,39 +13,70 @@ export class SimpleMongoReader implements BaseReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads data from MongoDB collection
|
||||
* @param {string} db_name - The name of the database to load.
|
||||
* @param {string} collection_name - The name of the collection to load.
|
||||
* @param {Number} [max_docs = 0] - Maximum number of documents to return. 0 means no limit.
|
||||
* @param {Record<string, any>} [query_dict={}] - Specific query, as specified by MongoDB NodeJS documentation.
|
||||
* @param {Record<string, any>} [query_options={}] - Specific query options, as specified by MongoDB NodeJS documentation.
|
||||
* @param {Record<string, any>} [projection = {}] - Projection options, as specified by MongoDB NodeJS documentation.
|
||||
* @returns {Promise<Document[]>}
|
||||
* Flattens an array of strings or string arrays into a single-dimensional array of strings.
|
||||
* @param texts - The array of strings or string arrays to flatten.
|
||||
* @returns The flattened array of strings.
|
||||
*/
|
||||
async loadData(
|
||||
db_name: string,
|
||||
collection_name: string,
|
||||
max_docs = 0,
|
||||
//For later: Think about whether we want to pass generic objects in...
|
||||
query_dict: Record<string, any> = {},
|
||||
query_options: Record<string, any> = {},
|
||||
projection: Record<string, any> = {},
|
||||
): Promise<Document[]> {
|
||||
//Get items from collection using built-in functions
|
||||
const cursor: Partial<Document>[] = await this.client
|
||||
.db(db_name)
|
||||
.collection(collection_name)
|
||||
.find(query_dict, query_options)
|
||||
.limit(max_docs)
|
||||
.project(projection)
|
||||
.toArray();
|
||||
private flatten(texts: Array<string | string[]>): string[] {
|
||||
return texts.reduce<string[]>(
|
||||
(result, text) => result.concat(text instanceof Array ? text : [text]),
|
||||
[],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads data from MongoDB collection
|
||||
* @param {string} dbName - The name of the database to load.
|
||||
* @param {string} collectionName - The name of the collection to load.
|
||||
* @param {string[]} fieldNames - An array of field names to retrieve from each document. Defaults to ["text"].
|
||||
* @param {string} separator - The separator to join multiple field values. Defaults to an empty string.
|
||||
* @param {Record<string, any>} filterQuery - Specific query, as specified by MongoDB NodeJS documentation.
|
||||
* @param {Number} maxDocs - The maximum number of documents to retrieve. Defaults to 0 (retrieve all documents).
|
||||
* @param {string[]} metadataNames - An optional array of metadata field names. If specified extracts this information as metadata.
|
||||
* @returns {Promise<Document[]>}
|
||||
* @throws If a field specified in fieldNames or metadataNames is not found in a MongoDB document.
|
||||
*/
|
||||
public async loadData(
|
||||
dbName: string,
|
||||
collectionName: string,
|
||||
fieldNames: string[] = ["text"],
|
||||
separator: string = "",
|
||||
filterQuery: Record<string, any> = {},
|
||||
maxDocs: number = 0,
|
||||
metadataNames?: string[],
|
||||
): Promise<Document[]> {
|
||||
const db = this.client.db(dbName);
|
||||
// Get items from collection
|
||||
const cursor = db
|
||||
.collection(collectionName)
|
||||
.find(filterQuery)
|
||||
.limit(maxDocs);
|
||||
|
||||
//Aggregate results and return
|
||||
const documents: Document[] = [];
|
||||
cursor.forEach((element: Partial<Document>) => {
|
||||
//For later: Metadata filtering
|
||||
documents.push(new Document({ text: JSON.stringify(element) }));
|
||||
});
|
||||
|
||||
for await (const item of cursor) {
|
||||
try {
|
||||
const texts: Array<string | string[]> = fieldNames.map(
|
||||
(name) => item[name],
|
||||
);
|
||||
const flattenedTexts = this.flatten(texts);
|
||||
const text = flattenedTexts.join(separator);
|
||||
|
||||
let metadata: Metadata = {};
|
||||
if (metadataNames) {
|
||||
// extract metadata if fields are specified
|
||||
metadata = Object.fromEntries(
|
||||
metadataNames.map((name) => [name, item[name]]),
|
||||
);
|
||||
}
|
||||
|
||||
documents.push(new Document({ text, metadata }));
|
||||
} catch (err) {
|
||||
throw new Error(
|
||||
`Field not found in Mongo document: ${(err as Error).message}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
return documents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,5 +7,6 @@ export { SimpleIndexStore } from "./indexStore/SimpleIndexStore";
|
||||
export * from "./indexStore/types";
|
||||
export { SimpleKVStore } from "./kvStore/SimpleKVStore";
|
||||
export * from "./kvStore/types";
|
||||
export { MongoDBAtlasVectorSearch } from "./vectorStore/MongoDBAtlasVectorStore";
|
||||
export { SimpleVectorStore } from "./vectorStore/SimpleVectorStore";
|
||||
export * from "./vectorStore/types";
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
import { BulkWriteOptions, Collection, MongoClient } from "mongodb";
|
||||
import { BaseNode, MetadataMode } from "../../Node";
|
||||
import {
|
||||
MetadataFilters,
|
||||
VectorStore,
|
||||
VectorStoreQuery,
|
||||
VectorStoreQueryResult,
|
||||
} from "./types";
|
||||
import { metadataDictToNode, nodeToMetadata } from "./utils";
|
||||
|
||||
// Utility function to convert metadata filters to MongoDB filter
|
||||
function toMongoDBFilter(
|
||||
standardFilters: MetadataFilters,
|
||||
): Record<string, any> {
|
||||
const filters: Record<string, any> = {};
|
||||
for (const filter of standardFilters.filters) {
|
||||
filters[filter.key] = filter.value;
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
|
||||
// MongoDB Atlas Vector Store class implementing VectorStore
|
||||
export class MongoDBAtlasVectorSearch implements VectorStore {
|
||||
storesText: boolean = true;
|
||||
flatMetadata: boolean = true;
|
||||
|
||||
mongodbClient: MongoClient;
|
||||
indexName: string;
|
||||
embeddingKey: string;
|
||||
idKey: string;
|
||||
textKey: string;
|
||||
metadataKey: string;
|
||||
insertOptions?: BulkWriteOptions;
|
||||
private collection: Collection;
|
||||
|
||||
constructor(
|
||||
init: Partial<MongoDBAtlasVectorSearch> & {
|
||||
dbName: string;
|
||||
collectionName: string;
|
||||
},
|
||||
) {
|
||||
if (init.mongodbClient) {
|
||||
this.mongodbClient = init.mongodbClient;
|
||||
} else {
|
||||
const mongoUri = process.env.MONGODB_URI;
|
||||
if (!mongoUri) {
|
||||
throw new Error(
|
||||
"Must specify MONGODB_URI via env variable if not directly passing in client.",
|
||||
);
|
||||
}
|
||||
this.mongodbClient = new MongoClient(mongoUri);
|
||||
}
|
||||
|
||||
this.collection = this.mongodbClient
|
||||
.db(init.dbName ?? "default_db")
|
||||
.collection(init.collectionName ?? "default_collection");
|
||||
this.indexName = init.indexName ?? "default";
|
||||
this.embeddingKey = init.embeddingKey ?? "embedding";
|
||||
this.idKey = init.idKey ?? "id";
|
||||
this.textKey = init.textKey ?? "text";
|
||||
this.metadataKey = init.metadataKey ?? "metadata";
|
||||
this.insertOptions = init.insertOptions;
|
||||
}
|
||||
|
||||
async add(nodes: BaseNode[]): Promise<string[]> {
|
||||
if (!nodes || nodes.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const dataToInsert = nodes.map((node) => {
|
||||
const metadata = nodeToMetadata(
|
||||
node,
|
||||
true,
|
||||
this.textKey,
|
||||
this.flatMetadata,
|
||||
);
|
||||
|
||||
return {
|
||||
[this.idKey]: node.id_,
|
||||
[this.embeddingKey]: node.getEmbedding(),
|
||||
[this.textKey]: node.getContent(MetadataMode.NONE) || "",
|
||||
[this.metadataKey]: metadata,
|
||||
};
|
||||
});
|
||||
|
||||
console.debug("Inserting data into MongoDB: ", dataToInsert);
|
||||
const insertResult = await this.collection.insertMany(
|
||||
dataToInsert,
|
||||
this.insertOptions,
|
||||
);
|
||||
console.debug("Result of insert: ", insertResult);
|
||||
return nodes.map((node) => node.id_);
|
||||
}
|
||||
|
||||
async delete(refDocId: string, deleteOptions?: any): Promise<void> {
|
||||
await this.collection.deleteOne(
|
||||
{
|
||||
[`${this.metadataKey}.ref_doc_id`]: refDocId,
|
||||
},
|
||||
deleteOptions,
|
||||
);
|
||||
}
|
||||
|
||||
get client(): any {
|
||||
return this.mongodbClient;
|
||||
}
|
||||
|
||||
async query(
|
||||
query: VectorStoreQuery,
|
||||
options?: any,
|
||||
): Promise<VectorStoreQueryResult> {
|
||||
const params: any = {
|
||||
queryVector: query.queryEmbedding,
|
||||
path: this.embeddingKey,
|
||||
numCandidates: query.similarityTopK * 10,
|
||||
limit: query.similarityTopK,
|
||||
index: this.indexName,
|
||||
};
|
||||
|
||||
if (query.filters) {
|
||||
params.filter = toMongoDBFilter(query.filters);
|
||||
}
|
||||
|
||||
const queryField = { $vectorSearch: params };
|
||||
const pipeline = [
|
||||
queryField,
|
||||
{
|
||||
$project: {
|
||||
score: { $meta: "vectorSearchScore" },
|
||||
[this.embeddingKey]: 0,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
console.debug("Running query pipeline: ", pipeline);
|
||||
const cursor = await this.collection.aggregate(pipeline);
|
||||
|
||||
const nodes: BaseNode[] = [];
|
||||
const ids: string[] = [];
|
||||
const similarities: number[] = [];
|
||||
|
||||
for await (const res of await cursor) {
|
||||
const text = res[this.textKey];
|
||||
const score = res.score;
|
||||
const id = res[this.idKey];
|
||||
const metadata = res[this.metadataKey];
|
||||
|
||||
const node = metadataDictToNode(metadata);
|
||||
node.setContent(text);
|
||||
|
||||
ids.push(id);
|
||||
nodes.push(node);
|
||||
similarities.push(score);
|
||||
}
|
||||
|
||||
const result = {
|
||||
nodes,
|
||||
similarities,
|
||||
ids,
|
||||
};
|
||||
|
||||
console.debug("Result of query (ids):", ids);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import { BaseNode } from "../../Node";
|
||||
import { GenericFileSystem } from "../FileSystem";
|
||||
|
||||
export interface VectorStoreQueryResult {
|
||||
nodes?: BaseNode[];
|
||||
@@ -62,10 +61,9 @@ export interface VectorStore {
|
||||
isEmbeddingQuery?: boolean;
|
||||
client(): any;
|
||||
add(embeddingResults: BaseNode[]): Promise<string[]>;
|
||||
delete(refDocId: string, deleteKwargs?: any): Promise<void>;
|
||||
delete(refDocId: string, deleteOptions?: any): Promise<void>;
|
||||
query(
|
||||
query: VectorStoreQuery,
|
||||
options?: any,
|
||||
): Promise<VectorStoreQueryResult>;
|
||||
persist(persistPath: string, fs?: GenericFileSystem): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import { BaseNode, Metadata, ObjectType, jsonToNode } from "../../Node";
|
||||
|
||||
const DEFAULT_TEXT_KEY = "text";
|
||||
|
||||
export function validateIsFlat(obj: { [key: string]: any }): void {
|
||||
for (let key in obj) {
|
||||
if (typeof obj[key] === "object" && obj[key] !== null) {
|
||||
throw new Error(`Value for metadata ${key} must not be another object`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function nodeToMetadata(
|
||||
node: BaseNode,
|
||||
removeText: boolean = false,
|
||||
textField: string = DEFAULT_TEXT_KEY,
|
||||
flatMetadata: boolean = false,
|
||||
): Metadata {
|
||||
const nodeObj = node.toJSON();
|
||||
const metadata = node.metadata;
|
||||
|
||||
if (flatMetadata) {
|
||||
validateIsFlat(node.metadata);
|
||||
}
|
||||
|
||||
if (removeText) {
|
||||
nodeObj[textField] = "";
|
||||
}
|
||||
|
||||
nodeObj["embedding"] = null;
|
||||
|
||||
metadata["_node_content"] = JSON.stringify(nodeObj);
|
||||
metadata["_node_type"] = node.constructor.name.replace("_", ""); // remove leading underscore to be compatible with Python
|
||||
|
||||
metadata["document_id"] = node.sourceNode?.nodeId || "None";
|
||||
metadata["doc_id"] = node.sourceNode?.nodeId || "None";
|
||||
metadata["ref_doc_id"] = node.sourceNode?.nodeId || "None";
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
export function metadataDictToNode(metadata: Metadata): BaseNode {
|
||||
const nodeContent = metadata["_node_content"];
|
||||
if (!nodeContent) {
|
||||
throw new Error("Node content not found in metadata.");
|
||||
}
|
||||
const nodeObj = JSON.parse(nodeContent);
|
||||
|
||||
// Note: we're using the name of the class stored in `_node_type`
|
||||
// and not the type attribute to reconstruct
|
||||
// the node. This way we're compatible with LlamaIndex Python
|
||||
const node_type = metadata["_node_type"];
|
||||
switch (node_type) {
|
||||
case "IndexNode":
|
||||
return jsonToNode(nodeObj, ObjectType.INDEX);
|
||||
default:
|
||||
return jsonToNode(nodeObj, ObjectType.TEXT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { TextNode } from "../Node";
|
||||
|
||||
describe("TextNode", () => {
|
||||
let node: TextNode;
|
||||
|
||||
beforeEach(() => {
|
||||
node = new TextNode({ text: "Hello World" });
|
||||
});
|
||||
|
||||
describe("generateHash", () => {
|
||||
it("should generate a hash", () => {
|
||||
expect(node.hash).toBe("nTSKdUTYqR52MPv/brvb4RTGeqedTEqG9QN8KSAj2Do=");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,17 @@
|
||||
# create-llama
|
||||
|
||||
## 0.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- acfe232: Deployment fixes (thanks @seldo)
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 8cdb07f: Fix Next deployment (thanks @seldo and @marcusschiesser)
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -88,7 +88,7 @@ export async function createApp({
|
||||
path.join(root, "README.md"),
|
||||
);
|
||||
} else {
|
||||
await installTemplate({ ...args, backend: true });
|
||||
await installTemplate({ ...args, backend: true, forBackend: framework });
|
||||
}
|
||||
|
||||
process.chdir(root);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "create-llama",
|
||||
"version": "0.0.7",
|
||||
"version": "0.0.9",
|
||||
"keywords": [
|
||||
"rag",
|
||||
"llamaindex",
|
||||
|
||||
@@ -103,6 +103,7 @@ const installTSTemplate = async ({
|
||||
ui,
|
||||
eslint,
|
||||
customApiPath,
|
||||
forBackend,
|
||||
}: InstallTemplateArgs) => {
|
||||
console.log(bold(`Using ${packageManager}.`));
|
||||
|
||||
@@ -120,6 +121,26 @@ const installTSTemplate = async ({
|
||||
rename,
|
||||
});
|
||||
|
||||
/**
|
||||
* If the backend is next.js, rename next.config.app.js to next.config.js
|
||||
* If not, rename next.config.static.js to next.config.js
|
||||
*/
|
||||
if (framework == "nextjs" && forBackend === "nextjs") {
|
||||
const nextConfigAppPath = path.join(root, "next.config.app.js");
|
||||
const nextConfigPath = path.join(root, "next.config.js");
|
||||
await fs.rename(nextConfigAppPath, nextConfigPath);
|
||||
// delete next.config.static.js
|
||||
const nextConfigStaticPath = path.join(root, "next.config.static.js");
|
||||
await fs.rm(nextConfigStaticPath);
|
||||
} else if (framework == "nextjs" && typeof forBackend === "undefined") {
|
||||
const nextConfigStaticPath = path.join(root, "next.config.static.js");
|
||||
const nextConfigPath = path.join(root, "next.config.js");
|
||||
await fs.rename(nextConfigStaticPath, nextConfigPath);
|
||||
// delete next.config.app.js
|
||||
const nextConfigAppPath = path.join(root, "next.config.app.js");
|
||||
await fs.rm(nextConfigAppPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the selected chat engine files to the target directory and reference it.
|
||||
*/
|
||||
|
||||
@@ -17,4 +17,5 @@ export interface InstallTemplateArgs {
|
||||
eslint: boolean;
|
||||
customApiPath?: string;
|
||||
openAIKey?: string;
|
||||
forBackend?: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# local env files
|
||||
.env
|
||||
@@ -8,12 +8,24 @@ const port = 8000;
|
||||
|
||||
const env = process.env["NODE_ENV"];
|
||||
const isDevelopment = !env || env === "development";
|
||||
const prodCorsOrigin = process.env["PROD_CORS_ORIGIN"];
|
||||
|
||||
if (isDevelopment) {
|
||||
console.warn("Running in development mode - allowing CORS for all origins");
|
||||
app.use(cors());
|
||||
} else if (prodCorsOrigin) {
|
||||
console.log(
|
||||
`Running in production mode - allowing CORS for domain: ${prodCorsOrigin}`,
|
||||
);
|
||||
const corsOptions = {
|
||||
origin: prodCorsOrigin, // Restrict to production domain
|
||||
};
|
||||
app.use(cors(corsOptions));
|
||||
} else {
|
||||
console.warn("Production CORS origin not set, defaulting to no CORS.");
|
||||
}
|
||||
|
||||
app.use(express.json());
|
||||
app.use(express.text());
|
||||
|
||||
app.get("/", (req: Request, res: Response) => {
|
||||
res.send("LlamaIndex Express Server");
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { createChatEngine } from "./engine";
|
||||
|
||||
export const chat = async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
const { messages }: { messages: ChatMessage[] } = req.body;
|
||||
const { messages }: { messages: ChatMessage[] } = JSON.parse(req.body);
|
||||
const lastMessage = messages.pop();
|
||||
if (!messages || !lastMessage || lastMessage.role !== "user") {
|
||||
return res.status(400).json({
|
||||
|
||||
@@ -15,9 +15,10 @@ STORAGE_DIR = "./storage" # directory to cache the generated index
|
||||
DATA_DIR = "./data" # directory containing the documents to index
|
||||
|
||||
service_context = ServiceContext.from_defaults(
|
||||
llm=OpenAI("gpt-3.5-turbo")
|
||||
llm=OpenAI(model="gpt-3.5-turbo")
|
||||
)
|
||||
|
||||
|
||||
def get_index():
|
||||
logger = logging.getLogger("uvicorn")
|
||||
# check if storage already exists
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
__pycache__
|
||||
storage
|
||||
.env
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
import logging
|
||||
import os
|
||||
import uvicorn
|
||||
from app.api.routers.chat import chat_router
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: "export",
|
||||
images: { unoptimized: true },
|
||||
experimental: {
|
||||
serverComponentsExternalPackages: ["llamaindex"],
|
||||
outputFileTracingIncludes: {
|
||||
"/*": ["./cache/**/*"],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
@@ -0,0 +1,2 @@
|
||||
# local env files
|
||||
.env
|
||||
@@ -8,12 +8,24 @@ const port = 8000;
|
||||
|
||||
const env = process.env["NODE_ENV"];
|
||||
const isDevelopment = !env || env === "development";
|
||||
const prodCorsOrigin = process.env["PROD_CORS_ORIGIN"];
|
||||
|
||||
if (isDevelopment) {
|
||||
console.warn("Running in development mode - allowing CORS for all origins");
|
||||
app.use(cors());
|
||||
} else if (prodCorsOrigin) {
|
||||
console.log(
|
||||
`Running in production mode - allowing CORS for domain: ${prodCorsOrigin}`,
|
||||
);
|
||||
const corsOptions = {
|
||||
origin: prodCorsOrigin, // Restrict to production domain
|
||||
};
|
||||
app.use(cors(corsOptions));
|
||||
} else {
|
||||
console.warn("Production CORS origin not set, defaulting to no CORS.");
|
||||
}
|
||||
|
||||
app.use(express.json());
|
||||
app.use(express.text());
|
||||
|
||||
app.get("/", (req: Request, res: Response) => {
|
||||
res.send("LlamaIndex Express Server");
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import { LlamaIndexStream } from "./llamaindex-stream";
|
||||
|
||||
export const chat = async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
const { messages }: { messages: ChatMessage[] } = req.body;
|
||||
const { messages }: { messages: ChatMessage[] } = JSON.parse(req.body);
|
||||
const lastMessage = messages.pop();
|
||||
if (!messages || !lastMessage || lastMessage.role !== "user") {
|
||||
return res.status(400).json({
|
||||
|
||||
@@ -15,7 +15,7 @@ STORAGE_DIR = "./storage" # directory to cache the generated index
|
||||
DATA_DIR = "./data" # directory containing the documents to index
|
||||
|
||||
service_context = ServiceContext.from_defaults(
|
||||
llm=OpenAI("gpt-3.5-turbo")
|
||||
llm=OpenAI(model="gpt-3.5-turbo")
|
||||
)
|
||||
|
||||
def get_index():
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
__pycache__
|
||||
storage
|
||||
.env
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
import logging
|
||||
import os
|
||||
import uvicorn
|
||||
from app.api.routers.chat import chat_router
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: "export",
|
||||
images: { unoptimized: true },
|
||||
experimental: {
|
||||
serverComponentsExternalPackages: ["llamaindex"],
|
||||
outputFileTracingIncludes: {
|
||||
"/*": ["./cache/**/*"],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
Generated
+77
-46
@@ -17,7 +17,7 @@ importers:
|
||||
version: 2.26.2
|
||||
'@turbo/gen':
|
||||
specifier: ^1.10.16
|
||||
version: 1.10.16(@types/node@20.9.0)(typescript@5.2.2)
|
||||
version: 1.10.16(@types/node@18.18.8)(typescript@5.2.2)
|
||||
'@types/jest':
|
||||
specifier: ^29.5.8
|
||||
version: 29.5.8
|
||||
@@ -32,7 +32,7 @@ importers:
|
||||
version: 8.0.3
|
||||
jest:
|
||||
specifier: ^29.7.0
|
||||
version: 29.7.0(@types/node@20.9.0)
|
||||
version: 29.7.0(@types/node@18.18.8)
|
||||
lint-staged:
|
||||
specifier: ^15.1.0
|
||||
version: 15.1.0
|
||||
@@ -104,6 +104,25 @@ importers:
|
||||
specifier: ^4.9.5
|
||||
version: 4.9.5
|
||||
|
||||
apps/mongodb:
|
||||
dependencies:
|
||||
dotenv:
|
||||
specifier: ^16.3.1
|
||||
version: 16.3.1
|
||||
llamaindex:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/core
|
||||
mongodb:
|
||||
specifier: ^6.2.0
|
||||
version: 6.2.0
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: ^18.18.6
|
||||
version: 18.18.8
|
||||
ts-node:
|
||||
specifier: ^10.9.1
|
||||
version: 10.9.1(@types/node@18.18.8)(typescript@5.2.2)
|
||||
|
||||
apps/simple:
|
||||
dependencies:
|
||||
'@notionhq/client':
|
||||
@@ -134,6 +153,9 @@ importers:
|
||||
'@notionhq/client':
|
||||
specifier: ^2.2.13
|
||||
version: 2.2.13
|
||||
crypto-js:
|
||||
specifier: ^4.2.0
|
||||
version: 4.2.0
|
||||
js-tiktoken:
|
||||
specifier: ^1.0.7
|
||||
version: 1.0.7
|
||||
@@ -180,6 +202,9 @@ importers:
|
||||
specifier: ^1.14.3
|
||||
version: 1.14.3
|
||||
devDependencies:
|
||||
'@types/crypto-js':
|
||||
specifier: ^4.2.1
|
||||
version: 4.2.1
|
||||
'@types/lodash':
|
||||
specifier: ^4.14.200
|
||||
version: 4.14.200
|
||||
@@ -444,7 +469,7 @@ packages:
|
||||
engines: {node: '>=6.0.0'}
|
||||
dependencies:
|
||||
'@jridgewell/gen-mapping': 0.3.3
|
||||
'@jridgewell/trace-mapping': 0.3.19
|
||||
'@jridgewell/trace-mapping': 0.3.20
|
||||
|
||||
/@anthropic-ai/sdk@0.9.0:
|
||||
resolution: {integrity: sha512-qNoNld9luBWNcmCFTIZrsmusCQIdxIxQXyHJ64IDUsrvPvy2lM0kA9+E6bHeeFut463zdGkVz0Ux0U+WDppLGg==}
|
||||
@@ -549,7 +574,7 @@ packages:
|
||||
dependencies:
|
||||
'@babel/types': 7.23.0
|
||||
'@jridgewell/gen-mapping': 0.3.3
|
||||
'@jridgewell/trace-mapping': 0.3.19
|
||||
'@jridgewell/trace-mapping': 0.3.20
|
||||
jsesc: 2.5.2
|
||||
|
||||
/@babel/generator@7.23.3:
|
||||
@@ -3366,14 +3391,14 @@ packages:
|
||||
'@jest/test-result': 29.7.0
|
||||
'@jest/transform': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 20.9.0
|
||||
'@types/node': 18.18.8
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.9.0
|
||||
exit: 0.1.2
|
||||
graceful-fs: 4.2.11
|
||||
jest-changed-files: 29.7.0
|
||||
jest-config: 29.7.0(@types/node@20.9.0)
|
||||
jest-config: 29.7.0(@types/node@18.18.8)
|
||||
jest-haste-map: 29.7.0
|
||||
jest-message-util: 29.7.0
|
||||
jest-regex-util: 29.6.3
|
||||
@@ -3548,7 +3573,7 @@ packages:
|
||||
'@jest/schemas': 29.6.3
|
||||
'@types/istanbul-lib-coverage': 2.0.6
|
||||
'@types/istanbul-reports': 3.0.4
|
||||
'@types/node': 20.9.0
|
||||
'@types/node': 18.18.8
|
||||
'@types/yargs': 17.0.31
|
||||
chalk: 4.1.2
|
||||
|
||||
@@ -3572,17 +3597,11 @@ packages:
|
||||
resolution: {integrity: sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==}
|
||||
dependencies:
|
||||
'@jridgewell/gen-mapping': 0.3.3
|
||||
'@jridgewell/trace-mapping': 0.3.19
|
||||
'@jridgewell/trace-mapping': 0.3.20
|
||||
|
||||
/@jridgewell/sourcemap-codec@1.4.15:
|
||||
resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==}
|
||||
|
||||
/@jridgewell/trace-mapping@0.3.19:
|
||||
resolution: {integrity: sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==}
|
||||
dependencies:
|
||||
'@jridgewell/resolve-uri': 3.1.1
|
||||
'@jridgewell/sourcemap-codec': 1.4.15
|
||||
|
||||
/@jridgewell/trace-mapping@0.3.20:
|
||||
resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==}
|
||||
dependencies:
|
||||
@@ -3789,7 +3808,7 @@ packages:
|
||||
dependencies:
|
||||
'@edge-runtime/types': 2.2.4
|
||||
'@sinclair/typebox': 0.29.6
|
||||
'@types/node': 18.18.7
|
||||
'@types/node': 18.18.8
|
||||
ajv: 8.12.0
|
||||
cross-fetch: 3.1.8(encoding@0.1.13)
|
||||
encoding: 0.1.13
|
||||
@@ -4067,7 +4086,7 @@ packages:
|
||||
resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==}
|
||||
dev: true
|
||||
|
||||
/@turbo/gen@1.10.16(@types/node@20.9.0)(typescript@5.2.2):
|
||||
/@turbo/gen@1.10.16(@types/node@18.18.8)(typescript@5.2.2):
|
||||
resolution: {integrity: sha512-PzyluADjVuy5OcIi+/aRcD70OElQpRVRDdfZ9fH8G5Fv75lQcNrjd1bBGKmhjSw+g+eTEkXMGnY7s6gsCYjYTQ==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
@@ -4079,7 +4098,7 @@ packages:
|
||||
minimatch: 9.0.3
|
||||
node-plop: 0.26.3
|
||||
proxy-agent: 6.3.1
|
||||
ts-node: 10.9.1(@types/node@20.9.0)(typescript@5.2.2)
|
||||
ts-node: 10.9.1(@types/node@18.18.8)(typescript@5.2.2)
|
||||
update-check: 1.5.4
|
||||
validate-npm-package-name: 5.0.0
|
||||
transitivePeerDependencies:
|
||||
@@ -4185,7 +4204,11 @@ packages:
|
||||
/@types/cross-spawn@6.0.0:
|
||||
resolution: {integrity: sha512-evp2ZGsFw9YKprDbg8ySgC9NA15g3YgiI8ANkGmKKvvi0P2aDGYLPxQIC5qfeKNUOe3TjABVGuah6omPRpIYhg==}
|
||||
dependencies:
|
||||
'@types/node': 20.9.0
|
||||
'@types/node': 18.18.8
|
||||
dev: true
|
||||
|
||||
/@types/crypto-js@4.2.1:
|
||||
resolution: {integrity: sha512-FSPGd9+OcSok3RsM0UZ/9fcvMOXJ1ENE/ZbLfOPlBWj7BgXtEAM8VYfTtT760GiLbQIMoVozwVuisjvsVwqYWw==}
|
||||
dev: true
|
||||
|
||||
/@types/eslint-scope@3.7.5:
|
||||
@@ -4362,7 +4385,7 @@ packages:
|
||||
/@types/node-fetch@2.6.6:
|
||||
resolution: {integrity: sha512-95X8guJYhfqiuVVhRFxVQcf4hW/2bCuoPwDasMf/531STFoNoWTT7YDnWdXHEZKqAGUigmpG31r2FE70LwnzJw==}
|
||||
dependencies:
|
||||
'@types/node': 18.18.7
|
||||
'@types/node': 18.18.8
|
||||
form-data: 4.0.0
|
||||
dev: false
|
||||
|
||||
@@ -4392,6 +4415,7 @@ packages:
|
||||
resolution: {integrity: sha512-bw+lEsxis6eqJYW8Ql6+yTqkE6RuFtsQPSe5JxXbqYRFQEER5aJA9a5UH9igqDWm3X4iLHIKOHlnAXLM4mi7uQ==}
|
||||
dependencies:
|
||||
undici-types: 5.26.5
|
||||
dev: true
|
||||
|
||||
/@types/node@18.18.8:
|
||||
resolution: {integrity: sha512-OLGBaaK5V3VRBS1bAkMVP2/W9B+H8meUfl866OrMNQqt7wDgdpWPp5o6gmIc9pB+lIQHSq4ZL8ypeH1vPxcPaQ==}
|
||||
@@ -4402,6 +4426,7 @@ packages:
|
||||
resolution: {integrity: sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==}
|
||||
dependencies:
|
||||
undici-types: 5.26.5
|
||||
dev: true
|
||||
|
||||
/@types/normalize-package-data@2.4.4:
|
||||
resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==}
|
||||
@@ -4527,7 +4552,7 @@ packages:
|
||||
/@types/tar@6.1.5:
|
||||
resolution: {integrity: sha512-qm2I/RlZij5RofuY7vohTpYNaYcrSQlN2MyjucQc7ZweDwaEWkdN/EeNh6e9zjK6uEm6PwjdMXkcj05BxZdX1Q==}
|
||||
dependencies:
|
||||
'@types/node': 20.9.0
|
||||
'@types/node': 18.18.8
|
||||
minipass: 4.2.8
|
||||
dev: true
|
||||
|
||||
@@ -4790,11 +4815,12 @@ packages:
|
||||
/acorn-walk@8.2.0:
|
||||
resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
dev: true
|
||||
|
||||
/acorn-walk@8.3.0:
|
||||
resolution: {integrity: sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
dev: true
|
||||
dev: false
|
||||
|
||||
/acorn@8.10.0:
|
||||
resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==}
|
||||
@@ -6334,7 +6360,7 @@ packages:
|
||||
sha.js: 2.4.11
|
||||
dev: true
|
||||
|
||||
/create-jest@29.7.0(@types/node@20.9.0):
|
||||
/create-jest@29.7.0(@types/node@18.18.8):
|
||||
resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
hasBin: true
|
||||
@@ -6343,7 +6369,7 @@ packages:
|
||||
chalk: 4.1.2
|
||||
exit: 0.1.2
|
||||
graceful-fs: 4.2.11
|
||||
jest-config: 29.7.0(@types/node@20.9.0)
|
||||
jest-config: 29.7.0(@types/node@18.18.8)
|
||||
jest-util: 29.7.0
|
||||
prompts: 2.4.2
|
||||
transitivePeerDependencies:
|
||||
@@ -6401,6 +6427,10 @@ packages:
|
||||
randomfill: 1.0.4
|
||||
dev: true
|
||||
|
||||
/crypto-js@4.2.0:
|
||||
resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==}
|
||||
dev: false
|
||||
|
||||
/crypto-random-string@2.0.0:
|
||||
resolution: {integrity: sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -7074,6 +7104,11 @@ packages:
|
||||
is-obj: 2.0.0
|
||||
dev: true
|
||||
|
||||
/dotenv@16.3.1:
|
||||
resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/duck@0.1.12:
|
||||
resolution: {integrity: sha512-wkctla1O6VfP89gQ+J/yDesM0S7B7XLXjKGzXxMDVFg7uEn706niAtyYovKbyq1oT9YwDcly721/iUWoc8MVRg==}
|
||||
dependencies:
|
||||
@@ -9649,7 +9684,7 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/jest-cli@29.7.0(@types/node@20.9.0):
|
||||
/jest-cli@29.7.0(@types/node@18.18.8):
|
||||
resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
hasBin: true
|
||||
@@ -9663,10 +9698,10 @@ packages:
|
||||
'@jest/test-result': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
chalk: 4.1.2
|
||||
create-jest: 29.7.0(@types/node@20.9.0)
|
||||
create-jest: 29.7.0(@types/node@18.18.8)
|
||||
exit: 0.1.2
|
||||
import-local: 3.1.0
|
||||
jest-config: 29.7.0(@types/node@20.9.0)
|
||||
jest-config: 29.7.0(@types/node@18.18.8)
|
||||
jest-util: 29.7.0
|
||||
jest-validate: 29.7.0
|
||||
yargs: 17.7.2
|
||||
@@ -9677,7 +9712,7 @@ packages:
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/jest-config@29.7.0(@types/node@20.9.0):
|
||||
/jest-config@29.7.0(@types/node@18.18.8):
|
||||
resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
peerDependencies:
|
||||
@@ -9692,7 +9727,7 @@ packages:
|
||||
'@babel/core': 7.23.3
|
||||
'@jest/test-sequencer': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 20.9.0
|
||||
'@types/node': 18.18.8
|
||||
babel-jest: 29.7.0(@babel/core@7.23.3)
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.9.0
|
||||
@@ -9957,7 +9992,7 @@ packages:
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 20.9.0
|
||||
'@types/node': 18.18.8
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.9.0
|
||||
graceful-fs: 4.2.11
|
||||
@@ -10006,7 +10041,7 @@ packages:
|
||||
merge-stream: 2.0.0
|
||||
supports-color: 8.1.1
|
||||
|
||||
/jest@29.7.0(@types/node@20.9.0):
|
||||
/jest@29.7.0(@types/node@18.18.8):
|
||||
resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
hasBin: true
|
||||
@@ -10019,7 +10054,7 @@ packages:
|
||||
'@jest/core': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
import-local: 3.1.0
|
||||
jest-cli: 29.7.0(@types/node@20.9.0)
|
||||
jest-cli: 29.7.0(@types/node@18.18.8)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- babel-plugin-macros
|
||||
@@ -12246,10 +12281,6 @@ packages:
|
||||
/punycode@1.4.1:
|
||||
resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==}
|
||||
|
||||
/punycode@2.3.0:
|
||||
resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
/punycode@2.3.1:
|
||||
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -13952,7 +13983,7 @@ packages:
|
||||
uglify-js:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.19
|
||||
'@jridgewell/trace-mapping': 0.3.20
|
||||
jest-worker: 27.5.1
|
||||
schema-utils: 3.3.0
|
||||
serialize-javascript: 6.0.1
|
||||
@@ -13975,7 +14006,7 @@ packages:
|
||||
uglify-js:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.19
|
||||
'@jridgewell/trace-mapping': 0.3.20
|
||||
jest-worker: 27.5.1
|
||||
schema-utils: 3.3.0
|
||||
serialize-javascript: 6.0.1
|
||||
@@ -13989,7 +14020,7 @@ packages:
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@jridgewell/source-map': 0.3.5
|
||||
acorn: 8.10.0
|
||||
acorn: 8.11.2
|
||||
commander: 2.20.0
|
||||
source-map-support: 0.5.21
|
||||
|
||||
@@ -14171,7 +14202,7 @@ packages:
|
||||
'@babel/core': 7.23.3
|
||||
bs-logger: 0.2.6
|
||||
fast-json-stable-stringify: 2.1.0
|
||||
jest: 29.7.0(@types/node@20.9.0)
|
||||
jest: 29.7.0(@types/node@18.18.8)
|
||||
jest-util: 29.7.0
|
||||
json5: 2.2.3
|
||||
lodash.memoize: 4.1.2
|
||||
@@ -14212,7 +14243,7 @@ packages:
|
||||
yn: 3.1.1
|
||||
dev: true
|
||||
|
||||
/ts-node@10.9.1(@types/node@20.9.0)(typescript@5.2.2):
|
||||
/ts-node@10.9.1(@types/node@18.18.8)(typescript@5.2.2):
|
||||
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
@@ -14231,9 +14262,9 @@ packages:
|
||||
'@tsconfig/node12': 1.0.11
|
||||
'@tsconfig/node14': 1.0.3
|
||||
'@tsconfig/node16': 1.0.4
|
||||
'@types/node': 20.9.0
|
||||
acorn: 8.11.2
|
||||
acorn-walk: 8.3.0
|
||||
'@types/node': 18.18.8
|
||||
acorn: 8.10.0
|
||||
acorn-walk: 8.2.0
|
||||
arg: 4.1.3
|
||||
create-require: 1.1.1
|
||||
diff: 4.0.2
|
||||
@@ -14736,7 +14767,7 @@ packages:
|
||||
/uri-js@4.4.1:
|
||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||
dependencies:
|
||||
punycode: 2.3.0
|
||||
punycode: 2.3.1
|
||||
|
||||
/url-loader@4.1.1(file-loader@6.2.0)(webpack@5.88.2):
|
||||
resolution: {integrity: sha512-3BTV812+AVHHOJQO8O5MkWgZ5aosP7GnROJwvzLS9hWDj00lZ6Z0wNak423Lp9PBZN05N+Jk/N5Si8jRAlGyWA==}
|
||||
@@ -14992,8 +15023,8 @@ packages:
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@discoveryjs/json-ext': 0.5.7
|
||||
acorn: 8.10.0
|
||||
acorn-walk: 8.2.0
|
||||
acorn: 8.11.2
|
||||
acorn-walk: 8.3.0
|
||||
commander: 7.2.0
|
||||
escape-string-regexp: 4.0.0
|
||||
gzip-size: 6.0.0
|
||||
|
||||
Reference in New Issue
Block a user