Compare commits

...

26 Commits

Author SHA1 Message Date
Marcus Schiesser de194d1c73 fix: running new-create-llama 2024-03-06 15:13:20 +07:00
Marcus Schiesser ecdc289df1 RELEASING: Releasing 1 package(s)
Releases:
  create-llama@0.0.27

[skip ci]
2024-03-06 15:11:47 +07:00
Marcus Schiesser 9e198ac40d fix: build types for core locally (#615) 2024-03-06 14:35:31 +07:00
Huu Le (Lee) 0a06998690 fix: hardcode "en" as default language for llama-parse and use llama cloud key from env (#614) 2024-03-06 14:31:21 +07:00
Wojciech Grzebieniowski 484a7105a9 fix: restore missing exports (#610) 2024-03-05 14:56:25 -06:00
Alex Yang 8d18ea167b fix: publish.yml 2024-03-05 14:37:54 -06:00
Alex Yang a2ca89bfe0 fix: config (#611) 2024-03-05 14:20:58 -06:00
Alex Yang edeea40898 ci: add publish.yml 2024-03-05 13:49:49 -06:00
Alex Yang 2a7080b094 build: fix version 2024-03-05 12:26:47 -06:00
Huu Le (Lee) b354f2386b feat: add embedding model option to create-llama (#608) 2024-03-05 16:59:51 +07:00
Emanuel Ferreira d766bd03d2 feat: OpenAI Agent Stream (#597) 2024-03-05 15:46:44 +07:00
Huu Le (Lee) 6a69148356 fix: add --no-llama-parse and improve e2e test (#607) 2024-03-05 14:57:38 +07:00
Marcus Schiesser e1e1b0b522 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.21

[skip ci]
2024-03-05 13:00:16 +07:00
Marcus Schiesser d824876653 docs(changeset): Add support for Claude 3 2024-03-05 12:59:51 +07:00
Marcus Schiesser 2048698f77 docs: add interactive chat for anthropic 2024-03-05 11:15:50 +07:00
Emanuel Ferreira 9942979aa7 feat: Claude 3 (#604) 2024-03-04 15:02:18 -08:00
Alex Yang 3c2655a1f9 fix: .tsbuildinfo 2024-03-04 16:05:45 -06:00
Marcus Schiesser 552a61a66f Add quantized parameter to HuggingFaceEmbedding (#601) 2024-03-04 12:10:40 +07:00
Alex Yang d13143e322 RELEASING: Releasing 3 package(s)
Releases:
  llamaindex@0.1.20
  @llamaindex/env@0.0.5
  docs@0.0.4

[skip ci]
2024-03-02 18:42:24 -06:00
Alex Yang 5116ad8d08 fix: compatibility issue with Deno (#598) 2024-03-02 18:40:01 -06:00
Emanuel Ferreira 64683a55f3 fix: prefix messages always true (#596) 2024-03-01 21:45:02 -03:00
Emanuel Ferreira 698cd9c631 fix: step wise agent + examples (#594) 2024-03-01 21:28:02 -03:00
Alex Yang c744a99102 chore: bump @llamaindex/cloud (#595) 2024-03-01 17:22:50 -06:00
Huu Le (Lee) 2d2935085e feat: Add use LlamaParse option to create-llama (#591) 2024-03-01 16:54:06 +07:00
Marcus Schiesser 1b31e2c8cd chore: update @llamaindex/cloud to 0.0.2 2024-03-01 15:59:10 +07:00
Thuc Pham 7257751993 fix: empty store bugs (#592)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-03-01 15:04:10 +07:00
80 changed files with 1365 additions and 340 deletions
+12
View File
@@ -0,0 +1,12 @@
---
"llamaindex": patch
"@llamaindex/core-test": patch
---
- Add missing exports:
- `IndexStructType`,
- `IndexDict`,
- `jsonToIndexStruct`,
- `IndexList`,
- `IndexStruct`
- Fix `IndexDict.toJson()` method
+5
View File
@@ -0,0 +1,5 @@
---
"llamaindex": patch
---
Add streaming to agents
+8
View File
@@ -11,5 +11,13 @@ module.exports = {
"max-params": ["error", 4],
"prefer-const": "error",
},
overrides: [
{
files: ["examples/**/*.ts"],
rules: {
"turbo/no-undeclared-env-vars": "off",
},
},
],
ignorePatterns: ["dist/", "lib/"],
};
+24
View File
@@ -0,0 +1,24 @@
name: Publish
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Publish @llamaindex/env
run: npx jsr publish
working-directory: packages/env
- name: Publish @llamaindex/core
run: npx jsr publish --allow-slow-types
working-directory: packages/core
+1
View File
@@ -44,6 +44,7 @@ test-results/
playwright-report/
blob-report/
playwright/.cache/
.tsbuildinfo
# intellij
**/.idea
+7
View File
@@ -1,5 +1,12 @@
# docs
## 0.0.4
### Patch Changes
- Updated dependencies [5116ad8]
- @llamaindex/env@0.0.5
## 0.0.3
### Patch Changes
@@ -23,3 +23,15 @@ const results = await queryEngine.query({
query,
});
```
Per default, `HuggingFaceEmbedding` is using the `Xenova/all-MiniLM-L6-v2` model. You can change the model by passing the `modelType` parameter to the constructor.
If you're not using a quantized model, set the `quantized` parameter to `false`.
For example, to use the not quantized `BAAI/bge-small-en-v1.5` model, you can use the following code:
```
const embedModel = new HuggingFaceEmbedding({
modelType: "BAAI/bge-small-en-v1.5",
quantized: false,
});
```
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "0.0.3",
"version": "0.0.4",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
+95
View File
@@ -0,0 +1,95 @@
import { FunctionTool, OpenAIAgent } from "llamaindex";
// Define a function to sum two numbers
function sumNumbers({ a, b }: { a: number; b: number }): number {
return a + b;
}
// Define a function to divide two numbers
function divideNumbers({ a, b }: { a: number; b: number }): number {
return a / b;
}
// Define the parameters of the sum function as a JSON schema
const sumJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The first number",
},
b: {
type: "number",
description: "The second number",
},
},
required: ["a", "b"],
};
const divideJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The dividend a to divide",
},
b: {
type: "number",
description: "The divisor b to divide by",
},
},
required: ["a", "b"],
};
async function main() {
// Create a function tool from the sum function
const functionTool = new FunctionTool(sumNumbers, {
name: "sumNumbers",
description: "Use this function to sum two numbers",
parameters: sumJSON,
});
// Create a function tool from the divide function
const functionTool2 = new FunctionTool(divideNumbers, {
name: "divideNumbers",
description: "Use this function to divide two numbers",
parameters: divideJSON,
});
// Create an OpenAIAgent with the function tools
const agent = new OpenAIAgent({
tools: [functionTool, functionTool2],
verbose: true,
});
// Create a task to sum and divide numbers
const task = agent.createTask("How much is 5 + 5? then divide by 2");
let count = 0;
while (true) {
const stepOutput = await agent.runStep(task.taskId);
console.log(`Runnning step ${count++}`);
console.log(`======== OUTPUT ==========`);
if (stepOutput.output.response) {
console.log(stepOutput.output.response);
} else {
console.log(stepOutput.output.sources);
}
console.log(`==========================`);
if (stepOutput.isLast) {
const finalResponse = await agent.finalizeResponse(
task.taskId,
stepOutput,
);
console.log({ finalResponse });
break;
}
}
}
main().then(() => {
console.log("Done");
});
+64
View File
@@ -0,0 +1,64 @@
import {
OpenAIAgent,
QueryEngineTool,
SimpleDirectoryReader,
VectorStoreIndex,
} from "llamaindex";
async function main() {
// Load the documents
const documents = await new SimpleDirectoryReader().loadData({
directoryPath: "node_modules/llamaindex/examples",
});
// Create a vector index from the documents
const vectorIndex = await VectorStoreIndex.fromDocuments(documents);
// Create a query engine from the vector index
const abramovQueryEngine = vectorIndex.asQueryEngine();
// Create a QueryEngineTool with the query engine
const queryEngineTool = new QueryEngineTool({
queryEngine: abramovQueryEngine,
metadata: {
name: "abramov_query_engine",
description: "A query engine for the Abramov documents",
},
});
// Create an OpenAIAgent with the function tools
const agent = new OpenAIAgent({
tools: [queryEngineTool],
verbose: true,
});
const task = agent.createTask("What was his salary?");
let count = 0;
while (true) {
const stepOutput = await agent.runStep(task.taskId);
console.log(`Runnning step ${count++}`);
console.log(`======== OUTPUT ==========`);
if (stepOutput.output.response) {
console.log(stepOutput.output.response);
} else {
console.log(stepOutput.output.sources);
}
console.log(`==========================`);
if (stepOutput.isLast) {
const finalResponse = await agent.finalizeResponse(
task.taskId,
stepOutput,
);
console.log({ finalResponse });
break;
}
}
}
main().then(() => {
console.log("Done");
});
+90
View File
@@ -0,0 +1,90 @@
import { FunctionTool, ReActAgent } from "llamaindex";
// Define a function to sum two numbers
function sumNumbers({ a, b }: { a: number; b: number }): number {
return a + b;
}
// Define a function to divide two numbers
function divideNumbers({ a, b }: { a: number; b: number }): number {
return a / b;
}
// Define the parameters of the sum function as a JSON schema
const sumJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The first number",
},
b: {
type: "number",
description: "The second number",
},
},
required: ["a", "b"],
};
const divideJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The dividend",
},
b: {
type: "number",
description: "The divisor",
},
},
required: ["a", "b"],
};
async function main() {
// Create a function tool from the sum function
const functionTool = new FunctionTool(sumNumbers, {
name: "sumNumbers",
description: "Use this function to sum two numbers",
parameters: sumJSON,
});
// Create a function tool from the divide function
const functionTool2 = new FunctionTool(divideNumbers, {
name: "divideNumbers",
description: "Use this function to divide two numbers",
parameters: divideJSON,
});
// Create an OpenAIAgent with the function tools
const agent = new ReActAgent({
tools: [functionTool, functionTool2],
verbose: true,
});
const task = agent.createTask("Divide 16 by 2 then add 20");
let count = 0;
while (true) {
const stepOutput = await agent.runStep(task.taskId);
console.log(`Runnning step ${count++}`);
console.log(`======== OUTPUT ==========`);
console.log(stepOutput.output);
console.log(`==========================`);
if (stepOutput.isLast) {
const finalResponse = await agent.finalizeResponse(
task.taskId,
stepOutput,
);
console.log({ finalResponse });
break;
}
}
}
main().then(() => {
console.log("Done");
});
+77
View File
@@ -0,0 +1,77 @@
import { FunctionTool, OpenAIAgent } from "llamaindex";
// Define a function to sum two numbers
function sumNumbers({ a, b }: { a: number; b: number }): number {
return a + b;
}
// Define a function to divide two numbers
function divideNumbers({ a, b }: { a: number; b: number }): number {
return a / b;
}
// Define the parameters of the sum function as a JSON schema
const sumJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The first number",
},
b: {
type: "number",
description: "The second number",
},
},
required: ["a", "b"],
};
const divideJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The dividend",
},
b: {
type: "number",
description: "The divisor",
},
},
required: ["a", "b"],
};
async function main() {
// Create a function tool from the sum function
const functionTool = new FunctionTool(sumNumbers, {
name: "sumNumbers",
description: "Use this function to sum two numbers",
parameters: sumJSON,
});
// Create a function tool from the divide function
const functionTool2 = new FunctionTool(divideNumbers, {
name: "divideNumbers",
description: "Use this function to divide two numbers",
parameters: divideJSON,
});
// Create an OpenAIAgent with the function tools
const agent = new OpenAIAgent({
tools: [functionTool, functionTool2],
verbose: false,
});
const stream = await agent.chat({
message: "Divide 16 by 2 then add 20",
stream: true,
});
for await (const chunk of stream.response) {
process.stdout.write(chunk.response);
}
}
main().then(() => {
console.log("\nDone");
});
@@ -3,6 +3,7 @@ import { Anthropic } from "llamaindex";
(async () => {
const anthropic = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
model: "claude-3-opus",
});
const result = await anthropic.chat({
messages: [
+34
View File
@@ -0,0 +1,34 @@
import { Anthropic, SimpleChatEngine, SimpleChatHistory } from "llamaindex";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline/promises";
(async () => {
const llm = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
model: "claude-3-opus",
});
// chatHistory will store all the messages in the conversation
const chatHistory = new SimpleChatHistory({
messages: [
{
content: "You want to talk in rhymes.",
role: "system",
},
],
});
const chatEngine = new SimpleChatEngine({
llm,
chatHistory,
});
const rl = readline.createInterface({ input, output });
while (true) {
const query = await rl.question("User: ");
process.stdout.write("Assistant: ");
const stream = await chatEngine.chat({ message: query, stream: true });
for await (const chunk of stream) {
process.stdout.write(chunk.response);
}
process.stdout.write("\n");
}
})();
+23
View File
@@ -0,0 +1,23 @@
import { Anthropic } from "llamaindex";
(async () => {
const anthropic = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
model: "claude-instant-1.2",
});
const stream = await anthropic.chat({
messages: [
{ content: "You want to talk in rhymes.", role: "system" },
{
content:
"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
role: "user",
},
],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.delta);
}
})();
+1 -1
View File
@@ -13,7 +13,7 @@
"type-check": "tsc -b --diagnostics",
"release": "pnpm run build:release && changeset publish",
"new-llamaindex": "pnpm run build:release && changeset version --ignore create-llama",
"new-create-llama": "pnpm run build:release && changeset version --ignore llamaindex",
"new-create-llama": "pnpm run build:release && changeset version --ignore llamaindex --ignore @llamaindex/core-test",
"new-snapshots": "pnpm run build:release && changeset version --snapshot"
},
"devDependencies": {
+18
View File
@@ -1,5 +1,23 @@
# llamaindex
## 0.1.21
### Patch Changes
- 552a61a: Add quantized parameter to HuggingFaceEmbedding
- d824876: Add support for Claude 3
## 0.1.20
### Patch Changes
- 64683a5: fix: prefix messages always true
- 698cd9c: fix: step wise agent + examples
- 7257751: fixed removeRefDocNode and persist store on delete
- 5116ad8: fix: compatibility issue with Deno
- Updated dependencies [5116ad8]
- @llamaindex/env@0.0.5
## 0.1.19
### Patch Changes
+8
View File
@@ -0,0 +1,8 @@
{
"name": "@llamaindex/core",
"version": "0.1.21",
"exports": "./src/index.ts",
"imports": {
"@llamaindex/env": "jsr:@llamaindex/env@0.0.5"
}
}
+8 -8
View File
@@ -1,22 +1,22 @@
{
"name": "llamaindex",
"version": "0.1.19",
"version": "0.1.21",
"license": "MIT",
"type": "module",
"dependencies": {
"@anthropic-ai/sdk": "^0.13.0",
"@anthropic-ai/sdk": "^0.15.0",
"@aws-crypto/sha256-js": "^5.2.0",
"@datastax/astra-db-ts": "^0.1.4",
"@types/lodash": "^4.14.202",
"@types/node": "^18.19.14",
"@types/papaparse": "^5.3.14",
"@types/pg": "^8.11.0",
"@llamaindex/cloud": "^0.0.1",
"@llamaindex/cloud": "0.0.4",
"@llamaindex/env": "workspace:*",
"@mistralai/mistralai": "^0.0.10",
"@notionhq/client": "^2.2.14",
"@pinecone-database/pinecone": "^2.0.1",
"@qdrant/js-client-rest": "^1.7.0",
"@types/lodash": "^4.14.202",
"@types/node": "^18.19.14",
"@types/papaparse": "^5.3.14",
"@types/pg": "^8.11.0",
"@xenova/transformers": "^2.15.0",
"assemblyai": "^4.2.2",
"chromadb": "~1.7.3",
@@ -94,7 +94,7 @@
"build": "rm -rf ./dist && pnpm run build:esm && pnpm run build:cjs && pnpm run build:type",
"build:esm": "swc src -d dist --strip-leading-paths --config-file .swcrc",
"build:cjs": "swc src -d dist/cjs --strip-leading-paths --config-file .cjs.swcrc",
"build:type": "pnpm run -w type-check",
"build:type": "tsc -p tsconfig.json",
"copy": "cp -r ../../README.md ../../LICENSE .",
"postbuild": "pnpm run copy && node -e \"require('fs').writeFileSync('./dist/cjs/package.json', JSON.stringify({ type: 'commonjs' }))\"",
"circular-check": "madge -c ./src/index.ts",
-2
View File
@@ -37,8 +37,6 @@ export class OpenAIAgent extends AgentRunner {
toolRetriever,
systemPrompt,
}: OpenAIAgentParams) {
prefixMessages = prefixMessages || [];
llm = llm ?? new OpenAI({ model: "gpt-3.5-turbo-0613" });
if (systemPrompt) {
+36 -4
View File
@@ -1,10 +1,12 @@
// Assuming that the necessary interfaces and classes (like BaseTool, OpenAI, ChatMessage, CallbackManager, etc.) are defined elsewhere
import { randomUUID } from "@llamaindex/env";
import { Response } from "../../Response.js";
import type { CallbackManager } from "../../callbacks/CallbackManager.js";
import {
AgentChatResponse,
ChatResponseMode,
StreamingAgentChatResponse,
} from "../../engines/chat/types.js";
import type {
ChatMessage,
@@ -12,6 +14,7 @@ import type {
ChatResponseChunk,
} from "../../llm/index.js";
import { OpenAI } from "../../llm/index.js";
import { streamConverter, streamReducer } from "../../llm/utils.js";
import { ChatMemoryBuffer } from "../../memory/ChatMemoryBuffer.js";
import type { ObjectRetriever } from "../../objects/base.js";
import type { ToolOutput } from "../../tools/types.js";
@@ -192,13 +195,40 @@ export class OpenAIAgentWorker implements AgentWorker {
private _processMessage(
task: Task,
chatResponse: ChatResponse,
): AgentChatResponse | AsyncIterable<ChatResponseChunk> {
): AgentChatResponse {
const aiMessage = chatResponse.message;
task.extraState.newMemory.put(aiMessage);
return new AgentChatResponse(aiMessage.content, task.extraState.sources);
}
private async _getStreamAiResponse(
task: Task,
llmChatKwargs: any,
): Promise<StreamingAgentChatResponse> {
const stream = await this.llm.chat({
stream: true,
...llmChatKwargs,
});
const iterator = streamConverter(
streamReducer({
stream,
initialValue: "",
reducer: (accumulator, part) => (accumulator += part.delta),
finished: (accumulator) => {
task.extraState.newMemory.put({
content: accumulator,
role: "assistant",
});
},
}),
(r: ChatResponseChunk) => new Response(r.delta),
);
return new StreamingAgentChatResponse(iterator, task.extraState.sources);
}
/**
* Get agent response.
* @param task: task
@@ -210,7 +240,7 @@ export class OpenAIAgentWorker implements AgentWorker {
task: Task,
mode: ChatResponseMode,
llmChatKwargs: any,
): Promise<AgentChatResponse> {
): Promise<AgentChatResponse | StreamingAgentChatResponse> {
if (mode === ChatResponseMode.WAIT) {
const chatResponse = (await this.llm.chat({
stream: false,
@@ -218,9 +248,11 @@ export class OpenAIAgentWorker implements AgentWorker {
})) as unknown as ChatResponse;
return this._processMessage(task, chatResponse) as AgentChatResponse;
} else {
throw new Error("Not implemented");
} else if (mode === ChatResponseMode.STREAM) {
return this._getStreamAiResponse(task, llmChatKwargs);
}
throw new Error("Invalid mode");
}
/**
+54 -18
View File
@@ -4,6 +4,7 @@ import type { ChatEngineAgentParams } from "../../engines/chat/index.js";
import {
AgentChatResponse,
ChatResponseMode,
StreamingAgentChatResponse,
} from "../../engines/chat/index.js";
import type { ChatMessage, LLM } from "../../llm/index.js";
import { ChatMemoryBuffer } from "../../memory/ChatMemoryBuffer.js";
@@ -14,7 +15,7 @@ import { AgentState, BaseAgentRunner, TaskState } from "./types.js";
const validateStepFromArgs = (
taskId: string,
input: string,
input?: string | null,
step?: any,
kwargs?: any,
): TaskStep | undefined => {
@@ -24,6 +25,7 @@ const validateStepFromArgs = (
}
return step;
} else {
if (!input) return;
return new TaskStep(taskId, step, input, kwargs);
}
};
@@ -194,7 +196,7 @@ export class AgentRunner extends BaseAgentRunner {
*/
async runStep(
taskId: string,
input: string,
input?: string | null,
step?: TaskStep,
kwargs: any = {},
): Promise<TaskStepOutput> {
@@ -230,23 +232,26 @@ export class AgentRunner extends BaseAgentRunner {
taskId: string,
stepOutput: TaskStepOutput,
kwargs?: any,
): Promise<AgentChatResponse> {
): Promise<AgentChatResponse | StreamingAgentChatResponse> {
if (!stepOutput) {
stepOutput =
this.getCompletedSteps(taskId)[
this.getCompletedSteps(taskId).length - 1
];
}
if (!stepOutput.isLast) {
throw new Error(
"finalizeResponse can only be called on the last step output",
);
}
if (!(stepOutput.output instanceof AgentChatResponse)) {
throw new Error(
`When \`isLast\` is True, cur_step_output.output must be AGENT_CHAT_RESPONSE_TYPE: ${stepOutput.output}`,
);
if (!(stepOutput.output instanceof StreamingAgentChatResponse)) {
if (!(stepOutput.output instanceof AgentChatResponse)) {
throw new Error(
`When \`isLast\` is True, cur_step_output.output must be AGENT_CHAT_RESPONSE_TYPE: ${stepOutput.output}`,
);
}
}
this.agentWorker.finalizeTask(this.getTask(taskId), kwargs);
@@ -261,20 +266,32 @@ export class AgentRunner extends BaseAgentRunner {
protected async _chat({
message,
toolChoice,
}: ChatEngineAgentParams & { mode: ChatResponseMode }) {
stream,
}: ChatEngineAgentParams): Promise<AgentChatResponse>;
protected async _chat({
message,
toolChoice,
stream,
}: ChatEngineAgentParams & {
stream: true;
}): Promise<StreamingAgentChatResponse>;
protected async _chat({
message,
toolChoice,
stream,
}: ChatEngineAgentParams): Promise<
AgentChatResponse | StreamingAgentChatResponse
> {
const task = this.createTask(message as string);
let resultOutput;
const mode = stream ? ChatResponseMode.STREAM : ChatResponseMode.WAIT;
while (true) {
const curStepOutput = await this._runStep(
task.taskId,
undefined,
ChatResponseMode.WAIT,
{
toolChoice,
},
);
const curStepOutput = await this._runStep(task.taskId, undefined, mode, {
toolChoice,
});
if (curStepOutput.isLast) {
resultOutput = curStepOutput;
@@ -298,7 +315,26 @@ export class AgentRunner extends BaseAgentRunner {
message,
chatHistory,
toolChoice,
}: ChatEngineAgentParams): Promise<AgentChatResponse> {
stream,
}: ChatEngineAgentParams & {
stream?: false;
}): Promise<AgentChatResponse>;
public async chat({
message,
chatHistory,
toolChoice,
stream,
}: ChatEngineAgentParams & {
stream: true;
}): Promise<StreamingAgentChatResponse>;
public async chat({
message,
chatHistory,
toolChoice,
stream,
}: ChatEngineAgentParams): Promise<
AgentChatResponse | StreamingAgentChatResponse
> {
if (!toolChoice) {
toolChoice = this.defaultToolChoice;
}
@@ -307,7 +343,7 @@ export class AgentRunner extends BaseAgentRunner {
message,
chatHistory,
toolChoice,
mode: ChatResponseMode.WAIT,
stream,
});
return chatResponse;
+5 -2
View File
@@ -1,4 +1,7 @@
import type { AgentChatResponse } from "../../engines/chat/index.js";
import type {
AgentChatResponse,
StreamingAgentChatResponse,
} from "../../engines/chat/index.js";
import type { Task, TaskStep, TaskStepOutput } from "../types.js";
import { BaseAgent } from "../types.js";
@@ -57,7 +60,7 @@ export abstract class BaseAgentRunner extends BaseAgent {
taskId: string,
stepOutput: TaskStepOutput,
kwargs?: any,
): Promise<AgentChatResponse>;
): Promise<AgentChatResponse | StreamingAgentChatResponse>;
abstract undoStep(taskId: string): void;
}
+14 -6
View File
@@ -1,6 +1,7 @@
import type {
AgentChatResponse,
ChatEngineAgentParams,
StreamingAgentChatResponse,
} from "../engines/chat/index.js";
import type { QueryEngineParamsNonStreaming } from "../types.js";
@@ -12,11 +13,15 @@ export interface AgentWorker {
}
interface BaseChatEngine {
chat(params: ChatEngineAgentParams): Promise<AgentChatResponse>;
chat(
params: ChatEngineAgentParams,
): Promise<AgentChatResponse | StreamingAgentChatResponse>;
}
interface BaseQueryEngine {
query(params: QueryEngineParamsNonStreaming): Promise<AgentChatResponse>;
query(
params: QueryEngineParamsNonStreaming,
): Promise<AgentChatResponse | StreamingAgentChatResponse>;
}
/**
@@ -31,7 +36,10 @@ export abstract class BaseAgent implements BaseChatEngine, BaseQueryEngine {
return [];
}
abstract chat(params: ChatEngineAgentParams): Promise<AgentChatResponse>;
abstract chat(
params: ChatEngineAgentParams,
): Promise<AgentChatResponse | StreamingAgentChatResponse>;
abstract reset(): void;
/**
@@ -41,7 +49,7 @@ export abstract class BaseAgent implements BaseChatEngine, BaseQueryEngine {
*/
async query(
params: QueryEngineParamsNonStreaming,
): Promise<AgentChatResponse> {
): Promise<AgentChatResponse | StreamingAgentChatResponse> {
// Handle non-streaming query
const agentResponse = await this.chat({
message: params.query,
@@ -161,13 +169,13 @@ export class TaskStep implements ITaskStep {
* @param isLast: isLast
*/
export class TaskStepOutput {
output: unknown;
output: any;
taskStep: TaskStep;
nextSteps: TaskStep[];
isLast: boolean;
constructor(
output: unknown,
output: any,
taskStep: TaskStep,
nextSteps: TaskStep[],
isLast: boolean = false,
+3 -2
View File
@@ -1,4 +1,5 @@
import type { PlatformApiClient } from "@llamaindex/cloud";
import { getEnv } from "@llamaindex/env";
import type { ClientParams } from "./types.js";
import { DEFAULT_BASE_URL } from "./types.js";
@@ -7,8 +8,8 @@ export async function getClient({
baseUrl,
}: ClientParams = {}): Promise<PlatformApiClient> {
// Get the environment variables or use defaults
baseUrl = baseUrl ?? process.env.LLAMA_CLOUD_BASE_URL ?? DEFAULT_BASE_URL;
apiKey = apiKey ?? process.env.LLAMA_CLOUD_API_KEY;
baseUrl = baseUrl ?? getEnv("LLAMA_CLOUD_BASE_URL") ?? DEFAULT_BASE_URL;
apiKey = apiKey ?? getEnv("LLAMA_CLOUD_API_KEY");
const { PlatformApiClient } = await import("@llamaindex/cloud");
@@ -20,6 +20,7 @@ export enum HuggingFaceEmbeddingModelType {
*/
export class HuggingFaceEmbedding extends BaseEmbedding {
modelType: string = HuggingFaceEmbeddingModelType.XENOVA_ALL_MINILM_L6_V2;
quantized: boolean = true;
private extractor: any;
@@ -31,7 +32,9 @@ export class HuggingFaceEmbedding extends BaseEmbedding {
async getExtractor() {
if (!this.extractor) {
const { pipeline } = await import("@xenova/transformers");
this.extractor = await pipeline("feature-extraction", this.modelType);
this.extractor = await pipeline("feature-extraction", this.modelType, {
quantized: this.quantized,
});
}
return this.extractor;
}
+2 -1
View File
@@ -1,9 +1,10 @@
import { getEnv } from "@llamaindex/env";
import { OpenAIEmbedding } from "./OpenAIEmbedding.js";
export class FireworksEmbedding extends OpenAIEmbedding {
constructor(init?: Partial<OpenAIEmbedding>) {
const {
apiKey = process.env.FIREWORKS_API_KEY,
apiKey = getEnv("FIREWORKS_API_KEY"),
additionalSessionOptions = {},
model = "nomic-ai/nomic-embed-text-v1.5",
...rest
+2 -1
View File
@@ -1,9 +1,10 @@
import { getEnv } from "@llamaindex/env";
import { OpenAIEmbedding } from "./OpenAIEmbedding.js";
export class TogetherEmbedding extends OpenAIEmbedding {
constructor(init?: Partial<OpenAIEmbedding>) {
const {
apiKey = process.env.TOGETHER_API_KEY,
apiKey = getEnv("TOGETHER_API_KEY"),
additionalSessionOptions = {},
model = "togethercomputer/m2-bert-80M-32k-retrieval",
...rest
+18
View File
@@ -27,6 +27,7 @@ export interface ChatEngineParamsNonStreaming extends ChatEngineParamsBase {
export interface ChatEngineAgentParams extends ChatEngineParamsBase {
toolChoice?: string | Record<string, any>;
stream?: boolean;
}
/**
@@ -86,3 +87,20 @@ export class AgentChatResponse {
return this.response ?? "";
}
}
export class StreamingAgentChatResponse {
response: AsyncIterable<Response>;
sources: ToolOutput[];
sourceNodes?: BaseNode[];
constructor(
response: AsyncIterable<Response>,
sources?: ToolOutput[],
sourceNodes?: BaseNode[],
) {
this.response = response;
this.sources = sources ?? [];
this.sourceNodes = sourceNodes ?? [];
}
}
+2
View File
@@ -1,4 +1,6 @@
export * from "./BaseIndex.js";
export * from "./IndexStruct.js";
export * from "./json-to-index-struct.js";
export * from "./keyword/index.js";
export * from "./summary/index.js";
export * from "./vectorStore/index.js";
@@ -24,9 +24,15 @@ export class IndexDict extends IndexStruct {
}
toJson(): Record<string, unknown> {
const nodesDict: Record<string, unknown> = {};
for (const [key, node] of Object.entries(this.nodesDict)) {
nodesDict[key] = node.toJSON();
}
return {
...super.toJson(),
nodesDict: this.nodesDict,
nodesDict,
type: this.type,
};
}
+82 -48
View File
@@ -1,7 +1,6 @@
import type OpenAILLM from "openai";
import type { ClientOptions as OpenAIClientOptions } from "openai";
import type {
AnthropicStreamToken,
CallbackManager,
Event,
EventType,
@@ -13,11 +12,7 @@ import type { ChatCompletionMessageParam } from "openai/resources/index.js";
import type { LLMOptions } from "portkey-ai";
import { Tokenizers, globalsHelper } from "../GlobalsHelper.js";
import type { AnthropicSession } from "./anthropic.js";
import {
ANTHROPIC_AI_PROMPT,
ANTHROPIC_HUMAN_PROMPT,
getAnthropicSession,
} from "./anthropic.js";
import { getAnthropicSession } from "./anthropic.js";
import type { AzureOpenAIConfig } from "./azure.js";
import {
getAzureBaseUrl,
@@ -260,7 +255,7 @@ export class OpenAI extends BaseLLM {
stream: false,
});
const content = response.choices[0].message?.content ?? "";
const content = response.choices[0].message?.content ?? null;
const kwargsOutput: Record<string, any> = {};
@@ -613,12 +608,30 @@ If a question does not make any sense, or is not factually coherent, explain why
}
}
export const ALL_AVAILABLE_ANTHROPIC_MODELS = {
// both models have 100k context window, see https://docs.anthropic.com/claude/reference/selecting-a-model
"claude-2": { contextWindow: 200000 },
"claude-instant-1": { contextWindow: 100000 },
export const ALL_AVAILABLE_ANTHROPIC_LEGACY_MODELS = {
"claude-2.1": {
contextWindow: 200000,
},
"claude-instant-1.2": {
contextWindow: 100000,
},
};
export const ALL_AVAILABLE_V3_MODELS = {
"claude-3-opus": { contextWindow: 200000 },
"claude-3-sonnet": { contextWindow: 200000 },
};
export const ALL_AVAILABLE_ANTHROPIC_MODELS = {
...ALL_AVAILABLE_ANTHROPIC_LEGACY_MODELS,
...ALL_AVAILABLE_V3_MODELS,
};
const AVAILABLE_ANTHROPIC_MODELS_WITHOUT_DATE: { [key: string]: string } = {
"claude-3-opus": "claude-3-opus-20240229",
"claude-3-sonnet": "claude-3-sonnet-20240229",
} as { [key in keyof typeof ALL_AVAILABLE_ANTHROPIC_MODELS]: string };
/**
* Anthropic LLM implementation
*/
@@ -640,7 +653,7 @@ export class Anthropic extends BaseLLM {
constructor(init?: Partial<Anthropic>) {
super();
this.model = init?.model ?? "claude-2";
this.model = init?.model ?? "claude-3-opus";
this.temperature = init?.temperature ?? 0.1;
this.topP = init?.topP ?? 0.999; // Per Ben Mann
this.maxTokens = init?.maxTokens ?? undefined;
@@ -674,21 +687,24 @@ export class Anthropic extends BaseLLM {
};
}
mapMessagesToPrompt(messages: ChatMessage[]) {
return (
messages.reduce((acc, message) => {
return (
acc +
`${
message.role === "system"
? ""
: message.role === "assistant"
? ANTHROPIC_AI_PROMPT + " "
: ANTHROPIC_HUMAN_PROMPT + " "
}${message.content.trim()}`
);
}, "") + ANTHROPIC_AI_PROMPT
);
getModelName = (model: string): string => {
if (Object.keys(AVAILABLE_ANTHROPIC_MODELS_WITHOUT_DATE).includes(model)) {
return AVAILABLE_ANTHROPIC_MODELS_WITHOUT_DATE[model];
}
return model;
};
formatMessages(messages: ChatMessage[]) {
return messages.map((message) => {
if (message.role !== "user" && message.role !== "assistant") {
throw new Error("Unsupported Anthropic role");
}
return {
content: message.content,
role: message.role,
};
});
}
chat(
@@ -698,49 +714,67 @@ export class Anthropic extends BaseLLM {
async chat(
params: LLMChatParamsNonStreaming | LLMChatParamsStreaming,
): Promise<ChatResponse | AsyncIterable<ChatResponseChunk>> {
const { messages, parentEvent, stream } = params;
let { messages } = params;
const { parentEvent, stream } = params;
let systemPrompt: string | null = null;
const systemMessages = messages.filter(
(message) => message.role === "system",
);
if (systemMessages.length > 0) {
systemPrompt = systemMessages
.map((message) => message.content)
.join("\n");
messages = messages.filter((message) => message.role !== "system");
}
//Streaming
if (stream) {
return this.streamChat(messages, parentEvent);
return this.streamChat(messages, parentEvent, systemPrompt);
}
//Non-streaming
const response = await this.session.anthropic.completions.create({
model: this.model,
prompt: this.mapMessagesToPrompt(messages),
max_tokens_to_sample: this.maxTokens ?? 100000,
const response = await this.session.anthropic.messages.create({
model: this.getModelName(this.model),
messages: this.formatMessages(messages),
max_tokens: this.maxTokens ?? 4096,
temperature: this.temperature,
top_p: this.topP,
...(systemPrompt && { system: systemPrompt }),
});
return {
message: { content: response.completion.trimStart(), role: "assistant" },
//^ We're trimming the start because Anthropic often starts with a space in the response
// That space will be re-added when we generate the next prompt.
message: { content: response.content[0].text, role: "assistant" },
};
}
protected async *streamChat(
messages: ChatMessage[],
parentEvent?: Event | undefined,
systemPrompt?: string | null,
): AsyncIterable<ChatResponseChunk> {
// AsyncIterable<AnthropicStreamToken>
const stream: AsyncIterable<AnthropicStreamToken> =
await this.session.anthropic.completions.create({
model: this.model,
prompt: this.mapMessagesToPrompt(messages),
max_tokens_to_sample: this.maxTokens ?? 100000,
temperature: this.temperature,
top_p: this.topP,
stream: true,
});
const stream = await this.session.anthropic.messages.create({
model: this.getModelName(this.model),
messages: this.formatMessages(messages),
max_tokens: this.maxTokens ?? 4096,
temperature: this.temperature,
top_p: this.topP,
stream: true,
...(systemPrompt && { system: systemPrompt }),
});
let idx_counter: number = 0;
for await (const part of stream) {
//TODO: LLM Stream Callback, pending re-work.
const content =
part.type === "content_block_delta" ? part.delta.text : null;
if (typeof content !== "string") continue;
idx_counter++;
yield { delta: part.completion };
yield { delta: content };
}
return;
}
+2 -3
View File
@@ -1,5 +1,6 @@
import type { ClientOptions } from "@anthropic-ai/sdk";
import Anthropic, { AI_PROMPT, HUMAN_PROMPT } from "@anthropic-ai/sdk";
import { getEnv } from "@llamaindex/env";
import _ from "lodash";
export class AnthropicSession {
@@ -7,9 +8,7 @@ export class AnthropicSession {
constructor(options: ClientOptions = {}) {
if (!options.apiKey) {
if (typeof process !== undefined) {
options.apiKey = process.env.ANTHROPIC_API_KEY;
}
options.apiKey = getEnv("ANTHROPIC_API_KEY");
}
if (!options.apiKey) {
+16 -14
View File
@@ -1,3 +1,5 @@
import { getEnv } from "@llamaindex/env";
export interface AzureOpenAIConfig {
apiKey?: string;
endpoint?: string;
@@ -67,24 +69,24 @@ export function getAzureConfigFromEnv(
return {
apiKey:
init?.apiKey ??
process.env.AZURE_OPENAI_KEY ?? // From Azure docs
process.env.OPENAI_API_KEY ?? // Python compatible
process.env.AZURE_OPENAI_API_KEY, // LCJS compatible
getEnv("AZURE_OPENAI_KEY") ?? // From Azure docs
getEnv("OPENAI_API_KEY") ?? // Python compatible
getEnv("AZURE_OPENAI_API_KEY"), // LCJS compatible
endpoint:
init?.endpoint ??
process.env.AZURE_OPENAI_ENDPOINT ?? // From Azure docs
process.env.OPENAI_API_BASE ?? // Python compatible
process.env.AZURE_OPENAI_API_INSTANCE_NAME, // LCJS compatible
getEnv("AZURE_OPENAI_ENDPOINT") ?? // From Azure docs
getEnv("OPENAI_API_BASE") ?? // Python compatible
getEnv("AZURE_OPENAI_API_INSTANCE_NAME"), // LCJS compatible
apiVersion:
init?.apiVersion ??
process.env.AZURE_OPENAI_API_VERSION ?? // From Azure docs
process.env.OPENAI_API_VERSION ?? // Python compatible
process.env.AZURE_OPENAI_API_VERSION ?? // LCJS compatible
getEnv("AZURE_OPENAI_API_VERSION") ?? // From Azure docs
getEnv("OPENAI_API_VERSION") ?? // Python compatible
getEnv("AZURE_OPENAI_API_VERSION") ?? // LCJS compatible
DEFAULT_API_VERSION,
deploymentName:
init?.deploymentName ??
process.env.AZURE_OPENAI_DEPLOYMENT ?? // From Azure docs
process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME ?? // LCJS compatible
getEnv("AZURE_OPENAI_DEPLOYMENT") ?? // From Azure docs
getEnv("AZURE_OPENAI_API_DEPLOYMENT_NAME") ?? // LCJS compatible
init?.model, // Fall back to model name, Python compatible
};
}
@@ -113,8 +115,8 @@ export function getAzureModel(openAIModel: string) {
export function shouldUseAzure() {
return (
process.env.AZURE_OPENAI_ENDPOINT ||
process.env.AZURE_OPENAI_API_INSTANCE_NAME ||
process.env.OPENAI_API_TYPE === "azure"
getEnv("AZURE_OPENAI_ENDPOINT") ||
getEnv("AZURE_OPENAI_API_INSTANCE_NAME") ||
getEnv("OPENAI_API_TYPE") === "azure"
);
}
+2 -1
View File
@@ -1,9 +1,10 @@
import { getEnv } from "@llamaindex/env";
import { OpenAI } from "./LLM.js";
export class FireworksLLM extends OpenAI {
constructor(init?: Partial<OpenAI>) {
const {
apiKey = process.env.FIREWORKS_API_KEY,
apiKey = getEnv("FIREWORKS_API_KEY"),
additionalSessionOptions = {},
model = "accounts/fireworks/models/mixtral-8x7b-instruct",
...rest
+2 -1
View File
@@ -1,9 +1,10 @@
import { getEnv } from "@llamaindex/env";
import { OpenAI } from "./LLM.js";
export class Groq extends OpenAI {
constructor(init?: Partial<OpenAI>) {
const {
apiKey = process.env.GROQ_API_KEY,
apiKey = getEnv("GROQ_API_KEY"),
additionalSessionOptions = {},
model = "mixtral-8x7b-32768",
...rest
+2 -3
View File
@@ -1,3 +1,4 @@
import { getEnv } from "@llamaindex/env";
import type {
CallbackManager,
Event,
@@ -27,9 +28,7 @@ export class MistralAISession {
if (init?.apiKey) {
this.apiKey = init?.apiKey;
} else {
if (typeof process !== undefined) {
this.apiKey = process.env.MISTRAL_API_KEY;
}
this.apiKey = getEnv("MISTRAL_API_KEY");
}
if (!this.apiKey) {
throw new Error("Set Mistral API key in MISTRAL_API_KEY env variable"); // Overriding MistralAI package's error message
+2 -3
View File
@@ -1,3 +1,4 @@
import { getEnv } from "@llamaindex/env";
import _ from "lodash";
import type { ClientOptions } from "openai";
import OpenAI from "openai";
@@ -13,9 +14,7 @@ export class OpenAISession {
constructor(options: ClientOptions & { azure?: boolean } = {}) {
if (!options.apiKey) {
if (typeof process !== undefined) {
options.apiKey = process.env.OPENAI_API_KEY;
}
options.apiKey = getEnv("OPENAI_API_KEY");
}
if (!options.apiKey) {
+3 -12
View File
@@ -1,17 +1,8 @@
import { getEnv } from "@llamaindex/env";
import _ from "lodash";
import type { LLMOptions } from "portkey-ai";
import { Portkey } from "portkey-ai";
export const readEnv = (
env: string,
default_val?: string,
): string | undefined => {
if (typeof process !== "undefined") {
return process.env?.[env] ?? default_val;
}
return default_val;
};
interface PortkeyOptions {
apiKey?: string;
baseURL?: string;
@@ -24,11 +15,11 @@ export class PortkeySession {
constructor(options: PortkeyOptions = {}) {
if (!options.apiKey) {
options.apiKey = readEnv("PORTKEY_API_KEY");
options.apiKey = getEnv("PORTKEY_API_KEY");
}
if (!options.baseURL) {
options.baseURL = readEnv("PORTKEY_BASE_URL", "https://api.portkey.ai");
options.baseURL = getEnv("PORTKEY_BASE_URL") ?? "https://api.portkey.ai";
}
this.portkey = new Portkey({});
+3 -2
View File
@@ -1,3 +1,4 @@
import { getEnv } from "@llamaindex/env";
import Replicate from "replicate";
export class ReplicateSession {
@@ -7,8 +8,8 @@ export class ReplicateSession {
constructor(replicateKey: string | null = null) {
if (replicateKey) {
this.replicateKey = replicateKey;
} else if (process.env.REPLICATE_API_TOKEN) {
this.replicateKey = process.env.REPLICATE_API_TOKEN;
} else if (getEnv("REPLICATE_API_TOKEN")) {
this.replicateKey = getEnv("REPLICATE_API_TOKEN") as string;
} else {
throw new Error(
"Set Replicate token in REPLICATE_API_TOKEN env variable",
+2 -1
View File
@@ -1,9 +1,10 @@
import { getEnv } from "@llamaindex/env";
import { OpenAI } from "./LLM.js";
export class TogetherLLM extends OpenAI {
constructor(init?: Partial<OpenAI>) {
const {
apiKey = process.env.TOGETHER_API_KEY,
apiKey = getEnv("TOGETHER_API_KEY"),
additionalSessionOptions = {},
model = "togethercomputer/llama-2-7b-chat",
...rest
@@ -1,3 +1,4 @@
import { getEnv } from "@llamaindex/env";
import type {
BaseServiceParams,
SubtitleFormat,
@@ -28,7 +29,7 @@ abstract class AssemblyAIReader implements BaseReader {
options = {};
}
if (!options.apiKey) {
options.apiKey = process.env.ASSEMBLYAI_API_KEY;
options.apiKey = getEnv("ASSEMBLYAI_API_KEY");
}
if (!options.apiKey) {
throw new Error(
@@ -1,5 +1,4 @@
import type { GenericFileSystem } from "@llamaindex/env";
import { defaultFS } from "@llamaindex/env";
import { defaultFS, getEnv, type GenericFileSystem } from "@llamaindex/env";
import { Document } from "../Node.js";
import type { FileReader } from "./type.js";
@@ -24,7 +23,7 @@ export class LlamaParseReader implements FileReader {
constructor(params: Partial<LlamaParseReader> = {}) {
Object.assign(this, params);
params.apiKey = params.apiKey ?? process.env.LLAMA_CLOUD_API_KEY;
params.apiKey = params.apiKey ?? getEnv("LLAMA_CLOUD_API_KEY");
if (!params.apiKey) {
throw new Error(
"API Key is required for LlamaParseReader. Please pass the apiKey parameter or set the LLAMA_CLOUD_API_KEY environment variable.",
@@ -1,4 +1,4 @@
import _, * as lodash from "lodash";
import _ from "lodash";
import type { BaseNode } from "../../Node.js";
import { ObjectType } from "../../Node.js";
import { DEFAULT_NAMESPACE } from "../constants.js";
@@ -123,10 +123,10 @@ export class KVDocumentStore extends BaseDocumentStore {
const refDocInfo = await this.kvstore.get(refDocId, this.refDocCollection);
if (!_.isNil(refDocInfo)) {
lodash.pull(refDocInfo.docIds, docId);
!_.pull(refDocInfo.nodeIds, docId);
if (refDocInfo.docIds.length > 0) {
this.kvstore.put(refDocId, refDocInfo.toDict(), this.refDocCollection);
if (refDocInfo.nodeIds.length > 0) {
this.kvstore.put(refDocId, refDocInfo, this.refDocCollection);
}
this.kvstore.delete(refDocId, this.metadataCollection);
}
@@ -54,6 +54,9 @@ export class SimpleKVStore extends BaseKVStore {
): Promise<boolean> {
if (key in this.data[collection]) {
delete this.data[collection][key];
if (this.persistPath) {
await this.persist(this.persistPath, this.fs);
}
return true;
}
return false;
@@ -1,5 +1,6 @@
import { AstraDB } from "@datastax/astra-db-ts";
import type { Collection } from "@datastax/astra-db-ts/dist/collections";
import { getEnv } from "@llamaindex/env";
import type { BaseNode } from "../../Node.js";
import { MetadataMode } from "../../Node.js";
import type {
@@ -34,9 +35,8 @@ export class AstraDBVectorStore implements VectorStore {
if (init?.astraDBClient) {
this.astraDBClient = init.astraDBClient;
} else {
const token =
init?.params?.token ?? process.env.ASTRA_DB_APPLICATION_TOKEN;
const endpoint = init?.params?.endpoint ?? process.env.ASTRA_DB_ENDPOINT;
const token = init?.params?.token ?? getEnv("ASTRA_DB_APPLICATION_TOKEN");
const endpoint = init?.params?.endpoint ?? getEnv("ASTRA_DB_ENDPOINT");
if (!token) {
throw new Error(
@@ -48,7 +48,7 @@ export class AstraDBVectorStore implements VectorStore {
}
const namespace =
init?.params?.namespace ??
process.env.ASTRA_DB_NAMESPACE ??
getEnv("ASTRA_DB_NAMESPACE") ??
"default_keyspace";
this.astraDBClient = new AstraDB(token, endpoint, namespace);
}
@@ -1,3 +1,4 @@
import { getEnv } from "@llamaindex/env";
import type { BulkWriteOptions, Collection } from "mongodb";
import { MongoClient } from "mongodb";
import type { BaseNode } from "../../Node.js";
@@ -44,7 +45,7 @@ export class MongoDBAtlasVectorSearch implements VectorStore {
if (init.mongodbClient) {
this.mongodbClient = init.mongodbClient;
} else {
const mongoUri = process.env.MONGODB_URI;
const mongoUri = getEnv("MONGODB_URI");
if (!mongoUri) {
throw new Error(
"Must specify MONGODB_URI via env variable if not directly passing in client.",
@@ -6,7 +6,7 @@ import type {
VectorStoreQueryResult,
} from "./types.js";
import type { GenericFileSystem } from "@llamaindex/env";
import { getEnv, type GenericFileSystem } from "@llamaindex/env";
import type {
FetchResponse,
Index,
@@ -45,11 +45,11 @@ export class PineconeVectorStore implements VectorStore {
constructor(params?: PineconeParams) {
this.indexName =
params?.indexName ?? process.env.PINECONE_INDEX_NAME ?? "llama";
this.namespace = params?.namespace ?? process.env.PINECONE_NAMESPACE ?? "";
params?.indexName ?? getEnv("PINECONE_INDEX_NAME") ?? "llama";
this.namespace = params?.namespace ?? getEnv("PINECONE_NAMESPACE") ?? "";
this.chunkSize =
params?.chunkSize ??
Number.parseInt(process.env.PINECONE_CHUNK_SIZE ?? "100");
Number.parseInt(getEnv("PINECONE_CHUNK_SIZE") ?? "100");
this.textKey = params?.textKey ?? "text";
}
@@ -82,6 +82,9 @@ export class SimpleVectorStore implements VectorStore {
delete this.data.embeddingDict[textId];
delete this.data.textIdToRefDocId[textId];
}
if (this.persistPath) {
await this.persist(this.persistPath, this.fs);
}
return Promise.resolve();
}
@@ -0,0 +1,71 @@
import {
IndexDict,
IndexList,
IndexStruct,
IndexStructType,
MetadataMode,
TextNode,
jsonToIndexStruct,
} from "llamaindex";
import { describe, expect, it } from "vitest";
describe("jsonToIndexStruct", () => {
it("transforms json to IndexDict", () => {
function isIndexDict(some: IndexStruct): some is IndexDict {
return "type" in some && some.type === IndexStructType.SIMPLE_DICT;
}
const node = new TextNode({ text: "text", id_: "nodeId" });
const expected = new IndexDict();
expected.addNode(node);
console.log("expected.toJson()", expected.toJson());
const actual = jsonToIndexStruct(expected.toJson());
expect(isIndexDict(actual)).toBe(true);
expect(
(actual as IndexDict).nodesDict.nodeId.getContent(MetadataMode.NONE),
).toEqual("text");
});
it("transforms json to IndexList", () => {
function isIndexList(some: IndexStruct): some is IndexList {
return "type" in some && some.type === IndexStructType.LIST;
}
const node = new TextNode({ text: "text", id_: "nodeId" });
const expected = new IndexList();
expected.addNode(node);
const actual = jsonToIndexStruct(expected.toJson());
expect(isIndexList(actual)).toBe(true);
expect((actual as IndexList).nodes[0]).toEqual("nodeId");
});
it("fails for unknown index type", () => {
expect(() => {
const json = {
indexId: "dd120b16-8dce-4ce3-9bb6-15ca87fe4a1d",
summary: undefined,
nodesDict: {},
type: "FOO",
};
return jsonToIndexStruct(json);
}).toThrowError("Unknown index struct type: FOO");
});
it("fails for unknown node type", () => {
expect(() => {
const json = {
indexId: "dd120b16-8dce-4ce3-9bb6-15ca87fe4a1d",
summary: undefined,
nodesDict: {
nodeId: {
...new TextNode({ text: "text", id_: "nodeId" }).toJSON(),
type: "BAR",
},
},
type: IndexStructType.SIMPLE_DICT,
};
return jsonToIndexStruct(json);
}).toThrowError("Invalid node type: BAR");
});
});
+9 -1
View File
@@ -6,5 +6,13 @@
"moduleResolution": "node16",
"target": "ESNext"
},
"include": ["./**/*.ts"]
"include": ["./**/*.ts"],
"references": [
{
"path": "../../core/tsconfig.json"
},
{
"path": "../../env/tsconfig.json"
}
]
}
+7 -1
View File
@@ -3,6 +3,7 @@
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist/type",
"tsBuildInfoFile": "./dist/.tsbuildinfo",
"emitDeclarationOnly": true,
"module": "node16",
"moduleResolution": "node16",
@@ -10,5 +11,10 @@
"strict": true
},
"include": ["./src"],
"exclude": ["node_modules"]
"exclude": ["node_modules"],
"references": [
{
"path": "../env/tsconfig.json"
}
]
}
+20
View File
@@ -0,0 +1,20 @@
{
"root": false,
"rules": {
"turbo/no-undeclared-env-vars": [
"error",
{
"allowList": [
"OPENAI_API_KEY",
"LLAMA_CLOUD_API_KEY",
"npm_config_user_agent",
"http_proxy",
"https_proxy",
"MODEL",
"NEXT_PUBLIC_CHAT_API",
"NEXT_PUBLIC_MODEL"
]
}
]
}
}
+7
View File
@@ -1,5 +1,12 @@
# create-llama
## 0.0.27
### Patch Changes
- 2d29350: Add LlamaParse option when selecting a pdf file or a folder (FastAPI only)
- b354f23: Add embedding model option to create-llama (FastAPI only)
## 0.0.26
### Patch Changes
+4
View File
@@ -32,7 +32,9 @@ export async function createApp({
eslint,
frontend,
openAiKey,
llamaCloudKey,
model,
embeddingModel,
communityProjectPath,
llamapack,
vectorDb,
@@ -77,7 +79,9 @@ export async function createApp({
isOnline,
eslint,
openAiKey,
llamaCloudKey,
model,
embeddingModel,
communityProjectPath,
llamapack,
vectorDb,
+13 -11
View File
@@ -91,17 +91,19 @@ for (const templateType of templateTypes) {
test.skip(appType === "--no-frontend");
await page.goto(`http://localhost:${port}`);
await page.fill("form input", "hello");
await page.click("form button[type=submit]");
const response = await page.waitForResponse(
(res) => {
return (
res.url().includes("/api/chat") && res.status() === 200
);
},
{
timeout: 1000 * 60,
},
);
const [response] = await Promise.all([
page.waitForResponse(
(res) => {
return (
res.url().includes("/api/chat") && res.status() === 200
);
},
{
timeout: 1000 * 60,
},
),
page.click("form button[type=submit]"),
]);
const text = await response.text();
console.log("AI response when submitting message: ", text);
expect(response.ok()).toBeTruthy();
+4
View File
@@ -14,6 +14,7 @@ import {
export type AppType = "--frontend" | "--no-frontend" | "";
const MODEL = "gpt-3.5-turbo";
const EMBEDDING_MODEL = "text-embedding-ada-002";
export type CreateLlamaResult = {
projectName: string;
appProcess: ChildProcess;
@@ -106,6 +107,8 @@ export async function runCreateLlama(
vectorDb,
"--model",
MODEL,
"--embedding-model",
EMBEDDING_MODEL,
"--open-ai-key",
process.env.OPENAI_API_KEY || "testKey",
appType,
@@ -119,6 +122,7 @@ export async function runCreateLlama(
postInstallAction,
"--tools",
"none",
"--no-llama-parse",
].join(" ");
console.log(`running command '${command}' in ${cwd}`);
const appProcess = exec(command, {
+40 -7
View File
@@ -26,8 +26,10 @@ const createEnvLocalFile = async (
root: string,
opts?: {
openAiKey?: string;
llamaCloudKey?: string;
vectorDb?: TemplateVectorDB;
model?: string;
embeddingModel?: string;
framework?: TemplateFramework;
dataSource?: TemplateDataSource;
},
@@ -46,6 +48,20 @@ const createEnvLocalFile = async (
content += `OPENAI_API_KEY=${opts?.openAiKey}\n`;
}
if (opts?.embeddingModel) {
content += `EMBEDDING_MODEL=${opts?.embeddingModel}\n`;
}
if ((opts?.dataSource?.config as FileSourceConfig).useLlamaParse) {
if (opts?.llamaCloudKey) {
content += `LLAMA_CLOUD_API_KEY=${opts?.llamaCloudKey}\n`;
} else {
content += `# Please obtain the Llama Cloud API key from https://cloud.llamaindex.ai/api-key
# and set it to the LLAMA_CLOUD_API_KEY variable below.
# LLAMA_CLOUD_API_KEY=`;
}
}
switch (opts?.vectorDb) {
case "mongo": {
content += `# For generating a connection URI, see https://www.mongodb.com/docs/guides/atlas/connection-string\n`;
@@ -85,22 +101,34 @@ const createEnvLocalFile = async (
}
};
const generateContextData = async (
// eslint-disable-next-line max-params
async function generateContextData(
framework: TemplateFramework,
packageManager?: PackageManager,
openAiKey?: string,
vectorDb?: TemplateVectorDB,
) => {
dataSource?: TemplateDataSource,
llamaCloudKey?: string,
) {
if (packageManager) {
const runGenerate = `${cyan(
framework === "fastapi"
? "poetry run python app/engine/generate.py"
: `${packageManager} run generate`,
)}`;
const hasOpenAiKey = openAiKey || process.env["OPENAI_API_KEY"];
const openAiKeyConfigured = openAiKey || process.env["OPENAI_API_KEY"];
const llamaCloudKeyConfigured = (dataSource?.config as FileSourceConfig)
?.useLlamaParse
? llamaCloudKey || process.env["LLAMA_CLOUD_API_KEY"]
: true;
const hasVectorDb = vectorDb && vectorDb !== "none";
if (framework === "fastapi") {
if (hasOpenAiKey && !hasVectorDb && isHavingPoetryLockFile()) {
if (
openAiKeyConfigured &&
llamaCloudKeyConfigured &&
!hasVectorDb &&
isHavingPoetryLockFile()
) {
console.log(`Running ${runGenerate} to generate the context data.`);
const result = tryPoetryRun("python app/engine/generate.py");
if (!result) {
@@ -111,7 +139,7 @@ const generateContextData = async (
return;
}
} else {
if (hasOpenAiKey && vectorDb === "none") {
if (openAiKeyConfigured && vectorDb === "none") {
console.log(`Running ${runGenerate} to generate the context data.`);
await callPackageManager(packageManager, true, ["run", "generate"]);
return;
@@ -119,14 +147,15 @@ const generateContextData = async (
}
const settings = [];
if (!hasOpenAiKey) settings.push("your OpenAI key");
if (!openAiKeyConfigured) settings.push("your OpenAI key");
if (!llamaCloudKeyConfigured) settings.push("your Llama Cloud key");
if (hasVectorDb) settings.push("your Vector DB environment variables");
const settingsMessage =
settings.length > 0 ? `After setting ${settings.join(" and ")}, ` : "";
const generateMessage = `run ${runGenerate} to generate the context data.`;
console.log(`\n${settingsMessage}${generateMessage}\n\n`);
}
};
}
const copyContextData = async (
root: string,
@@ -205,8 +234,10 @@ export const installTemplate = async (
// Copy the environment file to the target directory.
await createEnvLocalFile(props.root, {
openAiKey: props.openAiKey,
llamaCloudKey: props.llamaCloudKey,
vectorDb: props.vectorDb,
model: props.model,
embeddingModel: props.embeddingModel,
framework: props.framework,
dataSource: props.dataSource,
});
@@ -222,6 +253,8 @@ export const installTemplate = async (
props.packageManager,
props.openAiKey,
props.vectorDb,
props.dataSource,
props.llamaCloudKey,
);
}
}
+9 -5
View File
@@ -8,6 +8,7 @@ import { templatesDir } from "./dir";
import { isPoetryAvailable, tryPoetryInstall } from "./poetry";
import { Tool } from "./tools";
import {
FileSourceConfig,
InstallTemplateArgs,
TemplateDataSource,
TemplateVectorDB,
@@ -244,13 +245,16 @@ export const installPythonTemplate = async ({
const dataSourceType = dataSource?.type;
if (dataSourceType !== undefined && dataSourceType !== "none") {
const loaderPath =
dataSourceType === "folder"
? path.join(compPath, "loaders", "python", "file")
: path.join(compPath, "loaders", "python", dataSourceType);
let loaderFolder: string;
if (dataSourceType === "file" || dataSourceType === "folder") {
const dataSourceConfig = dataSource?.config as FileSourceConfig;
loaderFolder = dataSourceConfig.useLlamaParse ? "llama_parse" : "file";
} else {
loaderFolder = dataSourceType;
}
await copy("**", enginePath, {
parents: true,
cwd: loaderPath,
cwd: path.join(compPath, "loaders", "python", loaderFolder),
});
}
}
+3
View File
@@ -15,6 +15,7 @@ export type TemplateDataSourceType = "none" | "file" | "folder" | "web";
// Config for both file and folder
export type FileSourceConfig = {
path?: string;
useLlamaParse?: boolean;
};
export type WebSourceConfig = {
baseUrl?: string;
@@ -35,8 +36,10 @@ export interface InstallTemplateArgs {
eslint: boolean;
customApiPath?: string;
openAiKey?: string;
llamaCloudKey?: string;
forBackend?: string;
model: string;
embeddingModel: string;
communityProjectPath?: string;
llamapack?: string;
vectorDb?: TemplateVectorDB;
+23
View File
@@ -119,6 +119,12 @@ const program = new Commander.Command(packageJson.name)
`
Select OpenAI model to use. E.g. gpt-3.5-turbo.
`,
)
.option(
"--embedding-model <embeddingModel>",
`
Select OpenAI embedding model to use. E.g. text-embedding-ada-002.
`,
)
.option(
@@ -154,6 +160,18 @@ const program = new Commander.Command(packageJson.name)
`
Specify the tools you want to use by providing a comma-separated list. For example, 'wikipedia.WikipediaToolSpec,google.GoogleSearchToolSpec'. Use 'none' to not using any tools.
`,
)
.option(
"--llama-parse",
`
Enable LlamaParse.
`,
)
.option(
"--llama-cloud-key <key>",
`
Provide a LlamaCloud API key.
`,
)
.allowUnknownOption()
@@ -171,6 +189,9 @@ if (process.argv.includes("--tools")) {
program.tools = getTools(program.tools.split(","));
}
}
if (process.argv.includes("--no-llama-parse")) {
program.llamaParse = false;
}
const packageManager = !!program.useNpm
? "npm"
@@ -264,7 +285,9 @@ async function run(): Promise<void> {
eslint: program.eslint,
frontend: program.frontend,
openAiKey: program.openAiKey,
llamaCloudKey: program.llamaCloudKey,
model: program.model,
embeddingModel: program.embeddingModel,
communityProjectPath: program.communityProjectPath,
llamapack: program.llamapack,
vectorDb: program.vectorDb,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "create-llama",
"version": "0.0.26",
"version": "0.0.27",
"keywords": [
"rag",
"llamaindex",
+106 -4
View File
@@ -5,7 +5,11 @@ import path from "path";
import { blue, green, red } from "picocolors";
import prompts from "prompts";
import { InstallAppArgs } from "./create-app";
import { TemplateDataSourceType, TemplateFramework } from "./helpers";
import {
FileSourceConfig,
TemplateDataSourceType,
TemplateFramework,
} from "./helpers";
import { COMMUNITY_OWNER, COMMUNITY_REPO } from "./helpers/constant";
import { templatesDir } from "./helpers/dir";
import { getAvailableLlamapackOptions } from "./helpers/llama-pack";
@@ -15,7 +19,7 @@ import { supportedTools, toolsRequireConfig } from "./helpers/tools";
export type QuestionArgs = Omit<
InstallAppArgs,
"appPath" | "packageManager"
> & { files?: string };
> & { files?: string; llamaParse?: boolean };
const supportedContextFileTypes = [
".pdf",
".doc",
@@ -63,7 +67,9 @@ const defaults: QuestionArgs = {
eslint: true,
frontend: false,
openAiKey: "",
llamaCloudKey: "",
model: "gpt-3.5-turbo",
embeddingModel: "text-embedding-ada-002",
communityProjectPath: "",
llamapack: "",
postInstallAction: "dependencies",
@@ -215,12 +221,20 @@ export const askQuestions = async (
},
];
const hasOpenAiKey = program.openAiKey || process.env["OPENAI_API_KEY"];
const openAiKeyConfigured =
program.openAiKey || process.env["OPENAI_API_KEY"];
// If using LlamaParse, require LlamaCloud API key
const llamaCloudKeyConfigured = (
program.dataSource?.config as FileSourceConfig
)?.useLlamaParse
? program.llamaCloudKey || process.env["LLAMA_CLOUD_API_KEY"]
: true;
const hasVectorDb = program.vectorDb && program.vectorDb !== "none";
// Can run the app if all tools do not require configuration
if (
!hasVectorDb &&
hasOpenAiKey &&
openAiKeyConfigured &&
llamaCloudKeyConfigured &&
!toolsRequireConfig(program.tools) &&
!program.llamapack
) {
@@ -438,6 +452,38 @@ export const askQuestions = async (
}
}
if (!program.embeddingModel && program.framework === "fastapi") {
if (ciInfo.isCI) {
program.embeddingModel = getPrefOrDefault("embeddingModel");
} else {
const { embeddingModel } = await prompts(
{
type: "select",
name: "embeddingModel",
message: "Which embedding model would you like to use?",
choices: [
{
title: "text-embedding-ada-002",
value: "text-embedding-ada-002",
},
{
title: "text-embedding-3-small",
value: "text-embedding-3-small",
},
{
title: "text-embedding-3-large",
value: "text-embedding-3-large",
},
],
initial: 0,
},
handlers,
);
program.embeddingModel = embeddingModel;
preferences.embeddingModel = embeddingModel;
}
}
if (program.files) {
// If user specified files option, then the program should use context engine
program.engine == "context";
@@ -521,6 +567,62 @@ export const askQuestions = async (
}
}
if (
(program.dataSource?.type === "file" ||
program.dataSource?.type === "folder") &&
program.framework === "fastapi"
) {
if (ciInfo.isCI) {
program.llamaCloudKey = getPrefOrDefault("llamaCloudKey");
} else {
const dataSourceConfig = program.dataSource.config as FileSourceConfig;
dataSourceConfig.useLlamaParse = program.llamaParse;
// Is pdf file selected as data source or is it a folder data source
const askingLlamaParse =
dataSourceConfig.useLlamaParse === undefined &&
(program.dataSource.type === "folder"
? true
: dataSourceConfig.path &&
path.extname(dataSourceConfig.path) === ".pdf");
// Ask if user wants to use LlamaParse
if (askingLlamaParse) {
const { useLlamaParse } = await prompts(
{
type: "toggle",
name: "useLlamaParse",
message:
"Would you like to use LlamaParse (improved parser for RAG - requires API key)?",
initial: true,
active: "yes",
inactive: "no",
},
handlers,
);
dataSourceConfig.useLlamaParse = useLlamaParse;
program.dataSource.config = dataSourceConfig;
}
// Ask for LlamaCloud API key
if (
dataSourceConfig.useLlamaParse &&
program.llamaCloudKey === undefined
) {
const { llamaCloudKey } = await prompts(
{
type: "text",
name: "llamaCloudKey",
message:
"Please provide your LlamaIndex Cloud API key (leave blank to skip):",
},
handlers,
);
program.llamaCloudKey = llamaCloudKey;
}
}
}
if (program.dataSource?.type === "web" && program.framework === "fastapi") {
let { baseUrl } = await prompts(
{
@@ -1,6 +1,6 @@
from llama_index.core.readers import SimpleDirectoryReader
DATA_DIR = "data" # directory to cache the generated index
DATA_DIR = "data" # directory containing the documents
def get_documents():
@@ -0,0 +1,11 @@
from llama_parse import LlamaParse
from llama_index.core import SimpleDirectoryReader
DATA_DIR = "data" # directory containing the documents
def get_documents():
parser = LlamaParse(result_type="markdown", verbose=True, language="en")
reader = SimpleDirectoryReader(DATA_DIR, file_extractor={".pdf": parser})
return reader.load_data()
@@ -1,10 +1,14 @@
import os
from llama_index.llms.openai import OpenAI
from llama_index.embeddings.openai import OpenAIEmbedding
from llama_index.core.settings import Settings
def init_settings():
model = os.getenv("MODEL", "gpt-3.5-turbo")
Settings.llm = OpenAI(model=model)
llm_model = os.getenv("MODEL", "gpt-3.5-turbo")
embedding_model = os.getenv("EMBEDDING_MODEL", "text-embedding-ada-002")
Settings.llm = OpenAI(model=llm_model)
Settings.embed_model = OpenAIEmbedding(model=embedding_model)
Settings.chunk_size = 1024
Settings.chunk_overlap = 20
@@ -1,10 +1,14 @@
import os
from llama_index.llms.openai import OpenAI
from llama_index.embeddings.openai import OpenAIEmbedding
from llama_index.core.settings import Settings
def init_settings():
model = os.getenv("MODEL", "gpt-3.5-turbo")
Settings.llm = OpenAI(model=model)
llm_model = os.getenv("MODEL", "gpt-3.5-turbo")
embedding_model = os.getenv("EMBEDDING_MODEL", "text-embedding-ada-002")
Settings.llm = OpenAI(model=llm_model)
Settings.embed_model = OpenAIEmbedding(model=embedding_model)
Settings.chunk_size = 1024
Settings.chunk_overlap = 20
+1
View File
@@ -10,6 +10,7 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"outDir": "./lib",
"tsBuildInfoFile": "./lib/.tsbuildinfo"
},
"include": [
+6
View File
@@ -1,5 +1,11 @@
# @llamaindex/env
## 0.0.5
### Patch Changes
- 5116ad8: fix: compatibility issue with Deno
## 0.0.4
### Patch Changes
+8
View File
@@ -0,0 +1,8 @@
{
"name": "@llamaindex/env",
"version": "0.0.5",
"exports": {
".": "./src/index.ts",
"./type": "./src/type.ts"
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/env",
"description": "environment wrapper",
"version": "0.0.4",
"version": "0.0.5",
"type": "module",
"types": "dist/type/index.d.ts",
"main": "dist/cjs/index.js",
+1
View File
@@ -39,3 +39,4 @@ export function randomUUID(): string {
return crypto.randomUUID();
}
export * from "./type.js";
export { getEnv } from "./utils.js";
+2 -1
View File
@@ -34,5 +34,6 @@ export const defaultFS: CompleteFileSystem = {
stat: fs.stat,
};
export * from "./type.js";
export type * from "./type.js";
export { getEnv } from "./utils.js";
export { EOL, ok, path, randomUUID };
+1 -2
View File
@@ -58,9 +58,8 @@ export class InMemoryFileSystem implements CompleteFileSystem {
}
}
async mkdir(path: string) {
async mkdir(path: string): Promise<undefined> {
this.files[path] = _.get(this.files, path, null);
return undefined;
}
async readdir(path: string): Promise<string[]> {
+12
View File
@@ -0,0 +1,12 @@
export function getEnv(name: string): string | undefined {
if (typeof process === "undefined" || typeof process.env === "undefined") {
// @ts-expect-error
if (typeof Deno === "undefined") {
throw new Error("Current environment is not supported");
} else {
// @ts-expect-error
return Deno.env.get(name);
}
}
return process.env[name];
}
+1
View File
@@ -3,6 +3,7 @@
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist/type",
"tsBuildInfoFile": "./dist/.tsbuildinfo",
"emitDeclarationOnly": true,
"module": "node16",
"moduleResolution": "node16",
+5 -59
View File
@@ -2,65 +2,6 @@ module.exports = {
extends: ["next", "turbo", "prettier"],
rules: {
"@next/next/no-html-link-for-pages": "off",
"turbo/no-undeclared-env-vars": [
"error",
{
allowList: [
"LLAMA_CLOUD_API_KEY",
"LLAMA_CLOUD_BASE_URL",
"OPENAI_API_KEY",
"REPLICATE_API_TOKEN",
"ANTHROPIC_API_KEY",
"ASSEMBLYAI_API_KEY",
"TOGETHER_API_KEY",
"FIREWORKS_API_KEY",
"GROQ_API_KEY",
"ASTRA_DB_APPLICATION_TOKEN",
"ASTRA_DB_ENDPOINT",
"ASTRA_DB_NAMESPACE",
"AZURE_OPENAI_KEY",
"AZURE_OPENAI_ENDPOINT",
"AZURE_OPENAI_API_VERSION",
"AZURE_OPENAI_DEPLOYMENT",
"OPENAI_API_BASE",
"OPENAI_API_VERSION",
"OPENAI_API_TYPE",
"OPENAI_API_ORGANIZATION",
"PINECONE_API_KEY",
"PINECONE_ENVIRONMENT",
"PINECONE_PROJECT_ID",
"PINECONE_INDEX_NAME",
"PINECONE_CHUNK_SIZE",
"PINECONE_INDEX_NAME",
"PINECONE_NAMESPACE",
"AZURE_OPENAI_API_KEY",
"AZURE_OPENAI_API_INSTANCE_NAME",
"AZURE_OPENAI_API_DEPLOYMENT_NAME",
"MISTRAL_API_KEY",
"DEBUG",
"no_proxy",
"NO_PROXY",
"NOTION_TOKEN",
"MONGODB_URI",
"PG_CONNECTION_STRING",
"https_proxy",
"npm_config_user_agent",
"NEXT_PUBLIC_CHAT_API",
"MODEL",
"NEXT_PUBLIC_MODEL",
],
},
],
},
// NOTE I think because we've temporarily removed all of the NextJS stuff
// from the turborepo not having next in the devDeps causes an error on only
@@ -73,4 +14,9 @@ module.exports = {
presets: [require.resolve("next/babel")],
},
},
settings: {
react: {
version: "999.999.999",
},
},
};
+200 -87
View File
@@ -53,7 +53,7 @@ importers:
version: link:../../packages/env
'@mdx-js/react':
specifier: ^3.0.0
version: 3.0.0(@types/react@18.2.55)(react@18.2.0)
version: 3.0.0(@types/react@18.2.61)(react@18.2.0)
clsx:
specifier: ^2.1.0
version: 2.1.0
@@ -65,7 +65,7 @@ importers:
version: 2.3.1(react@18.2.0)
raw-loader:
specifier: ^4.0.2
version: 4.0.2(webpack@5.90.1)
version: 4.0.2(webpack@5.90.3)
react:
specifier: ^18.2.0
version: 18.2.0
@@ -78,10 +78,10 @@ importers:
version: 3.1.0(react-dom@18.2.0)(react@18.2.0)
'@docusaurus/preset-classic':
specifier: ^3.1.1
version: 3.1.1(@algolia/client-search@4.22.1)(@types/react@18.2.55)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.3.3)
version: 3.1.1(@algolia/client-search@4.22.1)(@types/react@18.2.61)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.3.3)
'@docusaurus/theme-classic':
specifier: ^3.1.1
version: 3.1.1(@types/react@18.2.55)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
version: 3.1.1(@types/react@18.2.61)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
'@docusaurus/types':
specifier: ^3.1.1
version: 3.1.1(react-dom@18.2.0)(react@18.2.0)
@@ -160,8 +160,8 @@ importers:
packages/core:
dependencies:
'@anthropic-ai/sdk':
specifier: ^0.13.0
version: 0.13.0
specifier: ^0.15.0
version: 0.15.0
'@aws-crypto/sha256-js':
specifier: ^5.2.0
version: 5.2.0
@@ -169,8 +169,8 @@ importers:
specifier: ^0.1.4
version: 0.1.4
'@llamaindex/cloud':
specifier: ^0.0.1
version: 0.0.1
specifier: 0.0.4
version: 0.0.4
'@llamaindex/env':
specifier: workspace:*
version: link:../env
@@ -406,16 +406,16 @@ importers:
dependencies:
eslint-config-next:
specifier: ^13.5.6
version: 13.5.6(eslint@8.56.0)(typescript@5.3.3)
version: 13.5.6(eslint@8.57.0)(typescript@5.3.3)
eslint-config-prettier:
specifier: ^8.10.0
version: 8.10.0(eslint@8.56.0)
version: 8.10.0(eslint@8.57.0)
eslint-config-turbo:
specifier: ^1.11.3
version: 1.11.3(eslint@8.56.0)
version: 1.11.3(eslint@8.57.0)
eslint-plugin-react:
specifier: 7.28.0
version: 7.28.0(eslint@8.56.0)
version: 7.28.0(eslint@8.57.0)
devDependencies:
next:
specifier: ^13.5.6
@@ -574,8 +574,8 @@ packages:
'@jridgewell/gen-mapping': 0.3.3
'@jridgewell/trace-mapping': 0.3.22
/@anthropic-ai/sdk@0.13.0:
resolution: {integrity: sha512-wn315W4tCfCO+Z6FMa/67HgdgaWbjs4ie0Zbx5A6lq8RPEA3sEDknYzw0gCIrSlnSgRHxvUP/bT9KncFmOrmTg==}
/@anthropic-ai/sdk@0.15.0:
resolution: {integrity: sha512-QMNEFcwGGB64oEIL+U9b+mxSbat5TCdNxvQVV0qCNGQvg/nlnbOmq2/x/0mKhuKD0n5bioL75oCkTbQaAgyYtw==}
dependencies:
'@types/node': 18.19.14
'@types/node-fetch': 2.6.9
@@ -2055,7 +2055,7 @@ packages:
resolution: {integrity: sha512-SPiDHaWKQZpwR2siD0KQUwlStvIAnEyK6tAE2h2Wuoq8ue9skzhlyVQ1ddzOxX6khULnAALDiR/isSF3bnuciA==}
dev: true
/@docsearch/react@3.5.2(@algolia/client-search@4.22.1)(@types/react@18.2.55)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0):
/@docsearch/react@3.5.2(@algolia/client-search@4.22.1)(@types/react@18.2.61)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0):
resolution: {integrity: sha512-9Ahcrs5z2jq/DcAvYtvlqEBHImbm4YJI8M9y0x6Tqg598P40HTEkX7hsMcIuThI+hTFxRGZ9hll0Wygm2yEjng==}
peerDependencies:
'@types/react': '>= 16.8.0 < 19.0.0'
@@ -2075,7 +2075,7 @@ packages:
'@algolia/autocomplete-core': 1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1)(search-insights@2.13.0)
'@algolia/autocomplete-preset-algolia': 1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1)
'@docsearch/css': 3.5.2
'@types/react': 18.2.55
'@types/react': 18.2.61
algoliasearch: 4.22.1
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
@@ -2581,7 +2581,7 @@ packages:
- webpack-cli
dev: true
/@docusaurus/preset-classic@3.1.1(@algolia/client-search@4.22.1)(@types/react@18.2.55)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.3.3):
/@docusaurus/preset-classic@3.1.1(@algolia/client-search@4.22.1)(@types/react@18.2.61)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.3.3):
resolution: {integrity: sha512-jG4ys/hWYf69iaN/xOmF+3kjs4Nnz1Ay3CjFLDtYa8KdxbmUhArA9HmP26ru5N0wbVWhY+6kmpYhTJpez5wTyg==}
engines: {node: '>=18.0'}
peerDependencies:
@@ -2597,9 +2597,9 @@ packages:
'@docusaurus/plugin-google-gtag': 3.1.1(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
'@docusaurus/plugin-google-tag-manager': 3.1.1(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
'@docusaurus/plugin-sitemap': 3.1.1(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
'@docusaurus/theme-classic': 3.1.1(@types/react@18.2.55)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
'@docusaurus/theme-classic': 3.1.1(@types/react@18.2.61)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
'@docusaurus/theme-common': 3.1.1(@docusaurus/types@3.1.1)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
'@docusaurus/theme-search-algolia': 3.1.1(@algolia/client-search@4.22.1)(@docusaurus/types@3.1.1)(@types/react@18.2.55)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.3.3)
'@docusaurus/theme-search-algolia': 3.1.1(@algolia/client-search@4.22.1)(@docusaurus/types@3.1.1)(@types/react@18.2.61)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.3.3)
'@docusaurus/types': 3.1.1(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
@@ -2630,7 +2630,7 @@ packages:
peerDependencies:
react: '*'
dependencies:
'@types/react': 18.2.55
'@types/react': 18.2.48
prop-types: 15.8.1
react: 18.2.0
@@ -2647,7 +2647,7 @@ packages:
- supports-color
dev: false
/@docusaurus/theme-classic@3.1.1(@types/react@18.2.55)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3):
/@docusaurus/theme-classic@3.1.1(@types/react@18.2.61)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3):
resolution: {integrity: sha512-GiPE/jbWM8Qv1A14lk6s9fhc0LhPEQ00eIczRO4QL2nAQJZXkjPG6zaVx+1cZxPFWbAsqSjKe2lqkwF3fGkQ7Q==}
engines: {node: '>=18.0'}
peerDependencies:
@@ -2666,7 +2666,7 @@ packages:
'@docusaurus/utils': 3.1.1(@docusaurus/types@3.1.1)
'@docusaurus/utils-common': 3.1.1(@docusaurus/types@3.1.1)
'@docusaurus/utils-validation': 3.1.1(@docusaurus/types@3.1.1)
'@mdx-js/react': 3.0.0(@types/react@18.2.55)(react@18.2.0)
'@mdx-js/react': 3.0.0(@types/react@18.2.61)(react@18.2.0)
clsx: 2.1.0
copy-text-to-clipboard: 3.2.0
infima: 0.2.0-alpha.43
@@ -2745,14 +2745,14 @@ packages:
- webpack-cli
dev: true
/@docusaurus/theme-search-algolia@3.1.1(@algolia/client-search@4.22.1)(@docusaurus/types@3.1.1)(@types/react@18.2.55)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.3.3):
/@docusaurus/theme-search-algolia@3.1.1(@algolia/client-search@4.22.1)(@docusaurus/types@3.1.1)(@types/react@18.2.61)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.3.3):
resolution: {integrity: sha512-tBH9VY5EpRctVdaAhT+b1BY8y5dyHVZGFXyCHgTrvcXQy5CV4q7serEX7U3SveNT9zksmchPyct6i1sFDC4Z5g==}
engines: {node: '>=18.0'}
peerDependencies:
react: ^18.0.0
react-dom: ^18.0.0
dependencies:
'@docsearch/react': 3.5.2(@algolia/client-search@4.22.1)(@types/react@18.2.55)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)
'@docsearch/react': 3.5.2(@algolia/client-search@4.22.1)(@types/react@18.2.61)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)
'@docusaurus/core': 3.1.1(@docusaurus/types@3.1.1)(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
'@docusaurus/logger': 3.1.1
'@docusaurus/plugin-content-docs': 3.1.1(eslint@8.56.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
@@ -3129,6 +3129,16 @@ packages:
eslint: 8.56.0
eslint-visitor-keys: 3.4.3
/@eslint-community/eslint-utils@4.4.0(eslint@8.57.0):
resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
dependencies:
eslint: 8.57.0
eslint-visitor-keys: 3.4.3
dev: false
/@eslint-community/regexpp@4.10.0:
resolution: {integrity: sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
@@ -3153,6 +3163,11 @@ packages:
resolution: {integrity: sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
/@eslint/js@8.57.0:
resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: false
/@fastify/busboy@2.1.0:
resolution: {integrity: sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==}
engines: {node: '>=14'}
@@ -3213,7 +3228,7 @@ packages:
'@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.6
'@types/istanbul-reports': 3.0.4
'@types/node': 20.11.17
'@types/node': 20.11.20
'@types/yargs': 17.0.32
chalk: 4.1.2
@@ -3258,8 +3273,18 @@ packages:
/@leichtgewicht/ip-codec@2.0.4:
resolution: {integrity: sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==}
/@llamaindex/cloud@0.0.1:
resolution: {integrity: sha512-7FrLAbY459B4rcG4NaqANatDT5zKvZxIRyrY+nnTSXqu9ZMzkm1Co8IIRYx2/9feps/OLOhXsv7VKGGUr7scNQ==}
/@llamaindex/cloud@0.0.4:
resolution: {integrity: sha512-ufu8sASmttGQZBrDVt5XHF+Lf7ZFImMe/bCwqfoGiywJUchc88igxhP0xF5iUpthyQr2/0nAhH117owj5+GF3A==}
peerDependencies:
node-fetch: ^3.3.2
peerDependenciesMeta:
node-fetch:
optional: true
dependencies:
'@types/qs': 6.9.12
form-data: 4.0.0
js-base64: 3.7.7
qs: 6.11.2
dev: false
/@manypkg/find-root@1.1.0:
@@ -3311,14 +3336,14 @@ packages:
transitivePeerDependencies:
- supports-color
/@mdx-js/react@3.0.0(@types/react@18.2.55)(react@18.2.0):
/@mdx-js/react@3.0.0(@types/react@18.2.61)(react@18.2.0):
resolution: {integrity: sha512-nDctevR9KyYFyV+m+/+S4cpzCWHqj+iHDHq3QrsWezcC+B17uZdIWgCguESUkwFhM3n/56KxWVE3V6EokrmONQ==}
peerDependencies:
'@types/react': '>=16'
react: '>=16'
dependencies:
'@types/mdx': 2.0.10
'@types/react': 18.2.55
'@types/react': 18.2.61
react: 18.2.0
/@mistralai/mistralai@0.0.10:
@@ -4143,7 +4168,7 @@ packages:
/@types/connect@3.4.38:
resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
dependencies:
'@types/node': 20.11.17
'@types/node': 20.11.20
/@types/cross-spawn@6.0.0:
resolution: {integrity: sha512-evp2ZGsFw9YKprDbg8ySgC9NA15g3YgiI8ANkGmKKvvi0P2aDGYLPxQIC5qfeKNUOe3TjABVGuah6omPRpIYhg==}
@@ -4180,7 +4205,7 @@ packages:
resolution: {integrity: sha512-ckM3jm2bf/MfB3+spLPWYPUH573plBFwpOhqQ2WottxYV85j1HQFlxmnTq57X1yHY9awZPig06hL/cLMgNWHIQ==}
dependencies:
'@types/node': 20.11.17
'@types/qs': 6.9.11
'@types/qs': 6.9.12
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
@@ -4189,7 +4214,7 @@ packages:
dependencies:
'@types/body-parser': 1.19.5
'@types/express-serve-static-core': 4.17.42
'@types/qs': 6.9.11
'@types/qs': 6.9.12
'@types/serve-static': 1.15.5
/@types/gtag.js@0.0.12:
@@ -4328,7 +4353,6 @@ packages:
resolution: {integrity: sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==}
dependencies:
undici-types: 5.26.5
dev: false
/@types/node@20.11.7:
resolution: {integrity: sha512-GPmeN1C3XAyV5uybAf4cMLWT9fDWcmQhZVtMFu7OR32WjrqGG+Wnk2V1d0bmtUyE/Zy1QJ9BxyiTih9z8Oks8A==}
@@ -4370,8 +4394,8 @@ packages:
/@types/prop-types@15.7.8:
resolution: {integrity: sha512-kMpQpfZKSCBqltAJwskgePRaYRFukDkm1oItcAbC3gNELR20XIBcN9VRgg4+m8DKsTfkWeA4m4Imp4DDuWy7FQ==}
/@types/qs@6.9.11:
resolution: {integrity: sha512-oGk0gmhnEJK4Yyk+oI7EfXsLayXatCWPHary1MtcmbAifkobT9cM9yutG/hZKIseOU0MqbIwQ/u2nn/Gb+ltuQ==}
/@types/qs@6.9.12:
resolution: {integrity: sha512-bZcOkJ6uWrL0Qb2NAWKa7TBU+mJHPzhx9jjLL1KHF+XpzEcR7EXHvjbHlGtR/IsP1vyPrehuS6XqkmaePy//mg==}
/@types/range-parser@1.2.7:
resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==}
@@ -4380,7 +4404,7 @@ packages:
resolution: {integrity: sha512-WmSAg7WgqW7m4x8Mt4N6ZyKz0BubSj/2tVUMsAHp+Yd2AMwcSbeFq9WympT19p5heCFmF97R9eD5uUR/t4HEqw==}
dependencies:
'@types/history': 4.7.11
'@types/react': 18.2.55
'@types/react': 18.2.61
'@types/react-router': 5.1.20
dev: true
@@ -4404,7 +4428,7 @@ packages:
resolution: {integrity: sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==}
dependencies:
'@types/history': 4.7.11
'@types/react': 18.2.55
'@types/react': 18.2.48
dev: true
/@types/react@18.2.48:
@@ -4414,8 +4438,8 @@ packages:
'@types/scheduler': 0.16.4
csstype: 3.1.2
/@types/react@18.2.55:
resolution: {integrity: sha512-Y2Tz5P4yz23brwm2d7jNon39qoAtMMmalOQv6+fEFt1mT+FcM3D841wDpoUvFXhaYenuROCy3FZYqdTjM7qVyA==}
/@types/react@18.2.61:
resolution: {integrity: sha512-NURTN0qNnJa7O/k4XUkEW2yfygA+NxS0V5h1+kp9jPwhzZy95q3ADoGMP0+JypMhrZBTTgjKAUlTctde1zzeQA==}
dependencies:
'@types/prop-types': 15.7.11
'@types/scheduler': 0.16.8
@@ -4454,7 +4478,7 @@ packages:
resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==}
dependencies:
'@types/mime': 1.3.5
'@types/node': 20.11.17
'@types/node': 20.11.20
/@types/serve-index@1.9.4:
resolution: {integrity: sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug==}
@@ -4517,7 +4541,7 @@ packages:
dependencies:
'@types/yargs-parser': 21.0.3
/@typescript-eslint/parser@6.19.1(eslint@8.56.0)(typescript@5.3.3):
/@typescript-eslint/parser@6.19.1(eslint@8.57.0)(typescript@5.3.3):
resolution: {integrity: sha512-WEfX22ziAh6pRE9jnbkkLGp/4RhTpffr2ZK5bJ18M8mIfA8A+k97U9ZyaXCEJRlmMHh7R9MJZWXp/r73DzINVQ==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
@@ -4532,7 +4556,7 @@ packages:
'@typescript-eslint/typescript-estree': 6.19.1(typescript@5.3.3)
'@typescript-eslint/visitor-keys': 6.19.1
debug: 4.3.4
eslint: 8.56.0
eslint: 8.57.0
typescript: 5.3.3
transitivePeerDependencies:
- supports-color
@@ -5452,6 +5476,17 @@ packages:
node-releases: 2.0.14
update-browserslist-db: 1.0.13(browserslist@4.22.3)
/browserslist@4.23.0:
resolution: {integrity: sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==}
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
dependencies:
caniuse-lite: 1.0.30001593
electron-to-chromium: 1.4.690
node-releases: 2.0.14
update-browserslist-db: 1.0.13(browserslist@4.23.0)
dev: false
/bson@6.2.0:
resolution: {integrity: sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==}
engines: {node: '>=16.20.1'}
@@ -5596,6 +5631,10 @@ packages:
/caniuse-lite@1.0.30001580:
resolution: {integrity: sha512-mtj5ur2FFPZcCEpXFy8ADXbDACuNFXg6mxVDqp7tqooX6l3zwm+d8EPoeOSIFRDvHs8qu7/SLFOGniULkcH2iA==}
/caniuse-lite@1.0.30001593:
resolution: {integrity: sha512-UWM1zlo3cZfkpBysd7AS+z+v007q9G1+fLTUU42rQnY6t2axoogPW/xol6T7juU5EUoOhML4WgBIdG+9yYqAjQ==}
dev: false
/ccount@2.0.1:
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
@@ -6922,6 +6961,10 @@ packages:
/electron-to-chromium@1.4.648:
resolution: {integrity: sha512-EmFMarXeqJp9cUKu/QEciEApn0S/xRcpZWuAm32U7NgoZCimjsilKXHRO9saeEW55eHZagIDg6XTUOv32w9pjg==}
/electron-to-chromium@1.4.690:
resolution: {integrity: sha512-+2OAGjUx68xElQhydpcbqH50hE8Vs2K6TkAeLhICYfndb67CVH0UsZaijmRUE3rHlIxU1u0jxwhgVe6fK3YANA==}
dev: false
/emoji-regex@10.3.0:
resolution: {integrity: sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==}
dev: true
@@ -6968,6 +7011,14 @@ packages:
graceful-fs: 4.2.11
tapable: 2.2.1
/enhanced-resolve@5.15.1:
resolution: {integrity: sha512-3d3JRbwsCLJsYgvb6NuWEG44jjPSOMuS73L/6+7BZuoKm3W+qXnSoIYVHi8dG7Qcg4inAY4jbzkZ7MnskePeDg==}
engines: {node: '>=10.13.0'}
dependencies:
graceful-fs: 4.2.11
tapable: 2.2.1
dev: false
/enquirer@2.4.1:
resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==}
engines: {node: '>=8.6'}
@@ -7206,7 +7257,7 @@ packages:
source-map: 0.6.1
dev: true
/eslint-config-next@13.5.6(eslint@8.56.0)(typescript@5.3.3):
/eslint-config-next@13.5.6(eslint@8.57.0)(typescript@5.3.3):
resolution: {integrity: sha512-o8pQsUHTo9aHqJ2YiZDym5gQAMRf7O2HndHo/JZeY7TDD+W4hk6Ma8Vw54RHiBeb7OWWO5dPirQB+Is/aVQ7Kg==}
peerDependencies:
eslint: ^7.23.0 || ^8.0.0
@@ -7217,36 +7268,36 @@ packages:
dependencies:
'@next/eslint-plugin-next': 13.5.6
'@rushstack/eslint-patch': 1.7.2
'@typescript-eslint/parser': 6.19.1(eslint@8.56.0)(typescript@5.3.3)
eslint: 8.56.0
'@typescript-eslint/parser': 6.19.1(eslint@8.57.0)(typescript@5.3.3)
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0)
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0)
eslint-plugin-jsx-a11y: 6.8.0(eslint@8.56.0)
eslint-plugin-react: 7.33.2(eslint@8.56.0)
eslint-plugin-react-hooks: 4.6.0(eslint@8.56.0)
eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0)
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
eslint-plugin-jsx-a11y: 6.8.0(eslint@8.57.0)
eslint-plugin-react: 7.33.2(eslint@8.57.0)
eslint-plugin-react-hooks: 4.6.0(eslint@8.57.0)
typescript: 5.3.3
transitivePeerDependencies:
- eslint-import-resolver-webpack
- supports-color
dev: false
/eslint-config-prettier@8.10.0(eslint@8.56.0):
/eslint-config-prettier@8.10.0(eslint@8.57.0):
resolution: {integrity: sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==}
hasBin: true
peerDependencies:
eslint: '>=7.0.0'
dependencies:
eslint: 8.56.0
eslint: 8.57.0
dev: false
/eslint-config-turbo@1.11.3(eslint@8.56.0):
/eslint-config-turbo@1.11.3(eslint@8.57.0):
resolution: {integrity: sha512-v7CHpAHodBKlj+r+R3B2DJlZbCjpZLnK7gO/vCRk/Lc+tlD/f04wM6rmHlerevOlchtmwARilRLBnmzNLffTyQ==}
peerDependencies:
eslint: '>6.6.0'
dependencies:
eslint: 8.56.0
eslint-plugin-turbo: 1.11.3(eslint@8.56.0)
eslint: 8.57.0
eslint-plugin-turbo: 1.11.3(eslint@8.57.0)
dev: false
/eslint-import-resolver-node@0.3.9:
@@ -7259,7 +7310,7 @@ packages:
- supports-color
dev: false
/eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0):
/eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0):
resolution: {integrity: sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
@@ -7268,9 +7319,9 @@ packages:
dependencies:
debug: 4.3.4
enhanced-resolve: 5.15.0
eslint: 8.56.0
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0)
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0)
eslint: 8.57.0
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
fast-glob: 3.3.2
get-tsconfig: 4.7.2
is-core-module: 2.13.1
@@ -7282,7 +7333,7 @@ packages:
- supports-color
dev: false
/eslint-module-utils@2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0):
/eslint-module-utils@2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0):
resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==}
engines: {node: '>=4'}
peerDependencies:
@@ -7303,16 +7354,16 @@ packages:
eslint-import-resolver-webpack:
optional: true
dependencies:
'@typescript-eslint/parser': 6.19.1(eslint@8.56.0)(typescript@5.3.3)
'@typescript-eslint/parser': 6.19.1(eslint@8.57.0)(typescript@5.3.3)
debug: 3.2.7
eslint: 8.56.0
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0)
eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0)
transitivePeerDependencies:
- supports-color
dev: false
/eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0):
/eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0):
resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==}
engines: {node: '>=4'}
peerDependencies:
@@ -7322,16 +7373,16 @@ packages:
'@typescript-eslint/parser':
optional: true
dependencies:
'@typescript-eslint/parser': 6.19.1(eslint@8.56.0)(typescript@5.3.3)
'@typescript-eslint/parser': 6.19.1(eslint@8.57.0)(typescript@5.3.3)
array-includes: 3.1.7
array.prototype.findlastindex: 1.2.3
array.prototype.flat: 1.3.2
array.prototype.flatmap: 1.3.2
debug: 3.2.7
doctrine: 2.1.0
eslint: 8.56.0
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0)
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
hasown: 2.0.0
is-core-module: 2.13.1
is-glob: 4.0.3
@@ -7347,7 +7398,7 @@ packages:
- supports-color
dev: false
/eslint-plugin-jsx-a11y@6.8.0(eslint@8.56.0):
/eslint-plugin-jsx-a11y@6.8.0(eslint@8.57.0):
resolution: {integrity: sha512-Hdh937BS3KdwwbBaKd5+PLCOmYY6U4f2h9Z2ktwtNKvIdIEu137rjYbcb9ApSbVJfWxANNuiKTD/9tOKjK9qOA==}
engines: {node: '>=4.0'}
peerDependencies:
@@ -7363,7 +7414,7 @@ packages:
damerau-levenshtein: 1.0.8
emoji-regex: 9.2.2
es-iterator-helpers: 1.0.15
eslint: 8.56.0
eslint: 8.57.0
hasown: 2.0.0
jsx-ast-utils: 3.3.5
language-tags: 1.0.9
@@ -7372,16 +7423,16 @@ packages:
object.fromentries: 2.0.7
dev: false
/eslint-plugin-react-hooks@4.6.0(eslint@8.56.0):
/eslint-plugin-react-hooks@4.6.0(eslint@8.57.0):
resolution: {integrity: sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==}
engines: {node: '>=10'}
peerDependencies:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0
dependencies:
eslint: 8.56.0
eslint: 8.57.0
dev: false
/eslint-plugin-react@7.28.0(eslint@8.56.0):
/eslint-plugin-react@7.28.0(eslint@8.57.0):
resolution: {integrity: sha512-IOlFIRHzWfEQQKcAD4iyYDndHwTQiCMcJVJjxempf203jnNLUnW34AXLrV33+nEXoifJE2ZEGmcjKPL8957eSw==}
engines: {node: '>=4'}
peerDependencies:
@@ -7390,7 +7441,7 @@ packages:
array-includes: 3.1.6
array.prototype.flatmap: 1.3.1
doctrine: 2.1.0
eslint: 8.56.0
eslint: 8.57.0
estraverse: 5.3.0
jsx-ast-utils: 3.3.3
minimatch: 3.1.2
@@ -7404,7 +7455,7 @@ packages:
string.prototype.matchall: 4.0.8
dev: false
/eslint-plugin-react@7.33.2(eslint@8.56.0):
/eslint-plugin-react@7.33.2(eslint@8.57.0):
resolution: {integrity: sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw==}
engines: {node: '>=4'}
peerDependencies:
@@ -7415,7 +7466,7 @@ packages:
array.prototype.tosorted: 1.1.2
doctrine: 2.1.0
es-iterator-helpers: 1.0.15
eslint: 8.56.0
eslint: 8.57.0
estraverse: 5.3.0
jsx-ast-utils: 3.3.5
minimatch: 3.1.2
@@ -7429,13 +7480,13 @@ packages:
string.prototype.matchall: 4.0.10
dev: false
/eslint-plugin-turbo@1.11.3(eslint@8.56.0):
/eslint-plugin-turbo@1.11.3(eslint@8.57.0):
resolution: {integrity: sha512-R5ftTTWQzEYaKzF5g6m/MInCU8pIN+2TLL+S50AYBr1enwUovdZmnZ1HDwFMaxIjJ8x5ah+jvAzql5IJE9VWaA==}
peerDependencies:
eslint: '>6.6.0'
dependencies:
dotenv: 16.0.3
eslint: 8.56.0
eslint: 8.57.0
dev: false
/eslint-scope@5.1.1:
@@ -7507,6 +7558,53 @@ packages:
transitivePeerDependencies:
- supports-color
/eslint@8.57.0:
resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
hasBin: true
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
'@eslint-community/regexpp': 4.10.0
'@eslint/eslintrc': 2.1.4
'@eslint/js': 8.57.0
'@humanwhocodes/config-array': 0.11.14
'@humanwhocodes/module-importer': 1.0.1
'@nodelib/fs.walk': 1.2.8
'@ungap/structured-clone': 1.2.0
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.3
debug: 4.3.4
doctrine: 3.0.0
escape-string-regexp: 4.0.0
eslint-scope: 7.2.2
eslint-visitor-keys: 3.4.3
espree: 9.6.1
esquery: 1.5.0
esutils: 2.0.3
fast-deep-equal: 3.1.3
file-entry-cache: 6.0.1
find-up: 5.0.0
glob-parent: 6.0.2
globals: 13.24.0
graphemer: 1.4.0
ignore: 5.3.1
imurmurhash: 0.1.4
is-glob: 4.0.3
is-path-inside: 3.0.3
js-yaml: 4.1.0
json-stable-stringify-without-jsonify: 1.0.1
levn: 0.4.1
lodash.merge: 4.6.2
minimatch: 3.1.2
natural-compare: 1.4.0
optionator: 0.9.3
strip-ansi: 6.0.1
text-table: 0.2.0
transitivePeerDependencies:
- supports-color
dev: false
/espree@9.6.1:
resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -9395,6 +9493,10 @@ packages:
resolution: {integrity: sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ==}
dev: false
/js-base64@3.7.7:
resolution: {integrity: sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==}
dev: false
/js-tiktoken@1.0.10:
resolution: {integrity: sha512-ZoSxbGjvGyMT13x6ACo9ebhDha/0FHdKA+OsQcMOWcm1Zs7r90Rhk5lhERLzji+3rA7EKpXCgwXcM5fF3DMpdA==}
dependencies:
@@ -12310,7 +12412,7 @@ packages:
'@protobufjs/pool': 1.1.0
'@protobufjs/utf8': 1.1.0
'@types/long': 4.0.2
'@types/node': 20.11.17
'@types/node': 20.11.20
long: 4.0.0
dev: false
@@ -12446,7 +12548,7 @@ packages:
iconv-lite: 0.4.24
unpipe: 1.0.0
/raw-loader@4.0.2(webpack@5.90.1):
/raw-loader@4.0.2(webpack@5.90.3):
resolution: {integrity: sha512-ZnScIV3ag9A4wPX/ZayxL/jZH+euYb6FcUinPcgiQW0+UBtEv0O6Q3lGd3cqJ+GHH+rksEv3Pj99oxJ3u3VIKA==}
engines: {node: '>= 10.13.0'}
peerDependencies:
@@ -12454,7 +12556,7 @@ packages:
dependencies:
loader-utils: 2.0.4
schema-utils: 3.3.0
webpack: 5.90.1
webpack: 5.90.3
dev: false
/rc@1.2.8:
@@ -14096,7 +14198,7 @@ packages:
terser: 5.27.0
webpack: 5.90.0
/terser-webpack-plugin@5.3.10(webpack@5.90.1):
/terser-webpack-plugin@5.3.10(webpack@5.90.3):
resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==}
engines: {node: '>= 10.13.0'}
peerDependencies:
@@ -14117,7 +14219,7 @@ packages:
schema-utils: 3.3.0
serialize-javascript: 6.0.2
terser: 5.27.0
webpack: 5.90.1
webpack: 5.90.3
dev: false
/terser@5.27.0:
@@ -14724,6 +14826,17 @@ packages:
escalade: 3.1.1
picocolors: 1.0.0
/update-browserslist-db@1.0.13(browserslist@4.23.0):
resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==}
hasBin: true
peerDependencies:
browserslist: '>= 4.21.0'
dependencies:
browserslist: 4.23.0
escalade: 3.1.1
picocolors: 1.0.0
dev: false
/update-check@1.5.4:
resolution: {integrity: sha512-5YHsflzHP4t1G+8WGPlvKbJEbAJGCgw+Em+dGR1KmBUbr1J36SJBqlHLjR7oob7sco5hWHGQVcr9B2poIVDDTQ==}
dependencies:
@@ -15148,8 +15261,8 @@ packages:
- esbuild
- uglify-js
/webpack@5.90.1:
resolution: {integrity: sha512-SstPdlAC5IvgFnhiRok8hqJo/+ArAbNv7rhU4fnWGHNVfN59HSQFaxZDSAL3IFG2YmqxuRs+IU33milSxbPlog==}
/webpack@5.90.3:
resolution: {integrity: sha512-h6uDYlWCctQRuXBs1oYpVe6sFcWedl0dpcVaTf/YF67J9bKvwJajFulMVSYKHrksMB3I/pIagRzDxwxkebuzKA==}
engines: {node: '>=10.13.0'}
hasBin: true
peerDependencies:
@@ -15165,9 +15278,9 @@ packages:
'@webassemblyjs/wasm-parser': 1.11.6
acorn: 8.11.3
acorn-import-assertions: 1.9.0(acorn@8.11.3)
browserslist: 4.22.3
browserslist: 4.23.0
chrome-trace-event: 1.0.3
enhanced-resolve: 5.15.0
enhanced-resolve: 5.15.1
es-module-lexer: 1.4.1
eslint-scope: 5.1.1
events: 3.3.0
@@ -15179,7 +15292,7 @@ packages:
neo-async: 2.6.2
schema-utils: 3.3.0
tapable: 2.2.1
terser-webpack-plugin: 5.3.10(webpack@5.90.1)
terser-webpack-plugin: 5.3.10(webpack@5.90.3)
watchpack: 2.4.0
webpack-sources: 3.2.3
transitivePeerDependencies:
+7 -1
View File
@@ -11,7 +11,13 @@
"outDir": "./lib",
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"incremental": true,
"composite": true
"composite": true,
"paths": {
"llamaindex": ["./packages/core/src/index.ts"],
"llamaindex/*": ["./packages/core/src/*.ts"],
"@llamaindex/env": ["./packages/env/src/index.ts"],
"@llamaindex/env/*": ["./packages/env/src/*.ts"]
}
},
"files": [],
"references": [
+3 -1
View File
@@ -6,7 +6,9 @@
"dependsOn": ["^build"],
"outputs": ["dist/**", "build/**"]
},
"lint": {},
"lint": {
"inputs": ["packages/eslint-config-custom"]
},
"test": {
"dependsOn": ["^build"]
},