mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-03 19:19:08 -04:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fa01fa2051 | |||
| fb36eff5e1 | |||
| d24d3d1e8c | |||
| 5c4badbcca | |||
| 2cd1383dc8 |
@@ -13,7 +13,6 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
POSTGRES_USER: runneradmin
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# docs
|
||||
|
||||
## 0.0.72
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- Updated dependencies [5c4badb]
|
||||
- llamaindex@0.6.3
|
||||
|
||||
## 0.0.71
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docs",
|
||||
"version": "0.0.71",
|
||||
"version": "0.0.72",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
||||
@@ -27,10 +27,12 @@ async function main() {
|
||||
|
||||
// Query the index
|
||||
const queryEngine = index.asQueryEngine();
|
||||
const stream = await queryEngine.query({
|
||||
query: "What did the author do in college?",
|
||||
stream: true,
|
||||
});
|
||||
const stream = await queryEngine.query(
|
||||
{
|
||||
query: "What did the author do in college?",
|
||||
},
|
||||
true,
|
||||
);
|
||||
|
||||
// Output response
|
||||
for await (const chunk of stream) {
|
||||
|
||||
@@ -37,10 +37,12 @@ async function main() {
|
||||
|
||||
// Query the index
|
||||
const queryEngine = index.asQueryEngine();
|
||||
const stream = await queryEngine.query({
|
||||
query: "What did the author do in college?",
|
||||
stream: true,
|
||||
});
|
||||
const stream = await queryEngine.query(
|
||||
{
|
||||
query: "What did the author do in college?",
|
||||
},
|
||||
true,
|
||||
);
|
||||
|
||||
// Output response
|
||||
for await (const chunk of stream) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
Document,
|
||||
getResponseSynthesizer,
|
||||
NodeWithScore,
|
||||
ResponseSynthesizer,
|
||||
SentenceSplitter,
|
||||
TextNode,
|
||||
} from "llamaindex";
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
|
||||
console.log(nodes);
|
||||
|
||||
const responseSynthesizer = new ResponseSynthesizer();
|
||||
const responseSynthesizer = getResponseSynthesizer("compact");
|
||||
|
||||
const nodesWithScore: NodeWithScore[] = [
|
||||
{
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
const stream = await responseSynthesizer.synthesize(
|
||||
{
|
||||
query: "What age am I?",
|
||||
nodesWithScore,
|
||||
nodes: nodesWithScore,
|
||||
},
|
||||
true,
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
MultiModalResponseSynthesizer,
|
||||
getResponseSynthesizer,
|
||||
OpenAI,
|
||||
Settings,
|
||||
VectorStoreIndex,
|
||||
@@ -27,13 +27,15 @@ async function main() {
|
||||
});
|
||||
|
||||
const queryEngine = index.asQueryEngine({
|
||||
responseSynthesizer: new MultiModalResponseSynthesizer(),
|
||||
responseSynthesizer: getResponseSynthesizer("multi_modal"),
|
||||
retriever: index.asRetriever({ topK: { TEXT: 3, IMAGE: 1 } }),
|
||||
});
|
||||
const stream = await queryEngine.query({
|
||||
query: "Tell me more about Vincent van Gogh's famous paintings",
|
||||
stream: true,
|
||||
});
|
||||
const stream = await queryEngine.query(
|
||||
{
|
||||
query: "Tell me more about Vincent van Gogh's famous paintings",
|
||||
},
|
||||
true,
|
||||
);
|
||||
for await (const chunk of stream) {
|
||||
process.stdout.write(chunk.response);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import {
|
||||
Document,
|
||||
getResponseSynthesizer,
|
||||
PromptTemplate,
|
||||
ResponseSynthesizer,
|
||||
TreeSummarize,
|
||||
TreeSummarizePrompt,
|
||||
VectorStoreIndex,
|
||||
} from "llamaindex";
|
||||
@@ -27,9 +26,7 @@ async function main() {
|
||||
|
||||
const query = "The quick brown fox jumps over the lazy dog";
|
||||
|
||||
const responseSynthesizer = new ResponseSynthesizer({
|
||||
responseBuilder: new TreeSummarize(),
|
||||
});
|
||||
const responseSynthesizer = getResponseSynthesizer("tree_summarize");
|
||||
|
||||
const queryEngine = index.asQueryEngine({
|
||||
responseSynthesizer,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import {
|
||||
CompactAndRefine,
|
||||
getResponseSynthesizer,
|
||||
OpenAI,
|
||||
PromptTemplate,
|
||||
ResponseSynthesizer,
|
||||
Settings,
|
||||
VectorStoreIndex,
|
||||
} from "llamaindex";
|
||||
@@ -29,8 +28,8 @@ Given the CSV file, generate me Typescript code to answer the question: {query}.
|
||||
`,
|
||||
});
|
||||
|
||||
const responseSynthesizer = new ResponseSynthesizer({
|
||||
responseBuilder: new CompactAndRefine(undefined, csvPrompt),
|
||||
const responseSynthesizer = getResponseSynthesizer("compact", {
|
||||
textQATemplate: csvPrompt,
|
||||
});
|
||||
|
||||
const queryEngine = index.asQueryEngine({ responseSynthesizer });
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { createMessageContent } from "@llamaindex/core/utils";
|
||||
import {
|
||||
Document,
|
||||
ImageNode,
|
||||
@@ -6,7 +7,6 @@ import {
|
||||
PromptTemplate,
|
||||
VectorStoreIndex,
|
||||
} from "llamaindex";
|
||||
import { createMessageContent } from "llamaindex/synthesizers/utils";
|
||||
|
||||
const reader = new LlamaParseReader();
|
||||
async function main() {
|
||||
|
||||
@@ -2,12 +2,10 @@ import fs from "node:fs/promises";
|
||||
|
||||
import {
|
||||
Anthropic,
|
||||
CompactAndRefine,
|
||||
Document,
|
||||
ResponseSynthesizer,
|
||||
Settings,
|
||||
VectorStoreIndex,
|
||||
anthropicTextQaPrompt,
|
||||
getResponseSynthesizer,
|
||||
} from "llamaindex";
|
||||
|
||||
// Update llm to use Anthropic
|
||||
@@ -23,9 +21,7 @@ async function main() {
|
||||
const document = new Document({ text: essay, id_: path });
|
||||
|
||||
// Split text and create embeddings. Store them in a VectorStoreIndex
|
||||
const responseSynthesizer = new ResponseSynthesizer({
|
||||
responseBuilder: new CompactAndRefine(undefined, anthropicTextQaPrompt),
|
||||
});
|
||||
const responseSynthesizer = getResponseSynthesizer("compact");
|
||||
|
||||
const index = await VectorStoreIndex.fromDocuments([document]);
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import {
|
||||
getResponseSynthesizer,
|
||||
OpenAI,
|
||||
OpenAIEmbedding,
|
||||
ResponseSynthesizer,
|
||||
RetrieverQueryEngine,
|
||||
Settings,
|
||||
TextNode,
|
||||
TreeSummarize,
|
||||
VectorIndexRetriever,
|
||||
VectorStore,
|
||||
VectorStoreIndex,
|
||||
@@ -165,10 +164,7 @@ async function main() {
|
||||
similarityTopK: 500,
|
||||
});
|
||||
|
||||
const responseSynthesizer = new ResponseSynthesizer({
|
||||
responseBuilder: new TreeSummarize(),
|
||||
});
|
||||
|
||||
const responseSynthesizer = getResponseSynthesizer("tree_summarize");
|
||||
return new RetrieverQueryEngine(retriever, responseSynthesizer, {
|
||||
filter,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @llamaindex/autotool
|
||||
|
||||
## 3.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- Updated dependencies [5c4badb]
|
||||
- llamaindex@0.6.3
|
||||
|
||||
## 3.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# @llamaindex/autotool-01-node-example
|
||||
|
||||
## 0.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- Updated dependencies [5c4badb]
|
||||
- llamaindex@0.6.3
|
||||
- @llamaindex/autotool@3.0.3
|
||||
|
||||
## 0.0.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
"scripts": {
|
||||
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
|
||||
},
|
||||
"version": "0.0.11"
|
||||
"version": "0.0.12"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# @llamaindex/autotool-02-next-example
|
||||
|
||||
## 0.1.56
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- Updated dependencies [5c4badb]
|
||||
- llamaindex@0.6.3
|
||||
- @llamaindex/autotool@3.0.3
|
||||
|
||||
## 0.1.55
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/autotool-02-next-example",
|
||||
"private": true,
|
||||
"version": "0.1.55",
|
||||
"version": "0.1.56",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/autotool",
|
||||
"type": "module",
|
||||
"version": "3.0.2",
|
||||
"version": "3.0.3",
|
||||
"description": "auto transpile your JS function to LLM Agent compatible",
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @llamaindex/cloud
|
||||
|
||||
## 0.2.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- fb36eff: fix: backport for node.js 18
|
||||
|
||||
There could have one missing API in the node.js 18, so we need to backport it to make it work.
|
||||
|
||||
- d24d3d1: fix: print warning when llama parse reader has error
|
||||
- Updated dependencies [2cd1383]
|
||||
- @llamaindex/core@0.2.3
|
||||
|
||||
## 0.2.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/cloud",
|
||||
"version": "0.2.6",
|
||||
"version": "0.2.7",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
@@ -50,12 +50,12 @@
|
||||
"devDependencies": {
|
||||
"@hey-api/client-fetch": "^0.2.4",
|
||||
"@hey-api/openapi-ts": "^0.53.0",
|
||||
"@llamaindex/core": "workspace:^0.2.2",
|
||||
"@llamaindex/core": "workspace:^0.2.3",
|
||||
"@llamaindex/env": "workspace:^0.1.11",
|
||||
"bunchee": "5.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@llamaindex/core": "workspace:^0.2.2",
|
||||
"@llamaindex/core": "workspace:^0.2.3",
|
||||
"@llamaindex/env": "workspace:^0.1.11"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -229,20 +229,18 @@ export class LlamaParseReader extends FileReader {
|
||||
}
|
||||
|
||||
// Create a job for the LlamaParse API
|
||||
private async createJob(
|
||||
data: Uint8Array,
|
||||
fileName: string = "unknown",
|
||||
): Promise<string> {
|
||||
private async createJob(data: Uint8Array): Promise<string> {
|
||||
// Load data, set the mime type
|
||||
const { mime, extension } = await LlamaParseReader.getMimeType(data);
|
||||
const { mime } = await LlamaParseReader.getMimeType(data);
|
||||
|
||||
if (this.verbose) {
|
||||
const name = fileName ? fileName : extension;
|
||||
console.log(`Starting load for ${name} file`);
|
||||
console.log("Started uploading the file");
|
||||
}
|
||||
|
||||
const body = {
|
||||
file: new File([data], fileName, { type: mime }),
|
||||
file: new Blob([data], {
|
||||
type: mime,
|
||||
}),
|
||||
language: this.language,
|
||||
parsing_instruction: this.parsingInstruction,
|
||||
skip_diagonal_text: this.skipDiagonalText,
|
||||
@@ -373,14 +371,10 @@ export class LlamaParseReader extends FileReader {
|
||||
* To be used with resultType = "text" and "markdown"
|
||||
*
|
||||
* @param {Uint8Array} fileContent - The content of the file to be loaded.
|
||||
* @param {string} [fileName] - The optional name of the file to be loaded.
|
||||
* @return {Promise<Document[]>} A Promise object that resolves to an array of Document objects.
|
||||
*/
|
||||
async loadDataAsContent(
|
||||
fileContent: Uint8Array,
|
||||
fileName?: string,
|
||||
): Promise<Document[]> {
|
||||
return this.createJob(fileContent, fileName)
|
||||
async loadDataAsContent(fileContent: Uint8Array): Promise<Document[]> {
|
||||
return this.createJob(fileContent)
|
||||
.then(async (jobId) => {
|
||||
if (this.verbose) {
|
||||
console.log(`Started parsing the file under job id ${jobId}`);
|
||||
@@ -403,6 +397,7 @@ export class LlamaParseReader extends FileReader {
|
||||
})
|
||||
.catch((error) => {
|
||||
if (this.ignoreErrors) {
|
||||
console.warn(`Error while parsing the file: ${error.message}`);
|
||||
return [];
|
||||
} else {
|
||||
throw error;
|
||||
@@ -437,8 +432,8 @@ export class LlamaParseReader extends FileReader {
|
||||
resultJson.file_path = isFilePath ? filePathOrContent : undefined;
|
||||
return [resultJson];
|
||||
} catch (e) {
|
||||
console.error(`Error while parsing the file under job id ${jobId}`, e);
|
||||
if (this.ignoreErrors) {
|
||||
console.error(`Error while parsing the file under job id ${jobId}`, e);
|
||||
return [];
|
||||
} else {
|
||||
throw e;
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/community
|
||||
|
||||
## 0.0.37
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- @llamaindex/core@0.2.3
|
||||
|
||||
## 0.0.36
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/community",
|
||||
"description": "Community package for LlamaIndexTS",
|
||||
"version": "0.0.36",
|
||||
"version": "0.0.37",
|
||||
"type": "module",
|
||||
"types": "dist/type/index.d.ts",
|
||||
"main": "dist/cjs/index.js",
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @llamaindex/core
|
||||
|
||||
## 0.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cd1383: refactor: align `response-synthesizers` & `chat-engine` module
|
||||
|
||||
- builtin event system
|
||||
- correct class extends
|
||||
- aligin APIs, naming with llama-index python
|
||||
- move stream out of first parameter to second parameter for the better tyep checking
|
||||
- remove JSONQueryEngine in `@llamaindex/experimental`, as the code quality is not satisify and we will bring it back later
|
||||
|
||||
## 0.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/core",
|
||||
"type": "module",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"description": "LlamaIndex Core Module",
|
||||
"exports": {
|
||||
"./node-parser": {
|
||||
@@ -185,6 +185,20 @@
|
||||
"types": "./dist/storage/chat-store/index.d.ts",
|
||||
"default": "./dist/storage/chat-store/index.js"
|
||||
}
|
||||
},
|
||||
"./response-synthesizers": {
|
||||
"require": {
|
||||
"types": "./dist/response-synthesizers/index.d.cts",
|
||||
"default": "./dist/response-synthesizers/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/response-synthesizers/index.d.ts",
|
||||
"default": "./dist/response-synthesizers/index.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./dist/response-synthesizers/index.d.ts",
|
||||
"default": "./dist/response-synthesizers/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
@@ -210,6 +224,7 @@
|
||||
"dependencies": {
|
||||
"@llamaindex/env": "workspace:*",
|
||||
"@types/node": "^22.5.1",
|
||||
"magic-bytes.js": "^1.10.0",
|
||||
"zod": "^3.23.8"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,13 @@ import type {
|
||||
ToolCall,
|
||||
ToolOutput,
|
||||
} from "../../llms";
|
||||
import type { QueryEndEvent, QueryStartEvent } from "../../query-engine";
|
||||
import type {
|
||||
SynthesizeEndEvent,
|
||||
SynthesizeStartEvent,
|
||||
} from "../../response-synthesizers";
|
||||
import { TextNode } from "../../schema";
|
||||
import { EventCaller, getEventCaller } from "../../utils/event-caller";
|
||||
import { EventCaller, getEventCaller } from "../../utils";
|
||||
import type { UUID } from "../type";
|
||||
|
||||
export type LLMStartEvent = {
|
||||
@@ -60,6 +65,10 @@ export interface LlamaIndexEventMaps {
|
||||
"chunking-end": ChunkingEndEvent;
|
||||
"node-parsing-start": NodeParsingStartEvent;
|
||||
"node-parsing-end": NodeParsingEndEvent;
|
||||
"query-start": QueryStartEvent;
|
||||
"query-end": QueryEndEvent;
|
||||
"synthesize-start": SynthesizeStartEvent;
|
||||
"synthesize-end": SynthesizeEndEvent;
|
||||
}
|
||||
|
||||
export class LlamaIndexCustomEvent<T = any> extends CustomEvent<T> {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { type Tokenizer, tokenizers } from "@llamaindex/env";
|
||||
import {
|
||||
DEFAULT_CHUNK_OVERLAP_RATIO,
|
||||
DEFAULT_CHUNK_SIZE,
|
||||
DEFAULT_CONTEXT_WINDOW,
|
||||
DEFAULT_NUM_OUTPUTS,
|
||||
DEFAULT_PADDING,
|
||||
Settings,
|
||||
} from "../global";
|
||||
import type { LLMMetadata } from "../llms";
|
||||
import { SentenceSplitter } from "../node-parser";
|
||||
import type { PromptTemplate } from "../prompts";
|
||||
|
||||
@@ -133,4 +136,29 @@ export class PromptHelper {
|
||||
const combinedStr = textChunks.join("\n\n");
|
||||
return textSplitter.splitText(combinedStr);
|
||||
}
|
||||
|
||||
static fromLLMMetadata(
|
||||
metadata: LLMMetadata,
|
||||
options?: {
|
||||
chunkOverlapRatio?: number;
|
||||
chunkSizeLimit?: number;
|
||||
tokenizer?: Tokenizer;
|
||||
separator?: string;
|
||||
},
|
||||
) {
|
||||
const {
|
||||
chunkOverlapRatio = DEFAULT_CHUNK_OVERLAP_RATIO,
|
||||
chunkSizeLimit = DEFAULT_CHUNK_SIZE,
|
||||
tokenizer = Settings.tokenizer,
|
||||
separator = " ",
|
||||
} = options ?? {};
|
||||
return new PromptHelper({
|
||||
contextWindow: metadata.contextWindow,
|
||||
numOutput: metadata.maxTokens ?? DEFAULT_NUM_OUTPUTS,
|
||||
chunkOverlapRatio,
|
||||
chunkSizeLimit,
|
||||
tokenizer,
|
||||
separator,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { randomUUID } from "@llamaindex/env";
|
||||
import { Settings } from "../global";
|
||||
import type { MessageContent } from "../llms";
|
||||
import { EngineResponse, type NodeWithScore } from "../schema";
|
||||
import { PromptMixin } from "../prompts";
|
||||
import { EngineResponse } from "../schema";
|
||||
import { wrapEventCaller } from "../utils";
|
||||
|
||||
/**
|
||||
* @link https://docs.llamaindex.ai/en/stable/api_reference/schema/?h=querybundle#llama_index.core.schema.QueryBundle
|
||||
@@ -14,16 +18,37 @@ export type QueryBundle = {
|
||||
|
||||
export type QueryType = string | QueryBundle;
|
||||
|
||||
export interface BaseQueryEngine {
|
||||
export type QueryFn = (
|
||||
strOrQueryBundle: QueryType,
|
||||
stream?: boolean,
|
||||
) => Promise<AsyncIterable<EngineResponse> | EngineResponse>;
|
||||
|
||||
export abstract class BaseQueryEngine extends PromptMixin {
|
||||
protected constructor(protected readonly _query: QueryFn) {
|
||||
super();
|
||||
}
|
||||
|
||||
query(
|
||||
strOrQueryBundle: QueryType,
|
||||
stream: true,
|
||||
): Promise<AsyncIterable<EngineResponse>>;
|
||||
query(strOrQueryBundle: QueryType, stream?: false): Promise<EngineResponse>;
|
||||
|
||||
synthesize?(
|
||||
@wrapEventCaller
|
||||
async query(
|
||||
strOrQueryBundle: QueryType,
|
||||
nodes: NodeWithScore[],
|
||||
additionalSources?: Iterator<NodeWithScore>,
|
||||
): Promise<EngineResponse>;
|
||||
stream = false,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>> {
|
||||
const id = randomUUID();
|
||||
const callbackManager = Settings.callbackManager;
|
||||
callbackManager.dispatchEvent("query-start", {
|
||||
id,
|
||||
query: strOrQueryBundle,
|
||||
});
|
||||
const response = await this._query(strOrQueryBundle, stream);
|
||||
callbackManager.dispatchEvent("query-end", {
|
||||
id,
|
||||
response,
|
||||
});
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export type { BaseQueryEngine, QueryBundle, QueryType } from "./base";
|
||||
export { BaseQueryEngine, type QueryBundle, type QueryType } from "./base";
|
||||
export type { QueryEndEvent, QueryStartEvent } from "./type";
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { EngineResponse } from "../schema";
|
||||
import type { QueryType } from "./base";
|
||||
|
||||
export type QueryStartEvent = {
|
||||
id: string;
|
||||
query: QueryType;
|
||||
};
|
||||
|
||||
export type QueryEndEvent = {
|
||||
id: string;
|
||||
response: EngineResponse | AsyncIterable<EngineResponse>;
|
||||
};
|
||||
@@ -0,0 +1,58 @@
|
||||
import { randomUUID } from "@llamaindex/env";
|
||||
import { Settings } from "../global";
|
||||
import { PromptHelper } from "../indices";
|
||||
import type { LLM, MessageContent } from "../llms";
|
||||
import { PromptMixin } from "../prompts";
|
||||
import { EngineResponse, type NodeWithScore } from "../schema";
|
||||
import type { SynthesizeQuery } from "./type";
|
||||
|
||||
export type BaseSynthesizerOptions = {
|
||||
llm?: LLM;
|
||||
promptHelper?: PromptHelper;
|
||||
};
|
||||
|
||||
export abstract class BaseSynthesizer extends PromptMixin {
|
||||
llm: LLM;
|
||||
promptHelper: PromptHelper;
|
||||
|
||||
protected constructor(options: Partial<BaseSynthesizerOptions>) {
|
||||
super();
|
||||
this.llm = options.llm ?? Settings.llm;
|
||||
this.promptHelper =
|
||||
options.promptHelper ?? PromptHelper.fromLLMMetadata(this.llm.metadata);
|
||||
}
|
||||
|
||||
protected abstract getResponse(
|
||||
query: MessageContent,
|
||||
textChunks: NodeWithScore[],
|
||||
stream: boolean,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>>;
|
||||
|
||||
synthesize(
|
||||
query: SynthesizeQuery,
|
||||
stream: true,
|
||||
): Promise<AsyncIterable<EngineResponse>>;
|
||||
synthesize(query: SynthesizeQuery, stream?: false): Promise<EngineResponse>;
|
||||
async synthesize(
|
||||
query: SynthesizeQuery,
|
||||
stream = false,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>> {
|
||||
const callbackManager = Settings.callbackManager;
|
||||
const id = randomUUID();
|
||||
callbackManager.dispatchEvent("synthesize-start", { id, query });
|
||||
let response: EngineResponse | AsyncIterable<EngineResponse>;
|
||||
if (query.nodes.length === 0) {
|
||||
if (stream) {
|
||||
response = EngineResponse.fromResponse("Empty Response", true);
|
||||
} else {
|
||||
response = EngineResponse.fromResponse("Empty Response", false);
|
||||
}
|
||||
} else {
|
||||
const queryMessage: MessageContent =
|
||||
typeof query.query === "string" ? query.query : query.query.query;
|
||||
response = await this.getResponse(queryMessage, query.nodes, stream);
|
||||
}
|
||||
callbackManager.dispatchEvent("synthesize-end", { id, query, response });
|
||||
return response;
|
||||
}
|
||||
}
|
||||
+191
-164
@@ -1,108 +1,52 @@
|
||||
import { getBiggestPrompt, type PromptHelper } from "@llamaindex/core/indices";
|
||||
import type { LLM } from "@llamaindex/core/llms";
|
||||
import { z } from "zod";
|
||||
import { getBiggestPrompt } from "../indices";
|
||||
import type { MessageContent } from "../llms";
|
||||
import {
|
||||
PromptMixin,
|
||||
defaultRefinePrompt,
|
||||
defaultTextQAPrompt,
|
||||
defaultTreeSummarizePrompt,
|
||||
type ModuleRecord,
|
||||
type PromptsRecord,
|
||||
type RefinePrompt,
|
||||
type TextQAPrompt,
|
||||
type TreeSummarizePrompt,
|
||||
} from "@llamaindex/core/prompts";
|
||||
import type { QueryType } from "@llamaindex/core/query-engine";
|
||||
import { extractText, streamConverter } from "@llamaindex/core/utils";
|
||||
import type { ServiceContext } from "../ServiceContext.js";
|
||||
} from "../prompts";
|
||||
import {
|
||||
llmFromSettingsOrContext,
|
||||
promptHelperFromSettingsOrContext,
|
||||
} from "../Settings.js";
|
||||
import type { ResponseBuilder, ResponseBuilderQuery } from "./types.js";
|
||||
EngineResponse,
|
||||
MetadataMode,
|
||||
type NodeWithScore,
|
||||
TextNode,
|
||||
} from "../schema";
|
||||
import { createMessageContent, extractText, streamConverter } from "../utils";
|
||||
import {
|
||||
BaseSynthesizer,
|
||||
type BaseSynthesizerOptions,
|
||||
} from "./base-synthesizer";
|
||||
|
||||
/**
|
||||
* Response modes of the response synthesizer
|
||||
*/
|
||||
enum ResponseMode {
|
||||
REFINE = "refine",
|
||||
COMPACT = "compact",
|
||||
TREE_SUMMARIZE = "tree_summarize",
|
||||
SIMPLE = "simple",
|
||||
}
|
||||
const responseModeSchema = z.enum([
|
||||
"refine",
|
||||
"compact",
|
||||
"tree_summarize",
|
||||
"multi_modal",
|
||||
]);
|
||||
|
||||
/**
|
||||
* A response builder that just concatenates responses.
|
||||
*/
|
||||
export class SimpleResponseBuilder
|
||||
extends PromptMixin
|
||||
implements ResponseBuilder
|
||||
{
|
||||
llm: LLM;
|
||||
textQATemplate: TextQAPrompt;
|
||||
|
||||
constructor(serviceContext?: ServiceContext, textQATemplate?: TextQAPrompt) {
|
||||
super();
|
||||
this.llm = llmFromSettingsOrContext(serviceContext);
|
||||
this.textQATemplate = textQATemplate ?? defaultTextQAPrompt;
|
||||
}
|
||||
|
||||
protected _getPrompts(): PromptsRecord {
|
||||
return {
|
||||
textQATemplate: this.textQATemplate,
|
||||
};
|
||||
}
|
||||
protected _updatePrompts(prompts: { textQATemplate: TextQAPrompt }): void {
|
||||
if (prompts.textQATemplate) {
|
||||
this.textQATemplate = prompts.textQATemplate;
|
||||
}
|
||||
}
|
||||
protected _getPromptModules(): ModuleRecord {
|
||||
return {};
|
||||
}
|
||||
|
||||
getResponse(
|
||||
query: ResponseBuilderQuery,
|
||||
stream: true,
|
||||
): Promise<AsyncIterable<string>>;
|
||||
getResponse(query: ResponseBuilderQuery, stream?: false): Promise<string>;
|
||||
async getResponse(
|
||||
{ query, textChunks }: ResponseBuilderQuery,
|
||||
stream?: boolean,
|
||||
): Promise<AsyncIterable<string> | string> {
|
||||
const prompt = this.textQATemplate.format({
|
||||
query: extractText(query),
|
||||
context: textChunks.join("\n\n"),
|
||||
});
|
||||
if (stream) {
|
||||
const response = await this.llm.complete({ prompt, stream: true });
|
||||
return streamConverter(response, (chunk) => chunk.text);
|
||||
} else {
|
||||
const response = await this.llm.complete({ prompt, stream: false });
|
||||
return response.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
export type ResponseMode = z.infer<typeof responseModeSchema>;
|
||||
|
||||
/**
|
||||
* A response builder that uses the query to ask the LLM generate a better response using multiple text chunks.
|
||||
*/
|
||||
export class Refine extends PromptMixin implements ResponseBuilder {
|
||||
llm: LLM;
|
||||
promptHelper: PromptHelper;
|
||||
class Refine extends BaseSynthesizer {
|
||||
textQATemplate: TextQAPrompt;
|
||||
refineTemplate: RefinePrompt;
|
||||
|
||||
constructor(
|
||||
serviceContext?: ServiceContext,
|
||||
textQATemplate?: TextQAPrompt,
|
||||
refineTemplate?: RefinePrompt,
|
||||
options: BaseSynthesizerOptions & {
|
||||
textQATemplate?: TextQAPrompt | undefined;
|
||||
refineTemplate?: RefinePrompt | undefined;
|
||||
},
|
||||
) {
|
||||
super();
|
||||
|
||||
this.llm = llmFromSettingsOrContext(serviceContext);
|
||||
this.promptHelper = promptHelperFromSettingsOrContext(serviceContext);
|
||||
this.textQATemplate = textQATemplate ?? defaultTextQAPrompt;
|
||||
this.refineTemplate = refineTemplate ?? defaultRefinePrompt;
|
||||
super(options);
|
||||
this.textQATemplate = options.textQATemplate ?? defaultTextQAPrompt;
|
||||
this.refineTemplate = options.refineTemplate ?? defaultRefinePrompt;
|
||||
}
|
||||
|
||||
protected _getPromptModules(): ModuleRecord {
|
||||
@@ -132,41 +76,47 @@ export class Refine extends PromptMixin implements ResponseBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
getResponse(
|
||||
query: ResponseBuilderQuery,
|
||||
stream: true,
|
||||
): Promise<AsyncIterable<string>>;
|
||||
getResponse(query: ResponseBuilderQuery, stream?: false): Promise<string>;
|
||||
async getResponse(
|
||||
{ query, textChunks, prevResponse }: ResponseBuilderQuery,
|
||||
stream?: boolean,
|
||||
): Promise<AsyncIterable<string> | string> {
|
||||
let response: AsyncIterable<string> | string | undefined = prevResponse;
|
||||
query: MessageContent,
|
||||
nodes: NodeWithScore[],
|
||||
stream: boolean,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>> {
|
||||
let response: AsyncIterable<string> | string | undefined = undefined;
|
||||
const textChunks = nodes.map(({ node }) =>
|
||||
node.getContent(MetadataMode.LLM),
|
||||
);
|
||||
|
||||
for (let i = 0; i < textChunks.length; i++) {
|
||||
const chunk = textChunks[i]!;
|
||||
const text = textChunks[i]!;
|
||||
const lastChunk = i === textChunks.length - 1;
|
||||
if (!response) {
|
||||
response = await this.giveResponseSingle(
|
||||
query,
|
||||
chunk,
|
||||
text,
|
||||
!!stream && lastChunk,
|
||||
);
|
||||
} else {
|
||||
response = await this.refineResponseSingle(
|
||||
response as string,
|
||||
query,
|
||||
chunk,
|
||||
text,
|
||||
!!stream && lastChunk,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return response ?? "Empty Response";
|
||||
// fixme: no source nodes provided, cannot fix right now due to lack of context
|
||||
if (typeof response === "string") {
|
||||
return EngineResponse.fromResponse(response, false);
|
||||
} else {
|
||||
return streamConverter(response!, (text) =>
|
||||
EngineResponse.fromResponse(text, true),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private async giveResponseSingle(
|
||||
query: QueryType,
|
||||
query: MessageContent,
|
||||
textChunk: string,
|
||||
stream: boolean,
|
||||
): Promise<AsyncIterable<string> | string> {
|
||||
@@ -203,10 +153,10 @@ export class Refine extends PromptMixin implements ResponseBuilder {
|
||||
// eslint-disable-next-line max-params
|
||||
private async refineResponseSingle(
|
||||
initialReponse: string,
|
||||
query: QueryType,
|
||||
query: MessageContent,
|
||||
textChunk: string,
|
||||
stream: boolean,
|
||||
) {
|
||||
): Promise<AsyncIterable<string> | string> {
|
||||
const refineTemplate: RefinePrompt = this.refineTemplate.partialFormat({
|
||||
query: extractText(query),
|
||||
});
|
||||
@@ -246,59 +196,54 @@ export class Refine extends PromptMixin implements ResponseBuilder {
|
||||
/**
|
||||
* CompactAndRefine is a slight variation of Refine that first compacts the text chunks into the smallest possible number of chunks.
|
||||
*/
|
||||
export class CompactAndRefine extends Refine {
|
||||
getResponse(
|
||||
query: ResponseBuilderQuery,
|
||||
stream: true,
|
||||
): Promise<AsyncIterable<string>>;
|
||||
getResponse(query: ResponseBuilderQuery, stream?: false): Promise<string>;
|
||||
class CompactAndRefine extends Refine {
|
||||
async getResponse(
|
||||
{ query, textChunks, prevResponse }: ResponseBuilderQuery,
|
||||
stream?: boolean,
|
||||
): Promise<AsyncIterable<string> | string> {
|
||||
query: MessageContent,
|
||||
nodes: NodeWithScore[],
|
||||
stream: boolean,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>> {
|
||||
const textQATemplate: TextQAPrompt = this.textQATemplate.partialFormat({
|
||||
query: extractText(query),
|
||||
});
|
||||
const refineTemplate: RefinePrompt = this.refineTemplate.partialFormat({
|
||||
query: extractText(query),
|
||||
});
|
||||
const textChunks = nodes.map(({ node }) =>
|
||||
node.getContent(MetadataMode.LLM),
|
||||
);
|
||||
|
||||
const maxPrompt = getBiggestPrompt([textQATemplate, refineTemplate]);
|
||||
const newTexts = this.promptHelper.repack(maxPrompt, textChunks);
|
||||
const params = {
|
||||
query,
|
||||
textChunks: newTexts,
|
||||
prevResponse,
|
||||
};
|
||||
const newNodes = newTexts.map((text) => new TextNode({ text }));
|
||||
if (stream) {
|
||||
return super.getResponse(
|
||||
{
|
||||
...params,
|
||||
},
|
||||
query,
|
||||
newNodes.map((node) => ({ node })),
|
||||
true,
|
||||
);
|
||||
}
|
||||
return super.getResponse(params);
|
||||
return super.getResponse(
|
||||
query,
|
||||
newNodes.map((node) => ({ node })),
|
||||
false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TreeSummarize repacks the text chunks into the smallest possible number of chunks and then summarizes them, then recursively does so until there's one chunk left.
|
||||
*/
|
||||
export class TreeSummarize extends PromptMixin implements ResponseBuilder {
|
||||
llm: LLM;
|
||||
promptHelper: PromptHelper;
|
||||
class TreeSummarize extends BaseSynthesizer {
|
||||
summaryTemplate: TreeSummarizePrompt;
|
||||
|
||||
constructor(
|
||||
serviceContext?: ServiceContext,
|
||||
summaryTemplate?: TreeSummarizePrompt,
|
||||
options: BaseSynthesizerOptions & {
|
||||
summaryTemplate?: TreeSummarizePrompt;
|
||||
},
|
||||
) {
|
||||
super();
|
||||
|
||||
this.llm = llmFromSettingsOrContext(serviceContext);
|
||||
this.promptHelper = promptHelperFromSettingsOrContext(serviceContext);
|
||||
this.summaryTemplate = summaryTemplate ?? defaultTreeSummarizePrompt;
|
||||
super(options);
|
||||
this.summaryTemplate =
|
||||
options.summaryTemplate ?? defaultTreeSummarizePrompt;
|
||||
}
|
||||
|
||||
protected _getPromptModules(): ModuleRecord {
|
||||
@@ -319,15 +264,14 @@ export class TreeSummarize extends PromptMixin implements ResponseBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
getResponse(
|
||||
query: ResponseBuilderQuery,
|
||||
stream: true,
|
||||
): Promise<AsyncIterable<string>>;
|
||||
getResponse(query: ResponseBuilderQuery, stream?: false): Promise<string>;
|
||||
async getResponse(
|
||||
{ query, textChunks }: ResponseBuilderQuery,
|
||||
stream?: boolean,
|
||||
): Promise<AsyncIterable<string> | string> {
|
||||
query: MessageContent,
|
||||
nodes: NodeWithScore[],
|
||||
stream: boolean,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>> {
|
||||
const textChunks = nodes.map(({ node }) =>
|
||||
node.getContent(MetadataMode.LLM),
|
||||
);
|
||||
if (!textChunks || textChunks.length === 0) {
|
||||
throw new Error("Must have at least one text chunk");
|
||||
}
|
||||
@@ -347,9 +291,14 @@ export class TreeSummarize extends PromptMixin implements ResponseBuilder {
|
||||
};
|
||||
if (stream) {
|
||||
const response = await this.llm.complete({ ...params, stream });
|
||||
return streamConverter(response, (chunk) => chunk.text);
|
||||
return streamConverter(response, (chunk) =>
|
||||
EngineResponse.fromResponse(chunk.text, true),
|
||||
);
|
||||
}
|
||||
return (await this.llm.complete(params)).text;
|
||||
return EngineResponse.fromResponse(
|
||||
(await this.llm.complete(params)).text,
|
||||
false,
|
||||
);
|
||||
} else {
|
||||
const summaries = await Promise.all(
|
||||
packedTextChunks.map((chunk) =>
|
||||
@@ -362,40 +311,118 @@ export class TreeSummarize extends PromptMixin implements ResponseBuilder {
|
||||
),
|
||||
);
|
||||
|
||||
const params = {
|
||||
query,
|
||||
textChunks: summaries.map((s) => s.text),
|
||||
};
|
||||
if (stream) {
|
||||
return this.getResponse(
|
||||
{
|
||||
...params,
|
||||
},
|
||||
query,
|
||||
summaries.map((s) => ({
|
||||
node: new TextNode({
|
||||
text: s.text,
|
||||
}),
|
||||
})),
|
||||
true,
|
||||
);
|
||||
}
|
||||
return this.getResponse(params);
|
||||
return this.getResponse(
|
||||
query,
|
||||
summaries.map((s) => ({
|
||||
node: new TextNode({
|
||||
text: s.text,
|
||||
}),
|
||||
})),
|
||||
false,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getResponseBuilder(
|
||||
serviceContext?: ServiceContext,
|
||||
responseMode?: ResponseMode,
|
||||
): ResponseBuilder {
|
||||
switch (responseMode) {
|
||||
case ResponseMode.SIMPLE:
|
||||
return new SimpleResponseBuilder(serviceContext);
|
||||
case ResponseMode.REFINE:
|
||||
return new Refine(serviceContext);
|
||||
case ResponseMode.TREE_SUMMARIZE:
|
||||
return new TreeSummarize(serviceContext);
|
||||
default:
|
||||
return new CompactAndRefine(serviceContext);
|
||||
class MultiModal extends BaseSynthesizer {
|
||||
metadataMode: MetadataMode;
|
||||
textQATemplate: TextQAPrompt;
|
||||
|
||||
constructor({
|
||||
textQATemplate,
|
||||
metadataMode,
|
||||
...options
|
||||
}: BaseSynthesizerOptions & {
|
||||
textQATemplate?: TextQAPrompt;
|
||||
metadataMode?: MetadataMode;
|
||||
} = {}) {
|
||||
super(options);
|
||||
|
||||
this.metadataMode = metadataMode ?? MetadataMode.NONE;
|
||||
this.textQATemplate = textQATemplate ?? defaultTextQAPrompt;
|
||||
}
|
||||
|
||||
protected _getPromptModules(): ModuleRecord {
|
||||
return {};
|
||||
}
|
||||
|
||||
protected _getPrompts(): { textQATemplate: TextQAPrompt } {
|
||||
return {
|
||||
textQATemplate: this.textQATemplate,
|
||||
};
|
||||
}
|
||||
|
||||
protected _updatePrompts(promptsDict: {
|
||||
textQATemplate: TextQAPrompt;
|
||||
}): void {
|
||||
if (promptsDict.textQATemplate) {
|
||||
this.textQATemplate = promptsDict.textQATemplate;
|
||||
}
|
||||
}
|
||||
|
||||
protected async getResponse(
|
||||
query: MessageContent,
|
||||
nodes: NodeWithScore[],
|
||||
stream: boolean,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>> {
|
||||
const prompt = await createMessageContent(
|
||||
this.textQATemplate,
|
||||
nodes.map(({ node }) => node),
|
||||
// this might not be good as this remove the image information
|
||||
{ query: extractText(query) },
|
||||
this.metadataMode,
|
||||
);
|
||||
|
||||
const llm = this.llm;
|
||||
|
||||
if (stream) {
|
||||
const response = await llm.complete({
|
||||
prompt,
|
||||
stream,
|
||||
});
|
||||
return streamConverter(response, ({ text }) =>
|
||||
EngineResponse.fromResponse(text, true),
|
||||
);
|
||||
}
|
||||
const response = await llm.complete({
|
||||
prompt,
|
||||
});
|
||||
return EngineResponse.fromResponse(response.text, false);
|
||||
}
|
||||
}
|
||||
|
||||
export type ResponseBuilderPrompts =
|
||||
| TextQAPrompt
|
||||
| TreeSummarizePrompt
|
||||
| RefinePrompt;
|
||||
export function getResponseSynthesizer(
|
||||
mode: ResponseMode,
|
||||
options: BaseSynthesizerOptions & {
|
||||
textQATemplate?: TextQAPrompt;
|
||||
refineTemplate?: RefinePrompt;
|
||||
summaryTemplate?: TreeSummarizePrompt;
|
||||
metadataMode?: MetadataMode;
|
||||
} = {},
|
||||
) {
|
||||
switch (mode) {
|
||||
case "compact": {
|
||||
return new CompactAndRefine(options);
|
||||
}
|
||||
case "refine": {
|
||||
return new Refine(options);
|
||||
}
|
||||
case "tree_summarize": {
|
||||
return new TreeSummarize(options);
|
||||
}
|
||||
case "multi_modal": {
|
||||
return new MultiModal(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export {
|
||||
BaseSynthesizer,
|
||||
type BaseSynthesizerOptions,
|
||||
} from "./base-synthesizer";
|
||||
export { getResponseSynthesizer, type ResponseMode } from "./factory";
|
||||
export type {
|
||||
SynthesizeEndEvent,
|
||||
SynthesizeQuery,
|
||||
SynthesizeStartEvent,
|
||||
} from "./type";
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { QueryType } from "../query-engine";
|
||||
import { EngineResponse, type NodeWithScore } from "../schema";
|
||||
|
||||
export type SynthesizeQuery = {
|
||||
query: QueryType;
|
||||
nodes: NodeWithScore[];
|
||||
additionalSourceNodes?: NodeWithScore[];
|
||||
};
|
||||
|
||||
export type SynthesizeStartEvent = {
|
||||
id: string;
|
||||
query: SynthesizeQuery;
|
||||
};
|
||||
|
||||
export type SynthesizeEndEvent = {
|
||||
id: string;
|
||||
query: SynthesizeQuery;
|
||||
response: EngineResponse | AsyncIterable<EngineResponse>;
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
export { wrapEventCaller } from "./event-caller";
|
||||
export { EventCaller, getEventCaller, wrapEventCaller } from "./event-caller";
|
||||
|
||||
export async function* streamConverter<S, D>(
|
||||
stream: AsyncIterable<S>,
|
||||
@@ -47,10 +47,12 @@ export async function* streamReducer<S, D>(params: {
|
||||
export { wrapLLMEvent } from "./wrap-llm-event";
|
||||
|
||||
export {
|
||||
createMessageContent,
|
||||
extractDataUrlComponents,
|
||||
extractImage,
|
||||
extractSingleText,
|
||||
extractText,
|
||||
imageToDataUrl,
|
||||
messagesToHistory,
|
||||
toToolDescriptions,
|
||||
} from "./llms";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { fs } from "@llamaindex/env";
|
||||
import { filetypemime } from "magic-bytes.js";
|
||||
import type {
|
||||
ChatMessage,
|
||||
MessageContent,
|
||||
@@ -5,8 +7,16 @@ import type {
|
||||
MessageContentTextDetail,
|
||||
ToolMetadata,
|
||||
} from "../llms";
|
||||
import type { BasePromptTemplate } from "../prompts";
|
||||
import type { QueryType } from "../query-engine";
|
||||
import type { ImageType } from "../schema";
|
||||
import {
|
||||
type BaseNode,
|
||||
ImageNode,
|
||||
MetadataMode,
|
||||
ModalityType,
|
||||
splitNodesByType,
|
||||
} from "../schema";
|
||||
|
||||
/**
|
||||
* Extracts just the text whether from
|
||||
@@ -107,3 +117,99 @@ export function toToolDescriptions(tools: ToolMetadata[]): string {
|
||||
|
||||
return JSON.stringify(toolsObj, null, 4);
|
||||
}
|
||||
|
||||
async function blobToDataUrl(input: Blob) {
|
||||
const buffer = Buffer.from(await input.arrayBuffer());
|
||||
const mimes = filetypemime(buffer);
|
||||
if (mimes.length < 1) {
|
||||
throw new Error("Unsupported image type");
|
||||
}
|
||||
return "data:" + mimes[0] + ";base64," + buffer.toString("base64");
|
||||
}
|
||||
|
||||
export async function imageToDataUrl(
|
||||
input: ImageType | Uint8Array,
|
||||
): Promise<string> {
|
||||
// first ensure, that the input is a Blob
|
||||
if (
|
||||
(input instanceof URL && input.protocol === "file:") ||
|
||||
typeof input === "string"
|
||||
) {
|
||||
// string or file URL
|
||||
const dataBuffer = await fs.readFile(
|
||||
input instanceof URL ? input.pathname : input,
|
||||
);
|
||||
input = new Blob([dataBuffer]);
|
||||
} else if (!(input instanceof Blob)) {
|
||||
if (input instanceof URL) {
|
||||
throw new Error(`Unsupported URL with protocol: ${input.protocol}`);
|
||||
} else if (input instanceof Uint8Array) {
|
||||
input = new Blob([input]); // convert Uint8Array to Blob
|
||||
} else {
|
||||
throw new Error(`Unsupported input type: ${typeof input}`);
|
||||
}
|
||||
}
|
||||
return await blobToDataUrl(input);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
async function createContentPerModality(
|
||||
prompt: BasePromptTemplate,
|
||||
type: ModalityType,
|
||||
nodes: BaseNode[],
|
||||
extraParams: Record<string, string>,
|
||||
metadataMode: MetadataMode,
|
||||
): Promise<MessageContentDetail[]> {
|
||||
switch (type) {
|
||||
case ModalityType.TEXT:
|
||||
return [
|
||||
{
|
||||
type: "text",
|
||||
text: prompt.format({
|
||||
...extraParams,
|
||||
context: nodes.map((r) => r.getContent(metadataMode)).join("\n\n"),
|
||||
}),
|
||||
},
|
||||
];
|
||||
case ModalityType.IMAGE:
|
||||
const images: MessageContentDetail[] = await Promise.all(
|
||||
(nodes as ImageNode[]).map(async (node) => {
|
||||
return {
|
||||
type: "image_url",
|
||||
image_url: {
|
||||
url: await imageToDataUrl(node.image),
|
||||
},
|
||||
} satisfies MessageContentDetail;
|
||||
}),
|
||||
);
|
||||
return images;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function createMessageContent(
|
||||
prompt: BasePromptTemplate,
|
||||
nodes: BaseNode[],
|
||||
extraParams: Record<string, string> = {},
|
||||
metadataMode: MetadataMode = MetadataMode.NONE,
|
||||
): Promise<MessageContentDetail[]> {
|
||||
const content: MessageContentDetail[] = [];
|
||||
const nodeMap = splitNodesByType(nodes);
|
||||
for (const type in nodeMap) {
|
||||
// for each retrieved modality type, create message content
|
||||
const nodes = nodeMap[type as ModalityType];
|
||||
if (nodes) {
|
||||
content.push(
|
||||
...(await createContentPerModality(
|
||||
prompt,
|
||||
type as ModalityType,
|
||||
nodes,
|
||||
extraParams,
|
||||
metadataMode,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @llamaindex/experimental
|
||||
|
||||
## 0.0.81
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cd1383: refactor: align `response-synthesizers` & `chat-engine` module
|
||||
|
||||
- builtin event system
|
||||
- correct class extends
|
||||
- aligin APIs, naming with llama-index python
|
||||
- move stream out of first parameter to second parameter for the better tyep checking
|
||||
- remove JSONQueryEngine in `@llamaindex/experimental`, as the code quality is not satisify and we will bring it back later
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- Updated dependencies [5c4badb]
|
||||
- llamaindex@0.6.3
|
||||
|
||||
## 0.0.80
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/experimental",
|
||||
"description": "Experimental package for LlamaIndexTS",
|
||||
"version": "0.0.80",
|
||||
"version": "0.0.81",
|
||||
"type": "module",
|
||||
"types": "dist/type/index.d.ts",
|
||||
"main": "dist/cjs/index.js",
|
||||
|
||||
@@ -1,211 +0,0 @@
|
||||
import jsonpath from "jsonpath";
|
||||
|
||||
import { EngineResponse } from "llamaindex";
|
||||
|
||||
import { serviceContextFromDefaults, type ServiceContext } from "llamaindex";
|
||||
|
||||
import type {
|
||||
QueryEngine,
|
||||
QueryEngineParamsNonStreaming,
|
||||
QueryEngineParamsStreaming,
|
||||
} from "llamaindex";
|
||||
|
||||
import {
|
||||
defaultJsonPathPrompt,
|
||||
defaultResponseSynthesizePrompt,
|
||||
type JSONPathPrompt,
|
||||
type ResponseSynthesisPrompt,
|
||||
} from "./prompt.js";
|
||||
|
||||
export type JSONSchemaType = Record<string, unknown>;
|
||||
|
||||
function removeExtraQuotes(expr: string) {
|
||||
let startIndex = 0;
|
||||
let endIndex = expr.length;
|
||||
|
||||
// Trim the leading backticks and single quotes
|
||||
while (
|
||||
startIndex < endIndex &&
|
||||
(expr[startIndex] === "`" || expr[startIndex] === "'")
|
||||
) {
|
||||
startIndex++;
|
||||
}
|
||||
|
||||
// Trim the trailing backticks and single quotes
|
||||
while (
|
||||
endIndex > startIndex &&
|
||||
(expr[endIndex - 1] === "`" || expr[endIndex - 1] === "'")
|
||||
) {
|
||||
endIndex--;
|
||||
}
|
||||
|
||||
// Return the trimmed substring
|
||||
return expr.substring(startIndex, endIndex);
|
||||
}
|
||||
|
||||
export const defaultOutputProcessor = async ({
|
||||
llmOutput,
|
||||
jsonValue,
|
||||
}: {
|
||||
llmOutput: string;
|
||||
jsonValue: JSONSchemaType;
|
||||
}): Promise<Record<string, unknown>[]> => {
|
||||
const expressions = llmOutput
|
||||
.split(",")
|
||||
.map((expr) => removeExtraQuotes(expr.trim()));
|
||||
|
||||
const results: Record<string, unknown>[] = [];
|
||||
|
||||
for (const expression of expressions) {
|
||||
// get the key for example content from $.content
|
||||
const key = expression.split(".").pop();
|
||||
|
||||
try {
|
||||
const datums = jsonpath.query(jsonValue, expression);
|
||||
|
||||
if (!key) throw new Error(`Invalid JSON Path: ${expression}`);
|
||||
|
||||
for (const datum of datums) {
|
||||
// in case there is a filter like [?(@.username=='simon')] without a key ie: $..comments[?(@.username=='simon').content]
|
||||
if (key.includes("==")) {
|
||||
results.push(datum);
|
||||
continue;
|
||||
}
|
||||
|
||||
results.push({
|
||||
[key]: datum,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(`Invalid JSON Path: ${expression}`);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
type OutputProcessor = typeof defaultOutputProcessor;
|
||||
|
||||
/**
|
||||
* A JSON query engine that uses JSONPath to query a JSON object.
|
||||
*/
|
||||
export class JSONQueryEngine implements QueryEngine {
|
||||
jsonValue: JSONSchemaType;
|
||||
jsonSchema: JSONSchemaType;
|
||||
serviceContext: ServiceContext;
|
||||
outputProcessor: OutputProcessor;
|
||||
verbose: boolean;
|
||||
jsonPathPrompt: JSONPathPrompt;
|
||||
synthesizeResponse: boolean;
|
||||
responseSynthesisPrompt: ResponseSynthesisPrompt;
|
||||
|
||||
constructor(init: {
|
||||
jsonValue: JSONSchemaType;
|
||||
jsonSchema: JSONSchemaType;
|
||||
serviceContext?: ServiceContext;
|
||||
jsonPathPrompt?: JSONPathPrompt;
|
||||
outputProcessor?: OutputProcessor;
|
||||
synthesizeResponse?: boolean;
|
||||
responseSynthesisPrompt?: ResponseSynthesisPrompt;
|
||||
verbose?: boolean;
|
||||
}) {
|
||||
this.jsonValue = init.jsonValue;
|
||||
this.jsonSchema = init.jsonSchema;
|
||||
this.serviceContext = init.serviceContext ?? serviceContextFromDefaults({});
|
||||
this.jsonPathPrompt = init.jsonPathPrompt ?? defaultJsonPathPrompt;
|
||||
this.outputProcessor = init.outputProcessor ?? defaultOutputProcessor;
|
||||
this.verbose = init.verbose ?? false;
|
||||
this.synthesizeResponse = init.synthesizeResponse ?? true;
|
||||
this.responseSynthesisPrompt =
|
||||
init.responseSynthesisPrompt ?? defaultResponseSynthesizePrompt;
|
||||
}
|
||||
|
||||
getPrompts(): Record<string, unknown> {
|
||||
return {
|
||||
jsonPathPrompt: this.jsonPathPrompt,
|
||||
responseSynthesisPrompt: this.responseSynthesisPrompt,
|
||||
};
|
||||
}
|
||||
|
||||
updatePrompts(prompts: {
|
||||
jsonPathPrompt?: JSONPathPrompt;
|
||||
responseSynthesisPrompt?: ResponseSynthesisPrompt;
|
||||
}): void {
|
||||
if (prompts.jsonPathPrompt) {
|
||||
this.jsonPathPrompt = prompts.jsonPathPrompt;
|
||||
}
|
||||
if (prompts.responseSynthesisPrompt) {
|
||||
this.responseSynthesisPrompt = prompts.responseSynthesisPrompt;
|
||||
}
|
||||
}
|
||||
|
||||
getPromptModules(): Record<string, unknown> {
|
||||
return {};
|
||||
}
|
||||
|
||||
getSchemaContext(): string {
|
||||
return JSON.stringify(this.jsonSchema);
|
||||
}
|
||||
|
||||
query(
|
||||
params: QueryEngineParamsStreaming,
|
||||
): Promise<AsyncIterable<EngineResponse>>;
|
||||
query(params: QueryEngineParamsNonStreaming): Promise<EngineResponse>;
|
||||
async query(
|
||||
params: QueryEngineParamsStreaming | QueryEngineParamsNonStreaming,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>> {
|
||||
const { query, stream } = params;
|
||||
|
||||
if (stream) {
|
||||
throw new Error("Streaming is not supported");
|
||||
}
|
||||
|
||||
const schema = this.getSchemaContext();
|
||||
|
||||
const { text: jsonPathResponse } = await this.serviceContext.llm.complete({
|
||||
prompt: this.jsonPathPrompt({ query, schema }),
|
||||
});
|
||||
|
||||
if (this.verbose) {
|
||||
console.log(
|
||||
`> JSONPath Instructions:\n\`\`\`\n${jsonPathResponse}\n\`\`\`\n`,
|
||||
);
|
||||
}
|
||||
|
||||
const jsonPathOutput = await this.outputProcessor({
|
||||
llmOutput: jsonPathResponse,
|
||||
jsonValue: this.jsonValue,
|
||||
});
|
||||
|
||||
if (this.verbose) {
|
||||
console.log(`> JSONPath Output: ${jsonPathOutput}\n`);
|
||||
}
|
||||
|
||||
let responseStr;
|
||||
|
||||
if (this.synthesizeResponse) {
|
||||
responseStr = await this.serviceContext.llm.complete({
|
||||
prompt: this.responseSynthesisPrompt({
|
||||
query,
|
||||
jsonSchema: schema,
|
||||
jsonPath: jsonPathResponse,
|
||||
jsonPathValue: JSON.stringify(jsonPathOutput),
|
||||
}),
|
||||
});
|
||||
|
||||
responseStr = responseStr.text;
|
||||
} else {
|
||||
responseStr = JSON.stringify(jsonPathOutput);
|
||||
}
|
||||
|
||||
const responseMetadata = {
|
||||
jsonPathResponse,
|
||||
};
|
||||
|
||||
const response = EngineResponse.fromResponse(responseStr, false);
|
||||
|
||||
response.metadata = responseMetadata;
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export * from "./JSONQueryEngine.js";
|
||||
@@ -1,36 +0,0 @@
|
||||
export const defaultJsonPathPrompt = ({
|
||||
query,
|
||||
schema,
|
||||
}: {
|
||||
query: string;
|
||||
schema: string;
|
||||
}) => `
|
||||
We have provided a JSON schema below:
|
||||
${schema}
|
||||
Given a task, respond with a JSON Path query that can retrieve data from a JSON value that matches the schema.
|
||||
Task: ${query}
|
||||
JSONPath:
|
||||
`;
|
||||
|
||||
export type JSONPathPrompt = typeof defaultJsonPathPrompt;
|
||||
|
||||
export const defaultResponseSynthesizePrompt = ({
|
||||
query,
|
||||
jsonSchema,
|
||||
jsonPath,
|
||||
jsonPathValue,
|
||||
}: {
|
||||
query: string;
|
||||
jsonSchema: string;
|
||||
jsonPath: string;
|
||||
jsonPathValue: string;
|
||||
}) => `
|
||||
Given a query, synthesize a response to satisfy the query using the JSON results. Only include details that are relevant to the query. If you don't know the answer, then say that.
|
||||
JSON Schema: ${jsonSchema}
|
||||
JSON Path: ${jsonPath}
|
||||
Value at path: ${jsonPathValue}
|
||||
Query: ${query}
|
||||
Response:
|
||||
`;
|
||||
|
||||
export type ResponseSynthesisPrompt = typeof defaultResponseSynthesizePrompt;
|
||||
@@ -1 +0,0 @@
|
||||
export * from "./engines/query/index.js";
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
# llamaindex
|
||||
|
||||
## 0.6.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cd1383: refactor: align `response-synthesizers` & `chat-engine` module
|
||||
|
||||
- builtin event system
|
||||
- correct class extends
|
||||
- aligin APIs, naming with llama-index python
|
||||
- move stream out of first parameter to second parameter for the better tyep checking
|
||||
- remove JSONQueryEngine in `@llamaindex/experimental`, as the code quality is not satisify and we will bring it back later
|
||||
|
||||
- 5c4badb: Extend JinaAPIEmbedding parameters
|
||||
- Updated dependencies [fb36eff]
|
||||
- Updated dependencies [d24d3d1]
|
||||
- Updated dependencies [2cd1383]
|
||||
- @llamaindex/cloud@0.2.7
|
||||
- @llamaindex/core@0.2.3
|
||||
- @llamaindex/openai@0.1.5
|
||||
- @llamaindex/groq@0.0.4
|
||||
|
||||
## 0.6.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
POSTGRES_USER=runner
|
||||
@@ -1,5 +1,13 @@
|
||||
# @llamaindex/cloudflare-worker-agent-test
|
||||
|
||||
## 0.0.65
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- Updated dependencies [5c4badb]
|
||||
- llamaindex@0.6.3
|
||||
|
||||
## 0.0.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/cloudflare-worker-agent-test",
|
||||
"version": "0.0.64",
|
||||
"version": "0.0.65",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -100,7 +100,8 @@
|
||||
|
||||
/* Completeness */
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
||||
"tsBuildInfoFile": "./dist/.tsbuildinfo"
|
||||
},
|
||||
"exclude": ["test"]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @llamaindex/llama-parse-browser-test
|
||||
|
||||
## 0.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fb36eff]
|
||||
- Updated dependencies [d24d3d1]
|
||||
- @llamaindex/cloud@0.2.7
|
||||
|
||||
## 0.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/llama-parse-browser-test",
|
||||
"private": true,
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @llamaindex/next-agent-test
|
||||
|
||||
## 0.1.65
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- Updated dependencies [5c4badb]
|
||||
- llamaindex@0.6.3
|
||||
|
||||
## 0.1.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/next-agent-test",
|
||||
"version": "0.1.64",
|
||||
"version": "0.1.65",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# test-edge-runtime
|
||||
|
||||
## 0.1.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- Updated dependencies [5c4badb]
|
||||
- llamaindex@0.6.3
|
||||
|
||||
## 0.1.63
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/nextjs-edge-runtime-test",
|
||||
"version": "0.1.63",
|
||||
"version": "0.1.64",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @llamaindex/next-node-runtime
|
||||
|
||||
## 0.0.46
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- Updated dependencies [5c4badb]
|
||||
- llamaindex@0.6.3
|
||||
|
||||
## 0.0.45
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/next-node-runtime-test",
|
||||
"version": "0.0.45",
|
||||
"version": "0.0.46",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @llamaindex/waku-query-engine-test
|
||||
|
||||
## 0.0.65
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- Updated dependencies [5c4badb]
|
||||
- llamaindex@0.6.3
|
||||
|
||||
## 0.0.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/waku-query-engine-test",
|
||||
"version": "0.0.64",
|
||||
"version": "0.0.65",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
import { Document, VectorStoreIndex, type QueryEngine } from "llamaindex";
|
||||
import { BaseQueryEngine, Document, VectorStoreIndex } from "llamaindex";
|
||||
import { readFile } from "node:fs/promises";
|
||||
let _queryEngine: QueryEngine;
|
||||
let _queryEngine: BaseQueryEngine;
|
||||
|
||||
async function lazyLoadQueryEngine() {
|
||||
if (!_queryEngine) {
|
||||
|
||||
+14
-10
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable turbo/no-undeclared-env-vars */
|
||||
import { config } from "dotenv";
|
||||
import { Document, VectorStoreQueryMode } from "llamaindex";
|
||||
import { PGVectorStore } from "llamaindex/vector-store/PGVectorStore";
|
||||
import assert from "node:assert";
|
||||
@@ -5,15 +7,21 @@ import { test } from "node:test";
|
||||
import pg from "pg";
|
||||
import { registerTypes } from "pgvector/pg";
|
||||
|
||||
config({ path: [".env.local", ".env", ".env.ci"] });
|
||||
|
||||
let pgClient: pg.Client | pg.Pool;
|
||||
test.afterEach(async () => {
|
||||
await pgClient.end();
|
||||
});
|
||||
|
||||
const pgConfig = {
|
||||
user: process.env.POSTGRES_USER ?? "user",
|
||||
password: process.env.POSTGRES_PASSWORD ?? "password",
|
||||
database: "llamaindex_node_test",
|
||||
};
|
||||
|
||||
await test("init with client", async () => {
|
||||
pgClient = new pg.Client({
|
||||
database: "llamaindex_node_test",
|
||||
});
|
||||
pgClient = new pg.Client(pgConfig);
|
||||
await pgClient.connect();
|
||||
await pgClient.query("CREATE EXTENSION IF NOT EXISTS vector");
|
||||
await registerTypes(pgClient);
|
||||
@@ -22,9 +30,7 @@ await test("init with client", async () => {
|
||||
});
|
||||
|
||||
await test("init with pool", async () => {
|
||||
pgClient = new pg.Pool({
|
||||
database: "llamaindex_node_test",
|
||||
});
|
||||
pgClient = new pg.Pool(pgConfig);
|
||||
await pgClient.query("CREATE EXTENSION IF NOT EXISTS vector");
|
||||
const client = await pgClient.connect();
|
||||
await registerTypes(client);
|
||||
@@ -34,9 +40,7 @@ await test("init with pool", async () => {
|
||||
});
|
||||
|
||||
await test("init without client", async () => {
|
||||
const vectorStore = new PGVectorStore({
|
||||
database: "llamaindex_node_test",
|
||||
});
|
||||
const vectorStore = new PGVectorStore(pgConfig);
|
||||
pgClient = (await vectorStore.client()) as pg.Client;
|
||||
assert.notDeepStrictEqual(pgClient, undefined);
|
||||
});
|
||||
@@ -52,7 +56,7 @@ await test("simple node", async () => {
|
||||
embedding: [0.1, 0.2, 0.3],
|
||||
});
|
||||
const vectorStore = new PGVectorStore({
|
||||
database: "llamaindex_node_test",
|
||||
...pgConfig,
|
||||
dimensions,
|
||||
schemaName,
|
||||
});
|
||||
@@ -4,14 +4,15 @@
|
||||
"version": "0.0.7",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"e2e": "node --import tsx --import ./mock-register.js --test ./node/*.e2e.ts",
|
||||
"e2e:nomock": "node --import tsx --test ./node/*.e2e.ts",
|
||||
"e2e:updatesnap": "UPDATE_SNAPSHOT=1 node --import tsx --test ./node/*.e2e.ts"
|
||||
"e2e": "node --import tsx --import ./mock-register.js --test ./node/**/*.e2e.ts",
|
||||
"e2e:nomock": "node --import tsx --test ./node/**/*.e2e.ts",
|
||||
"e2e:updatesnap": "UPDATE_SNAPSHOT=1 node --import tsx --test ./node/**/*.e2e.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@faker-js/faker": "^8.4.1",
|
||||
"@faker-js/faker": "^9.0.1",
|
||||
"@types/node": "^22.5.1",
|
||||
"consola": "^3.2.3",
|
||||
"dotenv": "^16.4.5",
|
||||
"llamaindex": "workspace:*",
|
||||
"tsx": "^4.19.0"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "llamaindex",
|
||||
"version": "0.6.2",
|
||||
"version": "0.6.3",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"keywords": [
|
||||
|
||||
@@ -9,6 +9,8 @@ import { OpenAI, OpenAIEmbedding } from "@llamaindex/openai";
|
||||
|
||||
/**
|
||||
* The ServiceContext is a collection of components that are used in different parts of the application.
|
||||
*
|
||||
* @deprecated This will no longer supported, please use `Settings` instead.
|
||||
*/
|
||||
export interface ServiceContext {
|
||||
llm: LLM;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { BaseQueryEngine } from "@llamaindex/core/query-engine";
|
||||
import type { BaseSynthesizer } from "@llamaindex/core/response-synthesizers";
|
||||
import type { Document, TransformComponent } from "@llamaindex/core/schema";
|
||||
import type { BaseRetriever } from "../Retriever.js";
|
||||
import { RetrieverQueryEngine } from "../engines/query/RetrieverQueryEngine.js";
|
||||
import type { BaseNodePostprocessor } from "../postprocessors/types.js";
|
||||
import type { BaseSynthesizer } from "../synthesizers/types.js";
|
||||
import type { QueryEngine } from "../types.js";
|
||||
import type { CloudRetrieveParams } from "./LlamaCloudRetriever.js";
|
||||
import { LlamaCloudRetriever } from "./LlamaCloudRetriever.js";
|
||||
import { getPipelineCreate } from "./config.js";
|
||||
@@ -300,7 +300,7 @@ export class LlamaCloudIndex {
|
||||
preFilters?: unknown;
|
||||
nodePostprocessors?: BaseNodePostprocessor[];
|
||||
} & CloudRetrieveParams,
|
||||
): QueryEngine {
|
||||
): BaseQueryEngine {
|
||||
const retriever = new LlamaCloudRetriever({
|
||||
...this.params,
|
||||
...params,
|
||||
|
||||
@@ -20,8 +20,9 @@ export type JinaEmbeddingRequest = {
|
||||
input: Array<{ text: string } | { url: string } | { bytes: string }>;
|
||||
model?: string;
|
||||
encoding_type?: EncodingType;
|
||||
task_type?: TaskType;
|
||||
task?: TaskType;
|
||||
dimensions?: number;
|
||||
late_chunking?: boolean;
|
||||
};
|
||||
|
||||
export type JinaEmbeddingResponse = {
|
||||
@@ -44,9 +45,10 @@ export class JinaAIEmbedding extends MultiModalEmbedding {
|
||||
apiKey: string;
|
||||
model: string;
|
||||
baseURL: string;
|
||||
taskType: TaskType | undefined;
|
||||
task?: TaskType | undefined;
|
||||
encodingType?: EncodingType | undefined;
|
||||
dimensions?: number | undefined;
|
||||
late_chunking?: boolean | undefined;
|
||||
|
||||
async getTextEmbedding(text: string): Promise<number[]> {
|
||||
const result = await this.getJinaEmbedding({ input: [{ text }] });
|
||||
@@ -87,8 +89,10 @@ export class JinaAIEmbedding extends MultiModalEmbedding {
|
||||
this.model = init?.model ?? "jina-embeddings-v3";
|
||||
this.baseURL = init?.baseURL ?? "https://api.jina.ai/v1/embeddings";
|
||||
init?.embedBatchSize && (this.embedBatchSize = init?.embedBatchSize);
|
||||
this.taskType = init?.taskType;
|
||||
this.task = init?.task;
|
||||
this.encodingType = init?.encodingType;
|
||||
this.dimensions = init?.dimensions;
|
||||
this.late_chunking = init?.late_chunking;
|
||||
}
|
||||
|
||||
private async getImageInput(
|
||||
@@ -125,8 +129,11 @@ export class JinaAIEmbedding extends MultiModalEmbedding {
|
||||
body: JSON.stringify({
|
||||
model: this.model,
|
||||
encoding_type: this.encodingType ?? "float",
|
||||
...(this.taskType && { task_type: this.taskType }),
|
||||
...(this.task && { task: this.task }),
|
||||
...(this.dimensions !== undefined && { dimensions: this.dimensions }),
|
||||
...(this.late_chunking !== undefined && {
|
||||
late_chunking: this.late_chunking,
|
||||
}),
|
||||
...params,
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
type ModuleRecord,
|
||||
PromptMixin,
|
||||
} from "@llamaindex/core/prompts";
|
||||
import type { BaseQueryEngine } from "@llamaindex/core/query-engine";
|
||||
import type { EngineResponse } from "@llamaindex/core/schema";
|
||||
import {
|
||||
extractText,
|
||||
@@ -15,7 +16,6 @@ import {
|
||||
} from "@llamaindex/core/utils";
|
||||
import type { ServiceContext } from "../../ServiceContext.js";
|
||||
import { llmFromSettingsOrContext } from "../../Settings.js";
|
||||
import type { QueryEngine } from "../../types.js";
|
||||
import type {
|
||||
ChatEngine,
|
||||
ChatEngineParamsNonStreaming,
|
||||
@@ -37,13 +37,13 @@ export class CondenseQuestionChatEngine
|
||||
extends PromptMixin
|
||||
implements ChatEngine
|
||||
{
|
||||
queryEngine: QueryEngine;
|
||||
queryEngine: BaseQueryEngine;
|
||||
chatHistory: BaseMemory;
|
||||
llm: LLM;
|
||||
condenseMessagePrompt: CondenseQuestionPrompt;
|
||||
|
||||
constructor(init: {
|
||||
queryEngine: QueryEngine;
|
||||
queryEngine: BaseQueryEngine;
|
||||
chatHistory: ChatMessage[];
|
||||
serviceContext?: ServiceContext;
|
||||
condenseMessagePrompt?: CondenseQuestionPrompt;
|
||||
@@ -114,10 +114,12 @@ export class CondenseQuestionChatEngine
|
||||
chatHistory.put({ content: message, role: "user" });
|
||||
|
||||
if (stream) {
|
||||
const stream = await this.queryEngine.query({
|
||||
query: condensedQuestion,
|
||||
stream: true,
|
||||
});
|
||||
const stream = await this.queryEngine.query(
|
||||
{
|
||||
query: condensedQuestion,
|
||||
},
|
||||
true,
|
||||
);
|
||||
return streamReducer({
|
||||
stream,
|
||||
initialValue: "",
|
||||
|
||||
@@ -6,9 +6,9 @@ import {
|
||||
PromptMixin,
|
||||
} from "@llamaindex/core/prompts";
|
||||
import { MetadataMode, type NodeWithScore } from "@llamaindex/core/schema";
|
||||
import { createMessageContent } from "@llamaindex/core/utils";
|
||||
import type { BaseNodePostprocessor } from "../../postprocessors/index.js";
|
||||
import type { BaseRetriever } from "../../Retriever.js";
|
||||
import { createMessageContent } from "../../synthesizers/utils.js";
|
||||
import type { Context, ContextGenerator } from "./types.js";
|
||||
|
||||
export class DefaultContextGenerator
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
import { PromptMixin } from "@llamaindex/core/prompts";
|
||||
import { EngineResponse, type NodeWithScore } from "@llamaindex/core/schema";
|
||||
import { wrapEventCaller } from "@llamaindex/core/utils";
|
||||
import { BaseQueryEngine } from "@llamaindex/core/query-engine";
|
||||
import type { BaseSynthesizer } from "@llamaindex/core/response-synthesizers";
|
||||
import { getResponseSynthesizer } from "@llamaindex/core/response-synthesizers";
|
||||
import { type NodeWithScore } from "@llamaindex/core/schema";
|
||||
import { extractText } from "@llamaindex/core/utils";
|
||||
import type { BaseNodePostprocessor } from "../../postprocessors/index.js";
|
||||
import type { BaseRetriever } from "../../Retriever.js";
|
||||
import type { BaseSynthesizer } from "../../synthesizers/index.js";
|
||||
import { ResponseSynthesizer } from "../../synthesizers/index.js";
|
||||
import type {
|
||||
QueryEngine,
|
||||
QueryEngineParamsNonStreaming,
|
||||
QueryEngineParamsStreaming,
|
||||
} from "../../types.js";
|
||||
|
||||
/**
|
||||
* A query engine that uses a retriever to query an index and then synthesizes the response.
|
||||
*/
|
||||
export class RetrieverQueryEngine extends PromptMixin implements QueryEngine {
|
||||
export class RetrieverQueryEngine extends BaseQueryEngine {
|
||||
retriever: BaseRetriever;
|
||||
responseSynthesizer: BaseSynthesizer;
|
||||
nodePostprocessors: BaseNodePostprocessor[];
|
||||
@@ -26,14 +21,36 @@ export class RetrieverQueryEngine extends PromptMixin implements QueryEngine {
|
||||
preFilters?: unknown,
|
||||
nodePostprocessors?: BaseNodePostprocessor[],
|
||||
) {
|
||||
super();
|
||||
super(async (strOrQueryBundle, stream) => {
|
||||
const nodesWithScore = await this.retrieve(
|
||||
typeof strOrQueryBundle === "string"
|
||||
? strOrQueryBundle
|
||||
: extractText(strOrQueryBundle),
|
||||
);
|
||||
if (stream) {
|
||||
return this.responseSynthesizer.synthesize(
|
||||
{
|
||||
query:
|
||||
typeof strOrQueryBundle === "string"
|
||||
? { query: strOrQueryBundle }
|
||||
: strOrQueryBundle,
|
||||
nodes: nodesWithScore,
|
||||
},
|
||||
true,
|
||||
);
|
||||
}
|
||||
return this.responseSynthesizer.synthesize({
|
||||
query:
|
||||
typeof strOrQueryBundle === "string"
|
||||
? { query: strOrQueryBundle }
|
||||
: strOrQueryBundle,
|
||||
nodes: nodesWithScore,
|
||||
});
|
||||
});
|
||||
|
||||
this.retriever = retriever;
|
||||
this.responseSynthesizer =
|
||||
responseSynthesizer ||
|
||||
new ResponseSynthesizer({
|
||||
serviceContext: retriever.serviceContext,
|
||||
});
|
||||
responseSynthesizer || getResponseSynthesizer("compact");
|
||||
this.preFilters = preFilters;
|
||||
this.nodePostprocessors = nodePostprocessors || [];
|
||||
}
|
||||
@@ -71,29 +88,4 @@ export class RetrieverQueryEngine extends PromptMixin implements QueryEngine {
|
||||
|
||||
return await this.applyNodePostprocessors(nodes, query);
|
||||
}
|
||||
|
||||
query(
|
||||
params: QueryEngineParamsStreaming,
|
||||
): Promise<AsyncIterable<EngineResponse>>;
|
||||
query(params: QueryEngineParamsNonStreaming): Promise<EngineResponse>;
|
||||
@wrapEventCaller
|
||||
async query(
|
||||
params: QueryEngineParamsStreaming | QueryEngineParamsNonStreaming,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>> {
|
||||
const { query, stream } = params;
|
||||
const nodesWithScore = await this.retrieve(query);
|
||||
if (stream) {
|
||||
return this.responseSynthesizer.synthesize(
|
||||
{
|
||||
query,
|
||||
nodesWithScore,
|
||||
},
|
||||
true,
|
||||
);
|
||||
}
|
||||
return this.responseSynthesizer.synthesize({
|
||||
query,
|
||||
nodesWithScore,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { PromptMixin } from "@llamaindex/core/prompts";
|
||||
import type { QueryType } from "@llamaindex/core/query-engine";
|
||||
import {
|
||||
BaseQueryEngine,
|
||||
type QueryBundle,
|
||||
} from "@llamaindex/core/query-engine";
|
||||
import {
|
||||
BaseSynthesizer,
|
||||
getResponseSynthesizer,
|
||||
} from "@llamaindex/core/response-synthesizers";
|
||||
import { EngineResponse, type NodeWithScore } from "@llamaindex/core/schema";
|
||||
import { extractText } from "@llamaindex/core/utils";
|
||||
import type { ServiceContext } from "../../ServiceContext.js";
|
||||
import { llmFromSettingsOrContext } from "../../Settings.js";
|
||||
import type { BaseSelector } from "../../selectors/index.js";
|
||||
import { LLMSingleSelector } from "../../selectors/index.js";
|
||||
import { TreeSummarize } from "../../synthesizers/index.js";
|
||||
import type {
|
||||
QueryEngine,
|
||||
QueryEngineParamsNonStreaming,
|
||||
QueryEngineParamsStreaming,
|
||||
} from "../../types.js";
|
||||
|
||||
type RouterQueryEngineTool = {
|
||||
queryEngine: QueryEngine;
|
||||
queryEngine: BaseQueryEngine;
|
||||
description: string;
|
||||
};
|
||||
|
||||
@@ -23,59 +23,67 @@ type RouterQueryEngineMetadata = {
|
||||
};
|
||||
|
||||
async function combineResponses(
|
||||
summarizer: TreeSummarize,
|
||||
summarizer: BaseSynthesizer,
|
||||
responses: EngineResponse[],
|
||||
queryType: QueryType,
|
||||
queryBundle: QueryBundle,
|
||||
verbose: boolean = false,
|
||||
): Promise<EngineResponse> {
|
||||
if (verbose) {
|
||||
console.log("Combining responses from multiple query engines.");
|
||||
}
|
||||
|
||||
const responseStrs: string[] = [];
|
||||
const sourceNodes: NodeWithScore[] = [];
|
||||
|
||||
for (const response of responses) {
|
||||
if (response?.sourceNodes) {
|
||||
sourceNodes.push(...response.sourceNodes);
|
||||
}
|
||||
|
||||
responseStrs.push(extractText(response.message.content));
|
||||
}
|
||||
|
||||
const summary = await summarizer.getResponse({
|
||||
query: extractText(queryType),
|
||||
textChunks: responseStrs,
|
||||
return await summarizer.synthesize({
|
||||
query: queryBundle,
|
||||
nodes: sourceNodes,
|
||||
});
|
||||
|
||||
return EngineResponse.fromResponse(summary, false, sourceNodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* A query engine that uses multiple query engines and selects the best one.
|
||||
*/
|
||||
export class RouterQueryEngine extends PromptMixin implements QueryEngine {
|
||||
export class RouterQueryEngine extends BaseQueryEngine {
|
||||
private selector: BaseSelector;
|
||||
private queryEngines: QueryEngine[];
|
||||
private queryEngines: BaseQueryEngine[];
|
||||
private metadatas: RouterQueryEngineMetadata[];
|
||||
private summarizer: TreeSummarize;
|
||||
private summarizer: BaseSynthesizer;
|
||||
private verbose: boolean;
|
||||
|
||||
constructor(init: {
|
||||
selector: BaseSelector;
|
||||
queryEngineTools: RouterQueryEngineTool[];
|
||||
serviceContext?: ServiceContext | undefined;
|
||||
summarizer?: TreeSummarize | undefined;
|
||||
summarizer?: BaseSynthesizer | undefined;
|
||||
verbose?: boolean | undefined;
|
||||
}) {
|
||||
super();
|
||||
super(async (strOrQueryBundle, stream) => {
|
||||
const response = await this.queryRoute(
|
||||
typeof strOrQueryBundle === "string"
|
||||
? { query: strOrQueryBundle }
|
||||
: strOrQueryBundle,
|
||||
);
|
||||
|
||||
if (stream) {
|
||||
throw new Error("Streaming is not supported yet.");
|
||||
}
|
||||
|
||||
return response;
|
||||
});
|
||||
|
||||
this.selector = init.selector;
|
||||
this.queryEngines = init.queryEngineTools.map((tool) => tool.queryEngine);
|
||||
this.metadatas = init.queryEngineTools.map((tool) => ({
|
||||
description: tool.description,
|
||||
}));
|
||||
this.summarizer = init.summarizer || new TreeSummarize(init.serviceContext);
|
||||
this.summarizer =
|
||||
init.summarizer || getResponseSynthesizer("tree_summarize");
|
||||
this.verbose = init.verbose ?? false;
|
||||
}
|
||||
|
||||
@@ -96,7 +104,7 @@ export class RouterQueryEngine extends PromptMixin implements QueryEngine {
|
||||
queryEngineTools: RouterQueryEngineTool[];
|
||||
selector?: BaseSelector;
|
||||
serviceContext?: ServiceContext;
|
||||
summarizer?: TreeSummarize;
|
||||
summarizer?: BaseSynthesizer;
|
||||
verbose?: boolean;
|
||||
}) {
|
||||
const serviceContext = init.serviceContext;
|
||||
@@ -114,25 +122,7 @@ export class RouterQueryEngine extends PromptMixin implements QueryEngine {
|
||||
});
|
||||
}
|
||||
|
||||
query(
|
||||
params: QueryEngineParamsStreaming,
|
||||
): Promise<AsyncIterable<EngineResponse>>;
|
||||
query(params: QueryEngineParamsNonStreaming): Promise<EngineResponse>;
|
||||
async query(
|
||||
params: QueryEngineParamsStreaming | QueryEngineParamsNonStreaming,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>> {
|
||||
const { query, stream } = params;
|
||||
|
||||
const response = await this.queryRoute(query);
|
||||
|
||||
if (stream) {
|
||||
throw new Error("Streaming is not supported yet.");
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private async queryRoute(query: QueryType): Promise<EngineResponse> {
|
||||
private async queryRoute(query: QueryBundle): Promise<EngineResponse> {
|
||||
const result = await this.selector.select(this.metadatas, query);
|
||||
|
||||
if (result.selections.length > 1) {
|
||||
@@ -146,11 +136,7 @@ export class RouterQueryEngine extends PromptMixin implements QueryEngine {
|
||||
}
|
||||
|
||||
const selectedQueryEngine = this.queryEngines[engineInd.index]!;
|
||||
responses.push(
|
||||
await selectedQueryEngine.query({
|
||||
query: extractText(query),
|
||||
}),
|
||||
);
|
||||
responses.push(await selectedQueryEngine.query(query));
|
||||
}
|
||||
|
||||
if (responses.length > 1) {
|
||||
|
||||
@@ -1,29 +1,21 @@
|
||||
import {
|
||||
EngineResponse,
|
||||
TextNode,
|
||||
type NodeWithScore,
|
||||
} from "@llamaindex/core/schema";
|
||||
import type { BaseSynthesizer } from "@llamaindex/core/response-synthesizers";
|
||||
import { getResponseSynthesizer } from "@llamaindex/core/response-synthesizers";
|
||||
import { TextNode, type NodeWithScore } from "@llamaindex/core/schema";
|
||||
import { LLMQuestionGenerator } from "../../QuestionGenerator.js";
|
||||
import type { ServiceContext } from "../../ServiceContext.js";
|
||||
import type { BaseSynthesizer } from "../../synthesizers/index.js";
|
||||
import {
|
||||
CompactAndRefine,
|
||||
ResponseSynthesizer,
|
||||
} from "../../synthesizers/index.js";
|
||||
|
||||
import type { BaseTool, ToolMetadata } from "@llamaindex/core/llms";
|
||||
import { PromptMixin, type PromptsRecord } from "@llamaindex/core/prompts";
|
||||
import type { BaseQueryEngine, QueryType } from "@llamaindex/core/query-engine";
|
||||
import { wrapEventCaller } from "@llamaindex/core/utils";
|
||||
import type { PromptsRecord } from "@llamaindex/core/prompts";
|
||||
import {
|
||||
BaseQueryEngine,
|
||||
type QueryBundle,
|
||||
} from "@llamaindex/core/query-engine";
|
||||
import type { BaseQuestionGenerator, SubQuestion } from "./types.js";
|
||||
|
||||
/**
|
||||
* SubQuestionQueryEngine decomposes a question into subquestions and then
|
||||
*/
|
||||
export class SubQuestionQueryEngine
|
||||
extends PromptMixin
|
||||
implements BaseQueryEngine
|
||||
{
|
||||
export class SubQuestionQueryEngine extends BaseQueryEngine {
|
||||
responseSynthesizer: BaseSynthesizer;
|
||||
questionGen: BaseQuestionGenerator;
|
||||
queryEngines: BaseTool[];
|
||||
@@ -34,11 +26,48 @@ export class SubQuestionQueryEngine
|
||||
responseSynthesizer: BaseSynthesizer;
|
||||
queryEngineTools: BaseTool[];
|
||||
}) {
|
||||
super();
|
||||
super(async (strOrQueryBundle, stream) => {
|
||||
let query: QueryBundle;
|
||||
if (typeof strOrQueryBundle === "string") {
|
||||
query = {
|
||||
query: strOrQueryBundle,
|
||||
};
|
||||
} else {
|
||||
query = strOrQueryBundle;
|
||||
}
|
||||
const subQuestions = await this.questionGen.generate(
|
||||
this.metadatas,
|
||||
strOrQueryBundle,
|
||||
);
|
||||
|
||||
const subQNodes = await Promise.all(
|
||||
subQuestions.map((subQ) => this.querySubQ(subQ)),
|
||||
);
|
||||
|
||||
const nodesWithScore: NodeWithScore[] = subQNodes.filter(
|
||||
(node) => node !== null,
|
||||
);
|
||||
if (stream) {
|
||||
return this.responseSynthesizer.synthesize(
|
||||
{
|
||||
query,
|
||||
nodes: nodesWithScore,
|
||||
},
|
||||
true,
|
||||
);
|
||||
}
|
||||
return this.responseSynthesizer.synthesize(
|
||||
{
|
||||
query,
|
||||
nodes: nodesWithScore,
|
||||
},
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
this.questionGen = init.questionGen;
|
||||
this.responseSynthesizer =
|
||||
init.responseSynthesizer ?? new ResponseSynthesizer();
|
||||
init.responseSynthesizer ?? getResponseSynthesizer("compact");
|
||||
this.queryEngines = init.queryEngineTools;
|
||||
this.metadatas = init.queryEngineTools.map((tool) => tool.metadata);
|
||||
}
|
||||
@@ -62,15 +91,9 @@ export class SubQuestionQueryEngine
|
||||
responseSynthesizer?: BaseSynthesizer;
|
||||
serviceContext?: ServiceContext;
|
||||
}) {
|
||||
const serviceContext = init.serviceContext;
|
||||
|
||||
const questionGen = init.questionGen ?? new LLMQuestionGenerator();
|
||||
const responseSynthesizer =
|
||||
init.responseSynthesizer ??
|
||||
new ResponseSynthesizer({
|
||||
responseBuilder: new CompactAndRefine(serviceContext),
|
||||
serviceContext,
|
||||
});
|
||||
init.responseSynthesizer ?? getResponseSynthesizer("compact");
|
||||
|
||||
return new SubQuestionQueryEngine({
|
||||
questionGen,
|
||||
@@ -79,40 +102,6 @@ export class SubQuestionQueryEngine
|
||||
});
|
||||
}
|
||||
|
||||
query(query: QueryType, stream: true): Promise<AsyncIterable<EngineResponse>>;
|
||||
query(query: QueryType, stream?: false): Promise<EngineResponse>;
|
||||
@wrapEventCaller
|
||||
async query(
|
||||
query: QueryType,
|
||||
stream?: boolean,
|
||||
): Promise<EngineResponse | AsyncIterable<EngineResponse>> {
|
||||
const subQuestions = await this.questionGen.generate(this.metadatas, query);
|
||||
|
||||
const subQNodes = await Promise.all(
|
||||
subQuestions.map((subQ) => this.querySubQ(subQ)),
|
||||
);
|
||||
|
||||
const nodesWithScore = subQNodes
|
||||
.filter((node) => node !== null)
|
||||
.map((node) => node as NodeWithScore);
|
||||
if (stream) {
|
||||
return this.responseSynthesizer.synthesize(
|
||||
{
|
||||
query,
|
||||
nodesWithScore,
|
||||
},
|
||||
true,
|
||||
);
|
||||
}
|
||||
return this.responseSynthesizer.synthesize(
|
||||
{
|
||||
query,
|
||||
nodesWithScore,
|
||||
},
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
private async querySubQ(subQ: SubQuestion): Promise<NodeWithScore | null> {
|
||||
try {
|
||||
const question = subQ.subQuestion;
|
||||
|
||||
@@ -33,6 +33,8 @@ export type {
|
||||
export * from "@llamaindex/core/indices";
|
||||
export * from "@llamaindex/core/llms";
|
||||
export * from "@llamaindex/core/prompts";
|
||||
export * from "@llamaindex/core/query-engine";
|
||||
export * from "@llamaindex/core/response-synthesizers";
|
||||
export * from "@llamaindex/core/schema";
|
||||
|
||||
declare module "@llamaindex/core/global" {
|
||||
@@ -69,6 +71,5 @@ export * from "./selectors/index.js";
|
||||
export * from "./ServiceContext.js";
|
||||
export { Settings } from "./Settings.js";
|
||||
export * from "./storage/StorageContext.js";
|
||||
export * from "./synthesizers/index.js";
|
||||
export * from "./tools/index.js";
|
||||
export * from "./types.js";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import type { BaseQueryEngine } from "@llamaindex/core/query-engine";
|
||||
import type { BaseSynthesizer } from "@llamaindex/core/response-synthesizers";
|
||||
import type { BaseNode, Document } from "@llamaindex/core/schema";
|
||||
import type { BaseRetriever } from "../Retriever.js";
|
||||
import type { ServiceContext } from "../ServiceContext.js";
|
||||
@@ -6,8 +8,6 @@ import { runTransformations } from "../ingestion/IngestionPipeline.js";
|
||||
import type { StorageContext } from "../storage/StorageContext.js";
|
||||
import type { BaseDocumentStore } from "../storage/docStore/types.js";
|
||||
import type { BaseIndexStore } from "../storage/indexStore/types.js";
|
||||
import type { BaseSynthesizer } from "../synthesizers/types.js";
|
||||
import type { QueryEngine } from "../types.js";
|
||||
import { IndexStruct } from "./IndexStruct.js";
|
||||
import { IndexStructType } from "./json-to-index-struct.js";
|
||||
|
||||
@@ -83,7 +83,7 @@ export abstract class BaseIndex<T> {
|
||||
abstract asQueryEngine(options?: {
|
||||
retriever?: BaseRetriever;
|
||||
responseSynthesizer?: BaseSynthesizer;
|
||||
}): QueryEngine;
|
||||
}): BaseQueryEngine;
|
||||
|
||||
/**
|
||||
* Insert a document into the index.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { BaseSynthesizer } from "@llamaindex/core/response-synthesizers";
|
||||
import type {
|
||||
BaseNode,
|
||||
Document,
|
||||
@@ -12,8 +13,6 @@ import type { BaseNodePostprocessor } from "../../postprocessors/index.js";
|
||||
import type { StorageContext } from "../../storage/StorageContext.js";
|
||||
import { storageContextFromDefaults } from "../../storage/StorageContext.js";
|
||||
import type { BaseDocumentStore } from "../../storage/docStore/types.js";
|
||||
import type { BaseSynthesizer } from "../../synthesizers/index.js";
|
||||
import type { QueryEngine } from "../../types.js";
|
||||
import type { BaseIndexInit } from "../BaseIndex.js";
|
||||
import { BaseIndex, KeywordTable } from "../BaseIndex.js";
|
||||
import { IndexStructType } from "../json-to-index-struct.js";
|
||||
@@ -30,6 +29,7 @@ import {
|
||||
type KeywordExtractPrompt,
|
||||
type QueryKeywordExtractPrompt,
|
||||
} from "@llamaindex/core/prompts";
|
||||
import type { BaseQueryEngine } from "@llamaindex/core/query-engine";
|
||||
import { extractText } from "@llamaindex/core/utils";
|
||||
import { llmFromSettingsOrContext } from "../../Settings.js";
|
||||
|
||||
@@ -237,7 +237,7 @@ export class KeywordTableIndex extends BaseIndex<KeywordTable> {
|
||||
responseSynthesizer?: BaseSynthesizer;
|
||||
preFilters?: unknown;
|
||||
nodePostprocessors?: BaseNodePostprocessor[];
|
||||
}): QueryEngine {
|
||||
}): BaseQueryEngine {
|
||||
const { retriever, responseSynthesizer } = options ?? {};
|
||||
return new RetrieverQueryEngine(
|
||||
retriever ?? this.asRetriever(),
|
||||
|
||||
@@ -2,6 +2,8 @@ import {
|
||||
type ChoiceSelectPrompt,
|
||||
defaultChoiceSelectPrompt,
|
||||
} from "@llamaindex/core/prompts";
|
||||
import type { BaseSynthesizer } from "@llamaindex/core/response-synthesizers";
|
||||
import { getResponseSynthesizer } from "@llamaindex/core/response-synthesizers";
|
||||
import type {
|
||||
BaseNode,
|
||||
Document,
|
||||
@@ -23,12 +25,6 @@ import type {
|
||||
BaseDocumentStore,
|
||||
RefDocInfo,
|
||||
} from "../../storage/docStore/types.js";
|
||||
import type { BaseSynthesizer } from "../../synthesizers/index.js";
|
||||
import {
|
||||
CompactAndRefine,
|
||||
ResponseSynthesizer,
|
||||
} from "../../synthesizers/index.js";
|
||||
import type { QueryEngine } from "../../types.js";
|
||||
import type { BaseIndexInit } from "../BaseIndex.js";
|
||||
import { BaseIndex } from "../BaseIndex.js";
|
||||
import { IndexList, IndexStructType } from "../json-to-index-struct.js";
|
||||
@@ -178,7 +174,7 @@ export class SummaryIndex extends BaseIndex<IndexList> {
|
||||
responseSynthesizer?: BaseSynthesizer;
|
||||
preFilters?: unknown;
|
||||
nodePostprocessors?: BaseNodePostprocessor[];
|
||||
}): QueryEngine & RetrieverQueryEngine {
|
||||
}): RetrieverQueryEngine {
|
||||
let { retriever, responseSynthesizer } = options ?? {};
|
||||
|
||||
if (!retriever) {
|
||||
@@ -186,11 +182,7 @@ export class SummaryIndex extends BaseIndex<IndexList> {
|
||||
}
|
||||
|
||||
if (!responseSynthesizer) {
|
||||
const responseBuilder = new CompactAndRefine(this.serviceContext);
|
||||
responseSynthesizer = new ResponseSynthesizer({
|
||||
serviceContext: this.serviceContext,
|
||||
responseBuilder,
|
||||
});
|
||||
responseSynthesizer = getResponseSynthesizer("compact");
|
||||
}
|
||||
|
||||
return new RetrieverQueryEngine(
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
} from "@llamaindex/core/embeddings";
|
||||
import { Settings } from "@llamaindex/core/global";
|
||||
import type { MessageContent } from "@llamaindex/core/llms";
|
||||
import type { BaseSynthesizer } from "@llamaindex/core/response-synthesizers";
|
||||
import {
|
||||
ImageNode,
|
||||
ModalityType,
|
||||
@@ -30,8 +31,6 @@ import type { BaseNodePostprocessor } from "../../postprocessors/types.js";
|
||||
import type { StorageContext } from "../../storage/StorageContext.js";
|
||||
import { storageContextFromDefaults } from "../../storage/StorageContext.js";
|
||||
import type { BaseIndexStore } from "../../storage/indexStore/types.js";
|
||||
import type { BaseSynthesizer } from "../../synthesizers/types.js";
|
||||
import type { QueryEngine } from "../../types.js";
|
||||
import type {
|
||||
MetadataFilters,
|
||||
VectorStore,
|
||||
@@ -288,7 +287,7 @@ export class VectorStoreIndex extends BaseIndex<IndexDict> {
|
||||
preFilters?: MetadataFilters;
|
||||
nodePostprocessors?: BaseNodePostprocessor[];
|
||||
similarityTopK?: number;
|
||||
}): QueryEngine & RetrieverQueryEngine {
|
||||
}): RetrieverQueryEngine {
|
||||
const {
|
||||
retriever,
|
||||
responseSynthesizer,
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
import {
|
||||
defaultTextQAPrompt,
|
||||
PromptMixin,
|
||||
type ModuleRecord,
|
||||
type TextQAPrompt,
|
||||
} from "@llamaindex/core/prompts";
|
||||
import { EngineResponse, MetadataMode } from "@llamaindex/core/schema";
|
||||
import { streamConverter } from "@llamaindex/core/utils";
|
||||
import type { ServiceContext } from "../ServiceContext.js";
|
||||
import { llmFromSettingsOrContext } from "../Settings.js";
|
||||
import type { BaseSynthesizer, SynthesizeQuery } from "./types.js";
|
||||
import { createMessageContent } from "./utils.js";
|
||||
|
||||
export class MultiModalResponseSynthesizer
|
||||
extends PromptMixin
|
||||
implements BaseSynthesizer
|
||||
{
|
||||
serviceContext?: ServiceContext | undefined;
|
||||
metadataMode: MetadataMode;
|
||||
textQATemplate: TextQAPrompt;
|
||||
|
||||
constructor({
|
||||
serviceContext,
|
||||
textQATemplate,
|
||||
metadataMode,
|
||||
}: Partial<MultiModalResponseSynthesizer> = {}) {
|
||||
super();
|
||||
|
||||
this.serviceContext = serviceContext;
|
||||
this.metadataMode = metadataMode ?? MetadataMode.NONE;
|
||||
this.textQATemplate = textQATemplate ?? defaultTextQAPrompt;
|
||||
}
|
||||
|
||||
protected _getPromptModules(): ModuleRecord {
|
||||
return {};
|
||||
}
|
||||
|
||||
protected _getPrompts(): { textQATemplate: TextQAPrompt } {
|
||||
return {
|
||||
textQATemplate: this.textQATemplate,
|
||||
};
|
||||
}
|
||||
|
||||
protected _updatePrompts(promptsDict: {
|
||||
textQATemplate: TextQAPrompt;
|
||||
}): void {
|
||||
if (promptsDict.textQATemplate) {
|
||||
this.textQATemplate = promptsDict.textQATemplate;
|
||||
}
|
||||
}
|
||||
|
||||
synthesize(
|
||||
query: SynthesizeQuery,
|
||||
stream: true,
|
||||
): Promise<AsyncIterable<EngineResponse>>;
|
||||
synthesize(query: SynthesizeQuery, stream?: false): Promise<EngineResponse>;
|
||||
async synthesize(
|
||||
query: SynthesizeQuery,
|
||||
stream?: boolean,
|
||||
): Promise<AsyncIterable<EngineResponse> | EngineResponse> {
|
||||
const { nodesWithScore } = query;
|
||||
const nodes = nodesWithScore.map(({ node }) => node);
|
||||
const prompt = await createMessageContent(
|
||||
this.textQATemplate,
|
||||
nodes,
|
||||
// fixme: wtf type is this?
|
||||
// { query },
|
||||
{},
|
||||
this.metadataMode,
|
||||
);
|
||||
|
||||
const llm = llmFromSettingsOrContext(this.serviceContext);
|
||||
|
||||
if (stream) {
|
||||
const response = await llm.complete({
|
||||
prompt,
|
||||
stream,
|
||||
});
|
||||
return streamConverter(response, ({ text }) =>
|
||||
EngineResponse.fromResponse(text, true, nodesWithScore),
|
||||
);
|
||||
}
|
||||
const response = await llm.complete({
|
||||
prompt,
|
||||
});
|
||||
return EngineResponse.fromResponse(response.text, false, nodesWithScore);
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
import { PromptMixin, type PromptsRecord } from "@llamaindex/core/prompts";
|
||||
import { EngineResponse, MetadataMode } from "@llamaindex/core/schema";
|
||||
import { streamConverter } from "@llamaindex/core/utils";
|
||||
import type { ServiceContext } from "../ServiceContext.js";
|
||||
import { getResponseBuilder } from "./builders.js";
|
||||
import type {
|
||||
BaseSynthesizer,
|
||||
ResponseBuilder,
|
||||
SynthesizeQuery,
|
||||
} from "./types.js";
|
||||
|
||||
/**
|
||||
* A ResponseSynthesizer is used to generate a response from a query and a list of nodes.
|
||||
*/
|
||||
export class ResponseSynthesizer
|
||||
extends PromptMixin
|
||||
implements BaseSynthesizer
|
||||
{
|
||||
responseBuilder: ResponseBuilder;
|
||||
metadataMode: MetadataMode;
|
||||
|
||||
constructor({
|
||||
responseBuilder,
|
||||
serviceContext,
|
||||
metadataMode = MetadataMode.NONE,
|
||||
}: {
|
||||
responseBuilder?: ResponseBuilder | undefined;
|
||||
serviceContext?: ServiceContext | undefined;
|
||||
metadataMode?: MetadataMode | undefined;
|
||||
} = {}) {
|
||||
super();
|
||||
|
||||
this.responseBuilder =
|
||||
responseBuilder ?? getResponseBuilder(serviceContext);
|
||||
this.metadataMode = metadataMode;
|
||||
}
|
||||
|
||||
_getPromptModules() {
|
||||
return {};
|
||||
}
|
||||
|
||||
protected _getPrompts() {
|
||||
const prompts = this.responseBuilder.getPrompts?.();
|
||||
return {
|
||||
...prompts,
|
||||
};
|
||||
}
|
||||
|
||||
protected _updatePrompts(promptsRecord: PromptsRecord): void {
|
||||
this.responseBuilder.updatePrompts?.(promptsRecord);
|
||||
}
|
||||
|
||||
synthesize(
|
||||
query: SynthesizeQuery,
|
||||
stream: true,
|
||||
): Promise<AsyncIterable<EngineResponse>>;
|
||||
synthesize(query: SynthesizeQuery, stream?: false): Promise<EngineResponse>;
|
||||
async synthesize(
|
||||
query: SynthesizeQuery,
|
||||
stream?: boolean,
|
||||
): Promise<AsyncIterable<EngineResponse> | EngineResponse> {
|
||||
const { nodesWithScore } = query;
|
||||
const textChunks: string[] = nodesWithScore.map(({ node }) =>
|
||||
node.getContent(this.metadataMode),
|
||||
);
|
||||
if (stream) {
|
||||
const response = await this.responseBuilder.getResponse(
|
||||
{
|
||||
...query,
|
||||
textChunks,
|
||||
},
|
||||
true,
|
||||
);
|
||||
return streamConverter(response, (chunk) =>
|
||||
EngineResponse.fromResponse(chunk, true, nodesWithScore),
|
||||
);
|
||||
}
|
||||
const response = await this.responseBuilder.getResponse(
|
||||
{
|
||||
...query,
|
||||
textChunks,
|
||||
},
|
||||
false,
|
||||
);
|
||||
return EngineResponse.fromResponse(response, false, nodesWithScore);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
export * from "./builders.js";
|
||||
export * from "./MultiModalResponseSynthesizer.js";
|
||||
export * from "./ResponseSynthesizer.js";
|
||||
export * from "./types.js";
|
||||
@@ -1,40 +0,0 @@
|
||||
import type { PromptMixin } from "@llamaindex/core/prompts";
|
||||
import type { QueryType } from "@llamaindex/core/query-engine";
|
||||
import { EngineResponse, type NodeWithScore } from "@llamaindex/core/schema";
|
||||
|
||||
export interface SynthesizeQuery {
|
||||
query: QueryType;
|
||||
nodesWithScore: NodeWithScore[];
|
||||
}
|
||||
|
||||
// todo(himself65): Move this to @llamaindex/core/schema
|
||||
/**
|
||||
* A BaseSynthesizer is used to generate a response from a query and a list of nodes.
|
||||
*/
|
||||
export interface BaseSynthesizer extends PromptMixin {
|
||||
synthesize(
|
||||
query: SynthesizeQuery,
|
||||
stream: true,
|
||||
): Promise<AsyncIterable<EngineResponse>>;
|
||||
synthesize(query: SynthesizeQuery, stream?: false): Promise<EngineResponse>;
|
||||
}
|
||||
|
||||
export interface ResponseBuilderQuery {
|
||||
query: QueryType;
|
||||
textChunks: string[];
|
||||
prevResponse?: string | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* A ResponseBuilder is used in a response synthesizer to generate a response from multiple response chunks.
|
||||
*/
|
||||
export interface ResponseBuilder extends PromptMixin {
|
||||
/**
|
||||
* Get the response from a query and a list of text chunks.
|
||||
*/
|
||||
getResponse(
|
||||
query: ResponseBuilderQuery,
|
||||
stream: true,
|
||||
): Promise<AsyncIterable<string>>;
|
||||
getResponse(query: ResponseBuilderQuery, stream?: false): Promise<string>;
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
import type { MessageContentDetail } from "@llamaindex/core/llms";
|
||||
import type { BasePromptTemplate } from "@llamaindex/core/prompts";
|
||||
import {
|
||||
ImageNode,
|
||||
MetadataMode,
|
||||
ModalityType,
|
||||
splitNodesByType,
|
||||
type BaseNode,
|
||||
} from "@llamaindex/core/schema";
|
||||
import { imageToDataUrl } from "../internal/utils.js";
|
||||
|
||||
export async function createMessageContent(
|
||||
prompt: BasePromptTemplate,
|
||||
nodes: BaseNode[],
|
||||
extraParams: Record<string, string | undefined> = {},
|
||||
metadataMode: MetadataMode = MetadataMode.NONE,
|
||||
): Promise<MessageContentDetail[]> {
|
||||
const content: MessageContentDetail[] = [];
|
||||
const nodeMap = splitNodesByType(nodes);
|
||||
for (const type in nodeMap) {
|
||||
// for each retrieved modality type, create message content
|
||||
const nodes = nodeMap[type as ModalityType];
|
||||
if (nodes) {
|
||||
content.push(
|
||||
...(await createContentPerModality(
|
||||
prompt,
|
||||
type as ModalityType,
|
||||
nodes,
|
||||
extraParams,
|
||||
metadataMode,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
async function createContentPerModality(
|
||||
prompt: BasePromptTemplate,
|
||||
type: ModalityType,
|
||||
nodes: BaseNode[],
|
||||
extraParams: Record<string, string | undefined>,
|
||||
metadataMode: MetadataMode,
|
||||
): Promise<MessageContentDetail[]> {
|
||||
switch (type) {
|
||||
case ModalityType.TEXT:
|
||||
return [
|
||||
{
|
||||
type: "text",
|
||||
text: prompt.format({
|
||||
...extraParams,
|
||||
context: nodes.map((r) => r.getContent(metadataMode)).join("\n\n"),
|
||||
}),
|
||||
},
|
||||
];
|
||||
case ModalityType.IMAGE:
|
||||
const images: MessageContentDetail[] = await Promise.all(
|
||||
(nodes as ImageNode[]).map(async (node) => {
|
||||
return {
|
||||
type: "image_url",
|
||||
image_url: {
|
||||
url: await imageToDataUrl(node.image),
|
||||
},
|
||||
} satisfies MessageContentDetail;
|
||||
}),
|
||||
);
|
||||
return images;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -2,36 +2,6 @@
|
||||
* Top level types to avoid circular dependencies
|
||||
*/
|
||||
import type { ToolMetadata } from "@llamaindex/core/llms";
|
||||
import type { EngineResponse } from "@llamaindex/core/schema";
|
||||
|
||||
/**
|
||||
* Parameters for sending a query.
|
||||
*/
|
||||
export interface QueryEngineParamsBase {
|
||||
query: string;
|
||||
}
|
||||
|
||||
export interface QueryEngineParamsStreaming extends QueryEngineParamsBase {
|
||||
stream: true;
|
||||
}
|
||||
|
||||
export interface QueryEngineParamsNonStreaming extends QueryEngineParamsBase {
|
||||
stream?: false | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A query engine is a question answerer that can use one or more steps.
|
||||
*/
|
||||
export interface QueryEngine {
|
||||
/**
|
||||
* Query the query engine and get a response.
|
||||
* @param params
|
||||
*/
|
||||
query(
|
||||
params: QueryEngineParamsStreaming,
|
||||
): Promise<AsyncIterable<EngineResponse>>;
|
||||
query(params: QueryEngineParamsNonStreaming): Promise<EngineResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* StructuredOutput is just a combo of the raw output and the parsed output.
|
||||
|
||||
@@ -20,11 +20,12 @@ import { Document, MetadataMode } from "@llamaindex/core/schema";
|
||||
export const PGVECTOR_SCHEMA = "public";
|
||||
export const PGVECTOR_TABLE = "llamaindex_embedding";
|
||||
|
||||
export type PGVectorStoreConfig = {
|
||||
export type PGVectorStoreConfig = Pick<
|
||||
pg.ClientConfig,
|
||||
"user" | "database" | "password" | "connectionString"
|
||||
> & {
|
||||
schemaName?: string | undefined;
|
||||
tableName?: string | undefined;
|
||||
database?: string | undefined;
|
||||
connectionString?: string | undefined;
|
||||
dimensions?: number | undefined;
|
||||
embedModel?: BaseEmbedding | undefined;
|
||||
};
|
||||
@@ -43,8 +44,12 @@ export class PGVectorStore
|
||||
private schemaName: string = PGVECTOR_SCHEMA;
|
||||
private tableName: string = PGVECTOR_TABLE;
|
||||
|
||||
private database: string | undefined = undefined;
|
||||
private connectionString: string | undefined = undefined;
|
||||
private user: pg.ClientConfig["user"] | undefined = undefined;
|
||||
private password: pg.ClientConfig["password"] | undefined = undefined;
|
||||
private database: pg.ClientConfig["database"] | undefined = undefined;
|
||||
private connectionString: pg.ClientConfig["connectionString"] | undefined =
|
||||
undefined;
|
||||
|
||||
private dimensions: number = 1536;
|
||||
|
||||
private db?: pg.ClientBase;
|
||||
@@ -76,6 +81,8 @@ export class PGVectorStore
|
||||
super(config?.embedModel);
|
||||
this.schemaName = config?.schemaName ?? PGVECTOR_SCHEMA;
|
||||
this.tableName = config?.tableName ?? PGVECTOR_TABLE;
|
||||
this.user = config?.user;
|
||||
this.password = config?.password;
|
||||
this.database = config?.database;
|
||||
this.connectionString = config?.connectionString;
|
||||
this.dimensions = config?.dimensions ?? 1536;
|
||||
@@ -114,6 +121,8 @@ export class PGVectorStore
|
||||
// Create DB connection
|
||||
// Read connection params from env - see comment block above
|
||||
const db = new Client({
|
||||
user: this.user,
|
||||
password: this.password,
|
||||
database: this.database,
|
||||
connectionString: this.connectionString,
|
||||
});
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
"test": "vitest run"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@faker-js/faker": "^9.0.1",
|
||||
"llamaindex": "workspace:*",
|
||||
"msw": "^2.4.8",
|
||||
"vitest": "^2.0.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* DO NOT PUT THIS TEST CASE FROM VITEST TO NODE.JS TEST RUNNER
|
||||
*
|
||||
* msw has side effect that will replace the global fetch function,
|
||||
* which will cause the test runner to hang indefinitely for some reason.
|
||||
* but vitest will start new process for each test case, so it's safe to use msw in vitest,
|
||||
* in the meanwhile, node.js test runner only run in single process.
|
||||
*/
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import { setupServer } from "msw/node";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { afterAll, afterEach, beforeAll, expect, test } from "vitest";
|
||||
|
||||
const jobsHashMap = new Map<string, boolean>();
|
||||
|
||||
const handlers = [
|
||||
http.post("https://api.cloud.llamaindex.ai/api/v1/parsing/upload", () => {
|
||||
return HttpResponse.json({
|
||||
id: faker.string.uuid(),
|
||||
});
|
||||
}),
|
||||
http.get(
|
||||
"https://api.cloud.llamaindex.ai/api/v1/parsing/job/:id",
|
||||
({ params }): HttpResponse => {
|
||||
const jobId = params.id as string;
|
||||
if (jobsHashMap.has(jobId)) {
|
||||
return HttpResponse.json({
|
||||
id: jobId,
|
||||
status: "SUCCESS",
|
||||
});
|
||||
} else {
|
||||
jobsHashMap.set(jobId, true);
|
||||
}
|
||||
return HttpResponse.json({
|
||||
id: jobId,
|
||||
status: "PENDING",
|
||||
});
|
||||
},
|
||||
),
|
||||
http.get(
|
||||
"https://api.cloud.llamaindex.ai/api/v1/parsing/job/:id/result/markdown",
|
||||
() => {
|
||||
const job_metadata = {
|
||||
credits_used: faker.number.int({ min: 1, max: 10 }),
|
||||
credits_max: 1000,
|
||||
job_credits_usage: faker.number.int({ min: 1, max: 10 }),
|
||||
job_pages: faker.number.int({ min: 0, max: 5 }),
|
||||
job_is_cache_hit: faker.datatype.boolean(),
|
||||
};
|
||||
return HttpResponse.json({
|
||||
markdown: faker.lorem.paragraphs({
|
||||
min: 3,
|
||||
max: 1000,
|
||||
}),
|
||||
job_metadata,
|
||||
});
|
||||
},
|
||||
),
|
||||
http.get(
|
||||
"https://api.cloud.llamaindex.ai/api/v1/parsing/job/:id/result/text",
|
||||
() => {
|
||||
const job_metadata = {
|
||||
credits_used: faker.number.int({ min: 1, max: 10 }),
|
||||
credits_max: 1000,
|
||||
job_credits_usage: faker.number.int({ min: 1, max: 10 }),
|
||||
job_pages: faker.number.int({ min: 0, max: 5 }),
|
||||
job_is_cache_hit: faker.datatype.boolean(),
|
||||
};
|
||||
return HttpResponse.json({
|
||||
text: faker.lorem.paragraphs({
|
||||
min: 3,
|
||||
max: 1000,
|
||||
}),
|
||||
job_metadata,
|
||||
});
|
||||
},
|
||||
),
|
||||
http.get(
|
||||
"https://api.cloud.llamaindex.ai/api/v1/parsing/job/:id/result/json",
|
||||
() => {
|
||||
const pages = Array.from({ length: 1 }, () => ({
|
||||
page: 1,
|
||||
text: faker.lorem.paragraphs(2),
|
||||
md: `# ${faker.lorem.sentence()}\n\n${faker.lorem.paragraph()}`,
|
||||
images: [
|
||||
{
|
||||
name: faker.system.fileName(),
|
||||
height: faker.number.int({ min: 100, max: 500 }),
|
||||
width: faker.number.int({ min: 600, max: 1600 }),
|
||||
x: faker.number.int({ min: 0, max: 50 }),
|
||||
y: faker.number.int({ min: 0, max: 50 }),
|
||||
original_width: faker.number.int({ min: 1800, max: 2000 }),
|
||||
original_height: faker.number.int({ min: 400, max: 600 }),
|
||||
},
|
||||
],
|
||||
items: [
|
||||
{
|
||||
type: "heading",
|
||||
lvl: 1,
|
||||
value: faker.lorem.sentence(),
|
||||
md: `# ${faker.lorem.sentence()}`,
|
||||
bBox: {
|
||||
x: faker.number.float({ min: 20, max: 40 }),
|
||||
y: faker.number.float({ min: 20, max: 30 }),
|
||||
w: faker.number.float({ min: 300, max: 400 }),
|
||||
h: faker.number.float({ min: 30, max: 50 }),
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "table",
|
||||
rows: [
|
||||
[faker.lorem.word(), faker.lorem.sentence()],
|
||||
[faker.lorem.word(), faker.lorem.sentence()],
|
||||
[faker.lorem.word(), faker.lorem.sentence()],
|
||||
[faker.lorem.word(), faker.lorem.sentence()],
|
||||
],
|
||||
md: faker.lorem.sentences(4),
|
||||
isPerfectTable: faker.datatype.boolean(),
|
||||
csv: faker.lorem.sentences(4),
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
value: faker.lorem.paragraphs(2),
|
||||
md: faker.lorem.paragraphs(2),
|
||||
bBox: {
|
||||
x: faker.number.float({ min: 5, max: 10 }),
|
||||
y: faker.number.float({ min: 20, max: 30 }),
|
||||
w: faker.number.float({ min: 800, max: 900 }),
|
||||
h: faker.number.float({ min: 30, max: 50 }),
|
||||
},
|
||||
},
|
||||
],
|
||||
}));
|
||||
|
||||
const response = {
|
||||
pages,
|
||||
job_metadata: {
|
||||
credits_used: faker.number.int({ min: 1, max: 10 }),
|
||||
credits_max: 1000,
|
||||
job_credits_usage: faker.number.int({ min: 1, max: 10 }),
|
||||
job_pages: faker.number.int({ min: 0, max: 5 }),
|
||||
job_is_cache_hit: faker.datatype.boolean(),
|
||||
},
|
||||
};
|
||||
return HttpResponse.json(response);
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
const server = setupServer(...handlers);
|
||||
|
||||
beforeAll(() => {
|
||||
server.listen({
|
||||
onUnhandledRequest: "error",
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
server.resetHandlers();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
server.close();
|
||||
});
|
||||
|
||||
test("llama parse should return a successful document", async () => {
|
||||
const { LlamaParseReader } = await import("@llamaindex/cloud/reader");
|
||||
const reader = new LlamaParseReader({
|
||||
verbose: false,
|
||||
apiKey: "llx-fake-api-key",
|
||||
});
|
||||
const fileUrl = new URL("../../../../examples/data/TOS.pdf", import.meta.url);
|
||||
const documents = await reader.loadData(fileURLToPath(fileUrl));
|
||||
expect(documents.length).toBe(1);
|
||||
});
|
||||
@@ -1,5 +1,11 @@
|
||||
# @llamaindex/groq
|
||||
|
||||
## 0.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @llamaindex/openai@0.1.5
|
||||
|
||||
## 0.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/groq",
|
||||
"description": "Groq Adapter for LlamaIndex",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.4",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/openai
|
||||
|
||||
## 0.1.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2cd1383]
|
||||
- @llamaindex/core@0.2.3
|
||||
|
||||
## 0.1.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/openai",
|
||||
"description": "OpenAI Adapter for LlamaIndex",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
Generated
+370
-54
@@ -245,7 +245,7 @@ importers:
|
||||
version: 5.6.2
|
||||
vitest:
|
||||
specifier: ^2.0.5
|
||||
version: 2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(terser@5.32.0)
|
||||
version: 2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(msw@2.4.8(typescript@5.6.2))(terser@5.32.0)
|
||||
webpack:
|
||||
specifier: ^5.94.0
|
||||
version: 5.94.0(@swc/core@1.7.22(@swc/helpers@0.5.13))
|
||||
@@ -352,7 +352,7 @@ importers:
|
||||
specifier: ^0.53.0
|
||||
version: 0.53.0(typescript@5.6.2)
|
||||
'@llamaindex/core':
|
||||
specifier: workspace:^0.2.2
|
||||
specifier: workspace:^0.2.3
|
||||
version: link:../core
|
||||
'@llamaindex/env':
|
||||
specifier: workspace:^0.1.11
|
||||
@@ -388,6 +388,9 @@ importers:
|
||||
'@types/node':
|
||||
specifier: ^22.5.1
|
||||
version: 22.5.4
|
||||
magic-bytes.js:
|
||||
specifier: ^1.10.0
|
||||
version: 1.10.0
|
||||
zod:
|
||||
specifier: ^3.23.8
|
||||
version: 3.23.8
|
||||
@@ -418,7 +421,7 @@ importers:
|
||||
version: link:..
|
||||
vitest:
|
||||
specifier: ^2.0.5
|
||||
version: 2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(terser@5.32.0)
|
||||
version: 2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.5)(happy-dom@15.7.4)(msw@2.4.8(typescript@5.6.2))(terser@5.32.0)
|
||||
|
||||
packages/env:
|
||||
dependencies:
|
||||
@@ -452,7 +455,7 @@ importers:
|
||||
version: 1.1.2
|
||||
vitest:
|
||||
specifier: ^2.0.5
|
||||
version: 2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(terser@5.32.0)
|
||||
version: 2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(msw@2.4.8(typescript@5.6.2))(terser@5.32.0)
|
||||
|
||||
packages/experimental:
|
||||
dependencies:
|
||||
@@ -672,14 +675,17 @@ importers:
|
||||
packages/llamaindex/e2e:
|
||||
devDependencies:
|
||||
'@faker-js/faker':
|
||||
specifier: ^8.4.1
|
||||
version: 8.4.1
|
||||
specifier: ^9.0.1
|
||||
version: 9.0.1
|
||||
'@types/node':
|
||||
specifier: ^22.5.1
|
||||
version: 22.5.4
|
||||
consola:
|
||||
specifier: ^3.2.3
|
||||
version: 3.2.3
|
||||
dotenv:
|
||||
specifier: ^16.4.5
|
||||
version: 16.4.5
|
||||
llamaindex:
|
||||
specifier: workspace:*
|
||||
version: link:..
|
||||
@@ -695,7 +701,7 @@ importers:
|
||||
devDependencies:
|
||||
'@cloudflare/vitest-pool-workers':
|
||||
specifier: ^0.4.27
|
||||
version: 0.4.27(@cloudflare/workers-types@4.20240821.1)(@vitest/runner@1.5.3)(@vitest/snapshot@1.5.3)(vitest@1.5.3(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(terser@5.32.0))
|
||||
version: 0.4.27(@cloudflare/workers-types@4.20240821.1)(@vitest/runner@1.5.3)(@vitest/snapshot@1.5.3)(vitest@1.5.3(@edge-runtime/vm@4.0.3)(@types/node@22.5.5)(happy-dom@15.7.4)(terser@5.32.0))
|
||||
'@cloudflare/workers-types':
|
||||
specifier: ^4.20240821.1
|
||||
version: 4.20240821.1
|
||||
@@ -710,7 +716,7 @@ importers:
|
||||
version: 5.6.2
|
||||
vitest:
|
||||
specifier: 1.5.3
|
||||
version: 1.5.3(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(terser@5.32.0)
|
||||
version: 1.5.3(@edge-runtime/vm@4.0.3)(@types/node@22.5.5)(happy-dom@15.7.4)(terser@5.32.0)
|
||||
wrangler:
|
||||
specifier: ^3.73.0
|
||||
version: 3.73.0(@cloudflare/workers-types@4.20240821.1)
|
||||
@@ -726,10 +732,10 @@ importers:
|
||||
version: 5.6.2
|
||||
vite:
|
||||
specifier: ^5.4.1
|
||||
version: 5.4.2(@types/node@22.5.4)(terser@5.32.0)
|
||||
version: 5.4.2(@types/node@22.5.5)(terser@5.32.0)
|
||||
vite-plugin-wasm:
|
||||
specifier: ^3.3.0
|
||||
version: 3.3.0(vite@5.4.2(@types/node@22.5.4)(terser@5.32.0))
|
||||
version: 3.3.0(vite@5.4.2(@types/node@22.5.5)(terser@5.32.0))
|
||||
|
||||
packages/llamaindex/e2e/examples/nextjs-agent:
|
||||
dependencies:
|
||||
@@ -858,7 +864,7 @@ importers:
|
||||
version: 19.0.0-rc-7771d3a7-20240827(react-dom@19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827))(react@19.0.0-rc-7771d3a7-20240827)(webpack@5.94.0)
|
||||
waku:
|
||||
specifier: 0.21.1
|
||||
version: 0.21.1(@swc/helpers@0.5.13)(@types/node@22.5.4)(react-dom@19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827))(react-server-dom-webpack@19.0.0-rc-7771d3a7-20240827(react-dom@19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827))(react@19.0.0-rc-7771d3a7-20240827)(webpack@5.94.0))(react@19.0.0-rc-7771d3a7-20240827)(terser@5.32.0)
|
||||
version: 0.21.1(@swc/helpers@0.5.13)(@types/node@22.5.5)(react-dom@19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827))(react-server-dom-webpack@19.0.0-rc-7771d3a7-20240827(react-dom@19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827))(react@19.0.0-rc-7771d3a7-20240827)(webpack@5.94.0))(react@19.0.0-rc-7771d3a7-20240827)(terser@5.32.0)
|
||||
devDependencies:
|
||||
'@types/react':
|
||||
specifier: 18.3.5
|
||||
@@ -877,16 +883,22 @@ importers:
|
||||
version: 5.6.2
|
||||
vite-plugin-wasm:
|
||||
specifier: ^3.3.0
|
||||
version: 3.3.0(vite@5.4.2(@types/node@22.5.4)(terser@5.32.0))
|
||||
version: 3.3.0(vite@5.4.2(@types/node@22.5.5)(terser@5.32.0))
|
||||
|
||||
packages/llamaindex/tests:
|
||||
devDependencies:
|
||||
'@faker-js/faker':
|
||||
specifier: ^9.0.1
|
||||
version: 9.0.1
|
||||
llamaindex:
|
||||
specifier: workspace:*
|
||||
version: link:..
|
||||
msw:
|
||||
specifier: ^2.4.8
|
||||
version: 2.4.8(typescript@5.6.2)
|
||||
vitest:
|
||||
specifier: ^2.0.5
|
||||
version: 2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(terser@5.32.0)
|
||||
version: 2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.5)(happy-dom@15.7.4)(msw@2.4.8(typescript@5.6.2))(terser@5.32.0)
|
||||
|
||||
packages/llm/groq:
|
||||
dependencies:
|
||||
@@ -2068,6 +2080,15 @@ packages:
|
||||
resolution: {integrity: sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@bundled-es-modules/cookie@2.0.0':
|
||||
resolution: {integrity: sha512-Or6YHg/kamKHpxULAdSqhGqnWFneIXu1NKvvfBBzKGwpVsYuFIQ5aBPHDnnoR3ghW1nvSkALd+EF9iMtY7Vjxw==}
|
||||
|
||||
'@bundled-es-modules/statuses@1.0.1':
|
||||
resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==}
|
||||
|
||||
'@bundled-es-modules/tough-cookie@0.1.6':
|
||||
resolution: {integrity: sha512-dvMHbL464C0zI+Yqxbz6kZ5TOEp7GLW+pry/RWndAR8MJQAXZ2rPmIs8tziTZjeIyhSNZgZbCePtfSbdWqStJw==}
|
||||
|
||||
'@changesets/apply-release-plan@7.0.4':
|
||||
resolution: {integrity: sha512-HLFwhKWayKinWAul0Vj+76jVx1Pc2v55MGPVjZ924Y/ROeSsBMFutv9heHmCUj48lJyRfOTJG5+ar+29FUky/A==}
|
||||
|
||||
@@ -2864,9 +2885,9 @@ packages:
|
||||
resolution: {integrity: sha512-autAXT203ixhqei9xt+qkYOvY8l6LAFIdT2UXc/RPNeUVfqRF1BV94GTJyVPFKT8nFM6MyVJhjLj9E8JWvf5zQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@faker-js/faker@8.4.1':
|
||||
resolution: {integrity: sha512-XQ3cU+Q8Uqmrbf2e0cIC/QN43sTBSC8KF12u29Mb47tWrt2hAgBXSgpZMj4Ao8Uk0iJcU99QsOCaIL8934obCg==}
|
||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0, npm: '>=6.14.13'}
|
||||
'@faker-js/faker@9.0.1':
|
||||
resolution: {integrity: sha512-4mDeYIgM3By7X6t5E6eYwLAa+2h4DeZDF7thhzIg6XB76jeEvMwadYAMCFJL/R4AnEBcAUO9+gL0vhy3s+qvZA==}
|
||||
engines: {node: '>=18.0.0', npm: '>=9.0.0'}
|
||||
|
||||
'@fastify/busboy@2.1.1':
|
||||
resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==}
|
||||
@@ -3052,6 +3073,26 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@inquirer/confirm@3.2.0':
|
||||
resolution: {integrity: sha512-oOIwPs0Dvq5220Z8lGL/6LHRTEr9TgLHmiI99Rj1PJ1p1czTys+olrgBqZk4E2qC0YTzeHprxSQmoHioVdJ7Lw==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@inquirer/core@9.2.1':
|
||||
resolution: {integrity: sha512-F2VBt7W/mwqEU4bL0RnHNZmC/OxzNx9cOYxHqnXX3MP6ruYvZUZAW9imgN9+h/uBT/oP8Gh888J2OZSbjSeWcg==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@inquirer/figures@1.0.6':
|
||||
resolution: {integrity: sha512-yfZzps3Cso2UbM7WlxKwZQh2Hs6plrbjs1QnzQDZhK2DgyCo6D8AaHps9olkNcUFlcYERMqU3uJSp1gmy3s/qQ==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@inquirer/type@1.5.5':
|
||||
resolution: {integrity: sha512-MzICLu4yS7V8AA61sANROZ9vT1H3ooca5dSmI1FjZkzq7o/koMsRfQSzRtFo+F3Ao4Sf1C0bpLKejpKB/+j6MA==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@inquirer/type@2.0.0':
|
||||
resolution: {integrity: sha512-XvJRx+2KR3YXyYtPUUy+qd9i7p+GO9Ko6VIIpWlBrpWwXDv8WLFeHTxz35CfQFUiBMLXlGHhGzys7lqit9gWag==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@isaacs/cliui@8.0.2':
|
||||
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
|
||||
engines: {node: '>=12'}
|
||||
@@ -3131,6 +3172,10 @@ packages:
|
||||
'@mongodb-js/saslprep@1.1.7':
|
||||
resolution: {integrity: sha512-dCHW/oEX0KJ4NjDULBo3JiOaK5+6axtpBbS+ao2ZInoAL9/YRQLhXzSNAFz7hP4nzLkIqsfYAK/PDE3+XHny0Q==}
|
||||
|
||||
'@mswjs/interceptors@0.35.6':
|
||||
resolution: {integrity: sha512-PpD687w7qLxVMK176bpQjbzU9O0VC75QnBK5U1lKd29s4hIuxfTItUD6raNKyQ6BN8b64/8HE34RuYTkwH9uPQ==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@next/env@14.2.11':
|
||||
resolution: {integrity: sha512-HYsQRSIXwiNqvzzYThrBwq6RhXo3E0n8j8nQnAs8i4fCEo2Zf/3eS0IiRA8XnRg9Ha0YnpkyJZIZg1qEwemrHw==}
|
||||
|
||||
@@ -3271,6 +3316,15 @@ packages:
|
||||
resolution: {integrity: sha512-XhdSY/4B1D34tSco/GION+23GMjaS9S2zszcqYkMHo8RcWInymF6L1x+Gk7EmHdrSxNFva2WM8orhC4BwQCwgw==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
'@open-draft/deferred-promise@2.2.0':
|
||||
resolution: {integrity: sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==}
|
||||
|
||||
'@open-draft/logger@0.3.0':
|
||||
resolution: {integrity: sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==}
|
||||
|
||||
'@open-draft/until@2.1.0':
|
||||
resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==}
|
||||
|
||||
'@opentelemetry/api@1.9.0':
|
||||
resolution: {integrity: sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
@@ -4094,6 +4148,9 @@ packages:
|
||||
'@types/connect@3.4.38':
|
||||
resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
|
||||
|
||||
'@types/cookie@0.6.0':
|
||||
resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==}
|
||||
|
||||
'@types/debug@4.1.12':
|
||||
resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==}
|
||||
|
||||
@@ -4175,6 +4232,9 @@ packages:
|
||||
'@types/ms@0.7.34':
|
||||
resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==}
|
||||
|
||||
'@types/mute-stream@0.0.4':
|
||||
resolution: {integrity: sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==}
|
||||
|
||||
'@types/node-fetch@2.6.11':
|
||||
resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==}
|
||||
|
||||
@@ -4193,6 +4253,9 @@ packages:
|
||||
'@types/node@22.5.4':
|
||||
resolution: {integrity: sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==}
|
||||
|
||||
'@types/node@22.5.5':
|
||||
resolution: {integrity: sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==}
|
||||
|
||||
'@types/papaparse@5.3.14':
|
||||
resolution: {integrity: sha512-LxJ4iEFcpqc6METwp9f6BV6VVc43m6MfH0VqFosHvrUgfXiFe6ww7R3itkOQ+TCK6Y+Iv/+RnnvtRZnkc5Kc9g==}
|
||||
|
||||
@@ -4259,6 +4322,9 @@ packages:
|
||||
'@types/sockjs@0.3.36':
|
||||
resolution: {integrity: sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==}
|
||||
|
||||
'@types/statuses@2.0.5':
|
||||
resolution: {integrity: sha512-jmIUGWrAiwu3dZpxntxieC+1n/5c3mjrImkmOSQ2NC5uP6cYO4aAZDdSmRcI5C1oiTmqlZGHC+/NmJrKogbP5A==}
|
||||
|
||||
'@types/tough-cookie@4.0.5':
|
||||
resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==}
|
||||
|
||||
@@ -4277,6 +4343,9 @@ packages:
|
||||
'@types/whatwg-url@11.0.5':
|
||||
resolution: {integrity: sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==}
|
||||
|
||||
'@types/wrap-ansi@3.0.0':
|
||||
resolution: {integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==}
|
||||
|
||||
'@types/ws@8.5.12':
|
||||
resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==}
|
||||
|
||||
@@ -4713,6 +4782,10 @@ packages:
|
||||
resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
ansi-escapes@4.3.2:
|
||||
resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
ansi-escapes@7.0.0:
|
||||
resolution: {integrity: sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==}
|
||||
engines: {node: '>=18'}
|
||||
@@ -5284,6 +5357,10 @@ packages:
|
||||
resolution: {integrity: sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
cli-width@4.1.0:
|
||||
resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==}
|
||||
engines: {node: '>= 12'}
|
||||
|
||||
client-only@0.0.1:
|
||||
resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==}
|
||||
|
||||
@@ -6918,6 +6995,9 @@ packages:
|
||||
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
|
||||
hasBin: true
|
||||
|
||||
headers-polyfill@4.0.3:
|
||||
resolution: {integrity: sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==}
|
||||
|
||||
highlight.js@10.7.3:
|
||||
resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==}
|
||||
|
||||
@@ -7292,6 +7372,9 @@ packages:
|
||||
resolution: {integrity: sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
is-node-process@1.2.0:
|
||||
resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==}
|
||||
|
||||
is-npm@6.0.0:
|
||||
resolution: {integrity: sha512-JEjxbSmtPSt1c8XTkVrlujcXdKV1/tvuQ7GwKcAlyiVLeYFQ2VHat8xfrDJsIkhCdF/tZ7CiIR3sy141c6+gPQ==}
|
||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||
@@ -8304,6 +8387,16 @@ packages:
|
||||
ms@2.1.3:
|
||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||
|
||||
msw@2.4.8:
|
||||
resolution: {integrity: sha512-a+FUW1m5yT8cV9GBy0L/cbNg0EA4//SKEzgu3qFrpITrWYeZmqfo7dqtM74T2lAl69jjUjjCaEhZKaxG2Ns8DA==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
typescript: '>= 4.8.x'
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
multicast-dns@7.2.5:
|
||||
resolution: {integrity: sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==}
|
||||
hasBin: true
|
||||
@@ -8312,6 +8405,10 @@ packages:
|
||||
resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==}
|
||||
hasBin: true
|
||||
|
||||
mute-stream@1.0.0:
|
||||
resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==}
|
||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
||||
|
||||
mz@2.7.0:
|
||||
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
|
||||
|
||||
@@ -8629,6 +8726,9 @@ packages:
|
||||
outdent@0.5.0:
|
||||
resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==}
|
||||
|
||||
outvariant@1.4.3:
|
||||
resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==}
|
||||
|
||||
p-cancelable@2.1.1:
|
||||
resolution: {integrity: sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -8797,6 +8897,9 @@ packages:
|
||||
path-to-regexp@6.2.2:
|
||||
resolution: {integrity: sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==}
|
||||
|
||||
path-to-regexp@6.3.0:
|
||||
resolution: {integrity: sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==}
|
||||
|
||||
path-type@4.0.0:
|
||||
resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -10177,6 +10280,9 @@ packages:
|
||||
streamx@2.18.0:
|
||||
resolution: {integrity: sha512-LLUC1TWdjVdn1weXGcSxyTR3T4+acB6tVGXT95y0nGbca4t4o/ng1wKAGTljm9VicuCVLvRlqFYXYy5GwgM7sQ==}
|
||||
|
||||
strict-event-emitter@0.5.1:
|
||||
resolution: {integrity: sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==}
|
||||
|
||||
string-argv@0.3.2:
|
||||
resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==}
|
||||
engines: {node: '>=0.6.19'}
|
||||
@@ -10644,6 +10750,10 @@ packages:
|
||||
resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
type-fest@0.21.3:
|
||||
resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
type-fest@1.4.0:
|
||||
resolution: {integrity: sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==}
|
||||
engines: {node: '>=10'}
|
||||
@@ -11191,6 +11301,10 @@ packages:
|
||||
'@cloudflare/workers-types':
|
||||
optional: true
|
||||
|
||||
wrap-ansi@6.2.0:
|
||||
resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
wrap-ansi@7.0.0:
|
||||
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
|
||||
engines: {node: '>=10'}
|
||||
@@ -11290,6 +11404,10 @@ packages:
|
||||
resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==}
|
||||
engines: {node: '>=12.20'}
|
||||
|
||||
yoctocolors-cjs@2.1.2:
|
||||
resolution: {integrity: sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
youch@3.3.3:
|
||||
resolution: {integrity: sha512-qSFXUk3UZBLfggAW3dJKg0BMblG5biqSF8M34E06o5CSsZtH92u9Hqmj2RzGiHDi64fhe83+4tENFP2DB6t6ZA==}
|
||||
|
||||
@@ -13312,6 +13430,19 @@ snapshots:
|
||||
'@babel/helper-validator-identifier': 7.24.7
|
||||
to-fast-properties: 2.0.0
|
||||
|
||||
'@bundled-es-modules/cookie@2.0.0':
|
||||
dependencies:
|
||||
cookie: 0.5.0
|
||||
|
||||
'@bundled-es-modules/statuses@1.0.1':
|
||||
dependencies:
|
||||
statuses: 2.0.1
|
||||
|
||||
'@bundled-es-modules/tough-cookie@0.1.6':
|
||||
dependencies:
|
||||
'@types/tough-cookie': 4.0.5
|
||||
tough-cookie: 4.1.4
|
||||
|
||||
'@changesets/apply-release-plan@7.0.4':
|
||||
dependencies:
|
||||
'@babel/runtime': 7.25.6
|
||||
@@ -13472,7 +13603,7 @@ snapshots:
|
||||
dependencies:
|
||||
mime: 3.0.0
|
||||
|
||||
'@cloudflare/vitest-pool-workers@0.4.27(@cloudflare/workers-types@4.20240821.1)(@vitest/runner@1.5.3)(@vitest/snapshot@1.5.3)(vitest@1.5.3(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(terser@5.32.0))':
|
||||
'@cloudflare/vitest-pool-workers@0.4.27(@cloudflare/workers-types@4.20240821.1)(@vitest/runner@1.5.3)(@vitest/snapshot@1.5.3)(vitest@1.5.3(@edge-runtime/vm@4.0.3)(@types/node@22.5.5)(happy-dom@15.7.4)(terser@5.32.0))':
|
||||
dependencies:
|
||||
'@vitest/runner': 1.5.3
|
||||
'@vitest/snapshot': 1.5.3
|
||||
@@ -13482,7 +13613,7 @@ snapshots:
|
||||
esbuild: 0.17.19
|
||||
miniflare: 3.20240821.0
|
||||
semver: 7.6.3
|
||||
vitest: 1.5.3(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(terser@5.32.0)
|
||||
vitest: 1.5.3(@edge-runtime/vm@4.0.3)(@types/node@22.5.5)(happy-dom@15.7.4)(terser@5.32.0)
|
||||
wrangler: 3.73.0(@cloudflare/workers-types@4.20240821.1)
|
||||
zod: 3.23.8
|
||||
transitivePeerDependencies:
|
||||
@@ -14533,7 +14664,7 @@ snapshots:
|
||||
levn: 0.4.1
|
||||
optional: true
|
||||
|
||||
'@faker-js/faker@8.4.1': {}
|
||||
'@faker-js/faker@9.0.1': {}
|
||||
|
||||
'@fastify/busboy@2.1.1': {}
|
||||
|
||||
@@ -14684,6 +14815,36 @@ snapshots:
|
||||
'@img/sharp-win32-x64@0.33.5':
|
||||
optional: true
|
||||
|
||||
'@inquirer/confirm@3.2.0':
|
||||
dependencies:
|
||||
'@inquirer/core': 9.2.1
|
||||
'@inquirer/type': 1.5.5
|
||||
|
||||
'@inquirer/core@9.2.1':
|
||||
dependencies:
|
||||
'@inquirer/figures': 1.0.6
|
||||
'@inquirer/type': 2.0.0
|
||||
'@types/mute-stream': 0.0.4
|
||||
'@types/node': 22.5.5
|
||||
'@types/wrap-ansi': 3.0.0
|
||||
ansi-escapes: 4.3.2
|
||||
cli-width: 4.1.0
|
||||
mute-stream: 1.0.0
|
||||
signal-exit: 4.1.0
|
||||
strip-ansi: 6.0.1
|
||||
wrap-ansi: 6.2.0
|
||||
yoctocolors-cjs: 2.1.2
|
||||
|
||||
'@inquirer/figures@1.0.6': {}
|
||||
|
||||
'@inquirer/type@1.5.5':
|
||||
dependencies:
|
||||
mute-stream: 1.0.0
|
||||
|
||||
'@inquirer/type@2.0.0':
|
||||
dependencies:
|
||||
mute-stream: 1.0.0
|
||||
|
||||
'@isaacs/cliui@8.0.2':
|
||||
dependencies:
|
||||
string-width: 5.1.2
|
||||
@@ -14702,7 +14863,7 @@ snapshots:
|
||||
'@jest/schemas': 29.6.3
|
||||
'@types/istanbul-lib-coverage': 2.0.6
|
||||
'@types/istanbul-reports': 3.0.4
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
'@types/yargs': 17.0.33
|
||||
chalk: 4.1.2
|
||||
|
||||
@@ -14835,6 +14996,15 @@ snapshots:
|
||||
dependencies:
|
||||
sparse-bitfield: 3.0.3
|
||||
|
||||
'@mswjs/interceptors@0.35.6':
|
||||
dependencies:
|
||||
'@open-draft/deferred-promise': 2.2.0
|
||||
'@open-draft/logger': 0.3.0
|
||||
'@open-draft/until': 2.1.0
|
||||
is-node-process: 1.2.0
|
||||
outvariant: 1.4.3
|
||||
strict-event-emitter: 0.5.1
|
||||
|
||||
'@next/env@14.2.11': {}
|
||||
|
||||
'@next/env@14.3.0-canary.51': {}
|
||||
@@ -14922,6 +15092,15 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
|
||||
'@open-draft/deferred-promise@2.2.0': {}
|
||||
|
||||
'@open-draft/logger@0.3.0':
|
||||
dependencies:
|
||||
is-node-process: 1.2.0
|
||||
outvariant: 1.4.3
|
||||
|
||||
'@open-draft/until@2.1.0': {}
|
||||
|
||||
'@opentelemetry/api@1.9.0': {}
|
||||
|
||||
'@petamoriken/float16@3.8.7': {}
|
||||
@@ -15781,27 +15960,29 @@ snapshots:
|
||||
'@types/body-parser@1.19.5':
|
||||
dependencies:
|
||||
'@types/connect': 3.4.38
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/bonjour@3.5.13':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/cacheable-request@6.0.3':
|
||||
dependencies:
|
||||
'@types/http-cache-semantics': 4.0.4
|
||||
'@types/keyv': 3.1.4
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
'@types/responselike': 1.0.3
|
||||
|
||||
'@types/connect-history-api-fallback@1.5.4':
|
||||
dependencies:
|
||||
'@types/express-serve-static-core': 4.19.5
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/connect@3.4.38':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/cookie@0.6.0': {}
|
||||
|
||||
'@types/debug@4.1.12':
|
||||
dependencies:
|
||||
@@ -15817,7 +15998,7 @@ snapshots:
|
||||
|
||||
'@types/express-serve-static-core@4.19.5':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
'@types/qs': 6.9.15
|
||||
'@types/range-parser': 1.2.7
|
||||
'@types/send': 0.17.4
|
||||
@@ -15849,7 +16030,7 @@ snapshots:
|
||||
|
||||
'@types/http-proxy@1.17.15':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/istanbul-lib-coverage@2.0.6': {}
|
||||
|
||||
@@ -15869,7 +16050,7 @@ snapshots:
|
||||
|
||||
'@types/keyv@3.1.4':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/lodash-es@4.17.12':
|
||||
dependencies:
|
||||
@@ -15887,6 +16068,10 @@ snapshots:
|
||||
|
||||
'@types/ms@0.7.34': {}
|
||||
|
||||
'@types/mute-stream@0.0.4':
|
||||
dependencies:
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/node-fetch@2.6.11':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
@@ -15894,7 +16079,7 @@ snapshots:
|
||||
|
||||
'@types/node-forge@1.3.11':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/node@12.20.55': {}
|
||||
|
||||
@@ -15908,6 +16093,10 @@ snapshots:
|
||||
dependencies:
|
||||
undici-types: 6.19.8
|
||||
|
||||
'@types/node@22.5.5':
|
||||
dependencies:
|
||||
undici-types: 6.19.8
|
||||
|
||||
'@types/papaparse@5.3.14':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
@@ -15962,20 +16151,20 @@ snapshots:
|
||||
|
||||
'@types/responselike@1.0.3':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/retry@0.12.0': {}
|
||||
|
||||
'@types/sax@1.2.7':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/semver@7.5.8': {}
|
||||
|
||||
'@types/send@0.17.4':
|
||||
dependencies:
|
||||
'@types/mime': 1.3.5
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/serve-index@1.9.4':
|
||||
dependencies:
|
||||
@@ -15984,12 +16173,14 @@ snapshots:
|
||||
'@types/serve-static@1.15.7':
|
||||
dependencies:
|
||||
'@types/http-errors': 2.0.4
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
'@types/send': 0.17.4
|
||||
|
||||
'@types/sockjs@0.3.36':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/statuses@2.0.5': {}
|
||||
|
||||
'@types/tough-cookie@4.0.5': {}
|
||||
|
||||
@@ -16005,9 +16196,11 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/webidl-conversions': 7.0.3
|
||||
|
||||
'@types/wrap-ansi@3.0.0': {}
|
||||
|
||||
'@types/ws@8.5.12':
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
|
||||
'@types/yargs-parser@21.0.3': {}
|
||||
|
||||
@@ -16233,14 +16426,14 @@ snapshots:
|
||||
|
||||
'@ungap/structured-clone@1.2.0': {}
|
||||
|
||||
'@vitejs/plugin-react@4.3.1(vite@5.4.2(@types/node@22.5.4)(terser@5.32.0))':
|
||||
'@vitejs/plugin-react@4.3.1(vite@5.4.2(@types/node@22.5.5)(terser@5.32.0))':
|
||||
dependencies:
|
||||
'@babel/core': 7.25.2
|
||||
'@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.25.2)
|
||||
'@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/core@7.25.2)
|
||||
'@types/babel__core': 7.20.5
|
||||
react-refresh: 0.14.2
|
||||
vite: 5.4.2(@types/node@22.5.4)(terser@5.32.0)
|
||||
vite: 5.4.2(@types/node@22.5.5)(terser@5.32.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -16257,14 +16450,24 @@ snapshots:
|
||||
chai: 5.1.1
|
||||
tinyrainbow: 1.2.0
|
||||
|
||||
'@vitest/mocker@2.1.1(@vitest/spy@2.1.1)(vite@5.4.2(@types/node@22.5.4)(terser@5.32.0))':
|
||||
'@vitest/mocker@2.1.1(@vitest/spy@2.1.1)(msw@2.4.8(typescript@5.6.2))(vite@5.4.2(@types/node@22.5.4)(terser@5.32.0))':
|
||||
dependencies:
|
||||
'@vitest/spy': 2.1.1
|
||||
estree-walker: 3.0.3
|
||||
magic-string: 0.30.11
|
||||
optionalDependencies:
|
||||
msw: 2.4.8(typescript@5.6.2)
|
||||
vite: 5.4.2(@types/node@22.5.4)(terser@5.32.0)
|
||||
|
||||
'@vitest/mocker@2.1.1(@vitest/spy@2.1.1)(msw@2.4.8(typescript@5.6.2))(vite@5.4.2(@types/node@22.5.5)(terser@5.32.0))':
|
||||
dependencies:
|
||||
'@vitest/spy': 2.1.1
|
||||
estree-walker: 3.0.3
|
||||
magic-string: 0.30.11
|
||||
optionalDependencies:
|
||||
msw: 2.4.8(typescript@5.6.2)
|
||||
vite: 5.4.2(@types/node@22.5.5)(terser@5.32.0)
|
||||
|
||||
'@vitest/pretty-format@2.1.1':
|
||||
dependencies:
|
||||
tinyrainbow: 1.2.0
|
||||
@@ -16614,6 +16817,10 @@ snapshots:
|
||||
|
||||
ansi-colors@4.1.3: {}
|
||||
|
||||
ansi-escapes@4.3.2:
|
||||
dependencies:
|
||||
type-fest: 0.21.3
|
||||
|
||||
ansi-escapes@7.0.0:
|
||||
dependencies:
|
||||
environment: 1.1.0
|
||||
@@ -17296,6 +17503,8 @@ snapshots:
|
||||
slice-ansi: 5.0.0
|
||||
string-width: 7.2.0
|
||||
|
||||
cli-width@4.1.0: {}
|
||||
|
||||
client-only@0.0.1: {}
|
||||
|
||||
cliui@8.0.1:
|
||||
@@ -19526,6 +19735,8 @@ snapshots:
|
||||
|
||||
he@1.2.0: {}
|
||||
|
||||
headers-polyfill@4.0.3: {}
|
||||
|
||||
highlight.js@10.7.3: {}
|
||||
|
||||
history@4.10.1:
|
||||
@@ -19906,6 +20117,8 @@ snapshots:
|
||||
|
||||
is-negative-zero@2.0.3: {}
|
||||
|
||||
is-node-process@1.2.0: {}
|
||||
|
||||
is-npm@6.0.0: {}
|
||||
|
||||
is-number-object@1.0.7:
|
||||
@@ -20054,7 +20267,7 @@ snapshots:
|
||||
jest-util@29.7.0:
|
||||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.9.0
|
||||
graceful-fs: 4.2.11
|
||||
@@ -20062,13 +20275,13 @@ snapshots:
|
||||
|
||||
jest-worker@27.5.1:
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
merge-stream: 2.0.0
|
||||
supports-color: 8.1.1
|
||||
|
||||
jest-worker@29.7.0:
|
||||
dependencies:
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
jest-util: 29.7.0
|
||||
merge-stream: 2.0.0
|
||||
supports-color: 8.1.1
|
||||
@@ -21187,6 +21400,28 @@ snapshots:
|
||||
|
||||
ms@2.1.3: {}
|
||||
|
||||
msw@2.4.8(typescript@5.6.2):
|
||||
dependencies:
|
||||
'@bundled-es-modules/cookie': 2.0.0
|
||||
'@bundled-es-modules/statuses': 1.0.1
|
||||
'@bundled-es-modules/tough-cookie': 0.1.6
|
||||
'@inquirer/confirm': 3.2.0
|
||||
'@mswjs/interceptors': 0.35.6
|
||||
'@open-draft/until': 2.1.0
|
||||
'@types/cookie': 0.6.0
|
||||
'@types/statuses': 2.0.5
|
||||
chalk: 4.1.2
|
||||
graphql: 16.9.0
|
||||
headers-polyfill: 4.0.3
|
||||
is-node-process: 1.2.0
|
||||
outvariant: 1.4.3
|
||||
path-to-regexp: 6.3.0
|
||||
strict-event-emitter: 0.5.1
|
||||
type-fest: 4.26.1
|
||||
yargs: 17.7.2
|
||||
optionalDependencies:
|
||||
typescript: 5.6.2
|
||||
|
||||
multicast-dns@7.2.5:
|
||||
dependencies:
|
||||
dns-packet: 5.6.1
|
||||
@@ -21194,6 +21429,8 @@ snapshots:
|
||||
|
||||
mustache@4.2.0: {}
|
||||
|
||||
mute-stream@1.0.0: {}
|
||||
|
||||
mz@2.7.0:
|
||||
dependencies:
|
||||
any-promise: 1.3.0
|
||||
@@ -21630,6 +21867,8 @@ snapshots:
|
||||
|
||||
outdent@0.5.0: {}
|
||||
|
||||
outvariant@1.4.3: {}
|
||||
|
||||
p-cancelable@2.1.1: {}
|
||||
|
||||
p-cancelable@3.0.0: {}
|
||||
@@ -21792,6 +22031,8 @@ snapshots:
|
||||
|
||||
path-to-regexp@6.2.2: {}
|
||||
|
||||
path-to-regexp@6.3.0: {}
|
||||
|
||||
path-type@4.0.0: {}
|
||||
|
||||
pathe@1.1.2: {}
|
||||
@@ -23359,6 +23600,8 @@ snapshots:
|
||||
optionalDependencies:
|
||||
bare-events: 2.4.2
|
||||
|
||||
strict-event-emitter@0.5.1: {}
|
||||
|
||||
string-argv@0.3.2: {}
|
||||
|
||||
string-collapse-leading-whitespace@7.0.7: {}
|
||||
@@ -23866,6 +24109,8 @@ snapshots:
|
||||
|
||||
type-fest@0.20.2: {}
|
||||
|
||||
type-fest@0.21.3: {}
|
||||
|
||||
type-fest@1.4.0: {}
|
||||
|
||||
type-fest@2.19.0: {}
|
||||
@@ -24127,13 +24372,13 @@ snapshots:
|
||||
'@types/unist': 3.0.3
|
||||
vfile-message: 4.0.2
|
||||
|
||||
vite-node@1.5.3(@types/node@22.5.4)(terser@5.32.0):
|
||||
vite-node@1.5.3(@types/node@22.5.5)(terser@5.32.0):
|
||||
dependencies:
|
||||
cac: 6.7.14
|
||||
debug: 4.3.7
|
||||
pathe: 1.1.2
|
||||
picocolors: 1.1.0
|
||||
vite: 5.4.2(@types/node@22.5.4)(terser@5.32.0)
|
||||
vite: 5.4.2(@types/node@22.5.5)(terser@5.32.0)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- less
|
||||
@@ -24162,9 +24407,26 @@ snapshots:
|
||||
- supports-color
|
||||
- terser
|
||||
|
||||
vite-plugin-wasm@3.3.0(vite@5.4.2(@types/node@22.5.4)(terser@5.32.0)):
|
||||
vite-node@2.1.1(@types/node@22.5.5)(terser@5.32.0):
|
||||
dependencies:
|
||||
vite: 5.4.2(@types/node@22.5.4)(terser@5.32.0)
|
||||
cac: 6.7.14
|
||||
debug: 4.3.7
|
||||
pathe: 1.1.2
|
||||
vite: 5.4.2(@types/node@22.5.5)(terser@5.32.0)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- less
|
||||
- lightningcss
|
||||
- sass
|
||||
- sass-embedded
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
|
||||
vite-plugin-wasm@3.3.0(vite@5.4.2(@types/node@22.5.5)(terser@5.32.0)):
|
||||
dependencies:
|
||||
vite: 5.4.2(@types/node@22.5.5)(terser@5.32.0)
|
||||
|
||||
vite@5.4.2(@types/node@22.5.4)(terser@5.32.0):
|
||||
dependencies:
|
||||
@@ -24176,7 +24438,17 @@ snapshots:
|
||||
fsevents: 2.3.3
|
||||
terser: 5.32.0
|
||||
|
||||
vitest@1.5.3(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(terser@5.32.0):
|
||||
vite@5.4.2(@types/node@22.5.5)(terser@5.32.0):
|
||||
dependencies:
|
||||
esbuild: 0.21.5
|
||||
postcss: 8.4.41
|
||||
rollup: 4.21.2
|
||||
optionalDependencies:
|
||||
'@types/node': 22.5.5
|
||||
fsevents: 2.3.3
|
||||
terser: 5.32.0
|
||||
|
||||
vitest@1.5.3(@edge-runtime/vm@4.0.3)(@types/node@22.5.5)(happy-dom@15.7.4)(terser@5.32.0):
|
||||
dependencies:
|
||||
'@vitest/expect': 1.5.3
|
||||
'@vitest/runner': 1.5.3
|
||||
@@ -24195,12 +24467,12 @@ snapshots:
|
||||
strip-literal: 2.1.0
|
||||
tinybench: 2.9.0
|
||||
tinypool: 0.8.4
|
||||
vite: 5.4.2(@types/node@22.5.4)(terser@5.32.0)
|
||||
vite-node: 1.5.3(@types/node@22.5.4)(terser@5.32.0)
|
||||
vite: 5.4.2(@types/node@22.5.5)(terser@5.32.0)
|
||||
vite-node: 1.5.3(@types/node@22.5.5)(terser@5.32.0)
|
||||
why-is-node-running: 2.3.0
|
||||
optionalDependencies:
|
||||
'@edge-runtime/vm': 4.0.3
|
||||
'@types/node': 22.5.4
|
||||
'@types/node': 22.5.5
|
||||
happy-dom: 15.7.4
|
||||
transitivePeerDependencies:
|
||||
- less
|
||||
@@ -24212,10 +24484,10 @@ snapshots:
|
||||
- supports-color
|
||||
- terser
|
||||
|
||||
vitest@2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(terser@5.32.0):
|
||||
vitest@2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.4)(happy-dom@15.7.4)(msw@2.4.8(typescript@5.6.2))(terser@5.32.0):
|
||||
dependencies:
|
||||
'@vitest/expect': 2.1.1
|
||||
'@vitest/mocker': 2.1.1(@vitest/spy@2.1.1)(vite@5.4.2(@types/node@22.5.4)(terser@5.32.0))
|
||||
'@vitest/mocker': 2.1.1(@vitest/spy@2.1.1)(msw@2.4.8(typescript@5.6.2))(vite@5.4.2(@types/node@22.5.4)(terser@5.32.0))
|
||||
'@vitest/pretty-format': 2.1.1
|
||||
'@vitest/runner': 2.1.1
|
||||
'@vitest/snapshot': 2.1.1
|
||||
@@ -24248,6 +24520,42 @@ snapshots:
|
||||
- supports-color
|
||||
- terser
|
||||
|
||||
vitest@2.1.1(@edge-runtime/vm@4.0.3)(@types/node@22.5.5)(happy-dom@15.7.4)(msw@2.4.8(typescript@5.6.2))(terser@5.32.0):
|
||||
dependencies:
|
||||
'@vitest/expect': 2.1.1
|
||||
'@vitest/mocker': 2.1.1(@vitest/spy@2.1.1)(msw@2.4.8(typescript@5.6.2))(vite@5.4.2(@types/node@22.5.5)(terser@5.32.0))
|
||||
'@vitest/pretty-format': 2.1.1
|
||||
'@vitest/runner': 2.1.1
|
||||
'@vitest/snapshot': 2.1.1
|
||||
'@vitest/spy': 2.1.1
|
||||
'@vitest/utils': 2.1.1
|
||||
chai: 5.1.1
|
||||
debug: 4.3.7
|
||||
magic-string: 0.30.11
|
||||
pathe: 1.1.2
|
||||
std-env: 3.7.0
|
||||
tinybench: 2.9.0
|
||||
tinyexec: 0.3.0
|
||||
tinypool: 1.0.1
|
||||
tinyrainbow: 1.2.0
|
||||
vite: 5.4.2(@types/node@22.5.5)(terser@5.32.0)
|
||||
vite-node: 2.1.1(@types/node@22.5.5)(terser@5.32.0)
|
||||
why-is-node-running: 2.3.0
|
||||
optionalDependencies:
|
||||
'@edge-runtime/vm': 4.0.3
|
||||
'@types/node': 22.5.5
|
||||
happy-dom: 15.7.4
|
||||
transitivePeerDependencies:
|
||||
- less
|
||||
- lightningcss
|
||||
- msw
|
||||
- sass
|
||||
- sass-embedded
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
|
||||
vue@3.5.5(typescript@5.6.2):
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.5
|
||||
@@ -24258,18 +24566,18 @@ snapshots:
|
||||
optionalDependencies:
|
||||
typescript: 5.6.2
|
||||
|
||||
waku@0.21.1(@swc/helpers@0.5.13)(@types/node@22.5.4)(react-dom@19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827))(react-server-dom-webpack@19.0.0-rc-7771d3a7-20240827(react-dom@19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827))(react@19.0.0-rc-7771d3a7-20240827)(webpack@5.94.0))(react@19.0.0-rc-7771d3a7-20240827)(terser@5.32.0):
|
||||
waku@0.21.1(@swc/helpers@0.5.13)(@types/node@22.5.5)(react-dom@19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827))(react-server-dom-webpack@19.0.0-rc-7771d3a7-20240827(react-dom@19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827))(react@19.0.0-rc-7771d3a7-20240827)(webpack@5.94.0))(react@19.0.0-rc-7771d3a7-20240827)(terser@5.32.0):
|
||||
dependencies:
|
||||
'@hono/node-server': 1.12.2(hono@4.5.9)
|
||||
'@swc/core': 1.6.7(@swc/helpers@0.5.13)
|
||||
'@vitejs/plugin-react': 4.3.1(vite@5.4.2(@types/node@22.5.4)(terser@5.32.0))
|
||||
'@vitejs/plugin-react': 4.3.1(vite@5.4.2(@types/node@22.5.5)(terser@5.32.0))
|
||||
dotenv: 16.4.5
|
||||
hono: 4.5.9
|
||||
react: 19.0.0-rc-7771d3a7-20240827
|
||||
react-dom: 19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827)
|
||||
react-server-dom-webpack: 19.0.0-rc-7771d3a7-20240827(react-dom@19.0.0-rc-7771d3a7-20240827(react@19.0.0-rc-7771d3a7-20240827))(react@19.0.0-rc-7771d3a7-20240827)(webpack@5.94.0)
|
||||
rsc-html-stream: 0.0.3
|
||||
vite: 5.4.2(@types/node@22.5.4)(terser@5.32.0)
|
||||
vite: 5.4.2(@types/node@22.5.5)(terser@5.32.0)
|
||||
transitivePeerDependencies:
|
||||
- '@swc/helpers'
|
||||
- '@types/node'
|
||||
@@ -24625,6 +24933,12 @@ snapshots:
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
|
||||
wrap-ansi@6.2.0:
|
||||
dependencies:
|
||||
ansi-styles: 4.3.0
|
||||
string-width: 4.2.3
|
||||
strip-ansi: 6.0.1
|
||||
|
||||
wrap-ansi@7.0.0:
|
||||
dependencies:
|
||||
ansi-styles: 4.3.0
|
||||
@@ -24696,6 +25010,8 @@ snapshots:
|
||||
|
||||
yocto-queue@1.1.1: {}
|
||||
|
||||
yoctocolors-cjs@2.1.2: {}
|
||||
|
||||
youch@3.3.3:
|
||||
dependencies:
|
||||
cookie: 0.5.0
|
||||
|
||||
Reference in New Issue
Block a user