mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-18 00:24:30 -04:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b95abdc85 | |||
| ffe0cd1ef1 | |||
| 5d2111a19f | |||
| 68ac7fd57f | |||
| 7320d96a36 | |||
| ee17fb475b | |||
| 28b877e31f | |||
| 4389b80a52 | |||
| d3bc663951 | |||
| 4810364788 | |||
| 2dcad52dd9 | |||
| 0bf8d80b12 |
@@ -12,6 +12,10 @@ concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
POSTGRES_USER: runneradmin
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
|
||||
jobs:
|
||||
e2e:
|
||||
strategy:
|
||||
@@ -22,9 +26,17 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: ankane/setup-postgres@v1
|
||||
with:
|
||||
database: llamaindex_node_test
|
||||
dev-files: true
|
||||
- run: |
|
||||
cd /tmp
|
||||
git clone --branch v0.7.0 https://github.com/pgvector/pgvector.git
|
||||
cd pgvector
|
||||
make
|
||||
sudo make install
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
@@ -42,7 +54,6 @@ jobs:
|
||||
node-version: [18.x, 20.x, 22.x]
|
||||
name: Test on Node.js ${{ matrix.node-version }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
@@ -92,7 +103,7 @@ jobs:
|
||||
- nextjs-agent
|
||||
- nextjs-edge-runtime
|
||||
- nextjs-node-runtime
|
||||
# - waku-query-engine
|
||||
- waku-query-engine
|
||||
runs-on: ubuntu-latest
|
||||
name: Build LlamaIndex Example (${{ matrix.packages }})
|
||||
steps:
|
||||
|
||||
@@ -36,9 +36,44 @@ For now, browser support is limited due to the lack of support for [AsyncLocalSt
|
||||
npm install llamaindex
|
||||
pnpm install llamaindex
|
||||
yarn add llamaindex
|
||||
jsr install @llamaindex/core
|
||||
```
|
||||
|
||||
### Setup TypeScript
|
||||
|
||||
```json5
|
||||
{
|
||||
compilerOptions: {
|
||||
// ⬇️ add this line to your tsconfig.json
|
||||
moduleResolution: "bundler", // or "node16"
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Why?</summary>
|
||||
We are shipping both ESM and CJS module, and compatible with Vercel Edge, Cloudflare Workers, and other serverless platforms.
|
||||
|
||||
So we are using [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to support all environments.
|
||||
|
||||
This is a kind of modern way of shipping packages, but might cause TypeScript type check to fail because of legacy module resolution.
|
||||
|
||||
Imaging you put output file into `/dist/openai.js` but you are importing `llamaindex/openai` in your code, and set `package.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"exports": {
|
||||
"./openai": "./dist/openai.js"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In old module resolution, TypeScript will not be able to find the module because it is not follow the file structure, even you run `node index.js` successfully. (on Node.js >=16)
|
||||
|
||||
See more about [moduleResolution](https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution) or
|
||||
[TypeScript 5.0 blog](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#--moduleresolution-bundler7).
|
||||
|
||||
</details>
|
||||
|
||||
### Node.js
|
||||
|
||||
```ts
|
||||
@@ -154,6 +189,21 @@ export async function chatWithAgent(
|
||||
}
|
||||
```
|
||||
|
||||
### Vite
|
||||
|
||||
We have some wasm dependencies for better performance. You can use `vite-plugin-wasm` to load them.
|
||||
|
||||
```ts
|
||||
import wasm from "vite-plugin-wasm";
|
||||
|
||||
export default {
|
||||
plugins: [wasm()],
|
||||
ssr: {
|
||||
external: ["tiktoken"],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## Playground
|
||||
|
||||
Check out our NextJS playground at https://llama-playground.vercel.app/. The source is available at https://github.com/run-llama/ts-playground
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# docs
|
||||
|
||||
## 0.0.67
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- llamaindex@0.5.26
|
||||
|
||||
## 0.0.66
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4810364]
|
||||
- Updated dependencies [d3bc663]
|
||||
- llamaindex@0.5.25
|
||||
|
||||
## 0.0.65
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.5.24
|
||||
|
||||
## 0.0.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -4,12 +4,19 @@ sidebar_position: 7
|
||||
|
||||
# Storage
|
||||
|
||||
Storage in LlamaIndex.TS works automatically once you've configured a `StorageContext` object. Just configure the `persistDir` and attach it to an index.
|
||||
Storage in LlamaIndex.TS works automatically once you've configured a
|
||||
`StorageContext` object.
|
||||
|
||||
Right now, only saving and loading from disk is supported, with future integrations planned!
|
||||
## Local Storage
|
||||
|
||||
You can configure the `persistDir` and attach it to an index.
|
||||
|
||||
```typescript
|
||||
import { Document, VectorStoreIndex, storageContextFromDefaults } from "./src";
|
||||
import {
|
||||
Document,
|
||||
VectorStoreIndex,
|
||||
storageContextFromDefaults,
|
||||
} from "llamaindex";
|
||||
|
||||
const storageContext = await storageContextFromDefaults({
|
||||
persistDir: "./storage",
|
||||
@@ -21,6 +28,33 @@ const index = await VectorStoreIndex.fromDocuments([document], {
|
||||
});
|
||||
```
|
||||
|
||||
## PostgreSQL Storage
|
||||
|
||||
You can configure the `schemaName`, `tableName`, `namespace`, and
|
||||
`connectionString`. If a `connectionString` is not
|
||||
provided, it will use the environment variables `PGHOST`, `PGUSER`,
|
||||
`PGPASSWORD`, `PGDATABASE` and `PGPORT`.
|
||||
|
||||
```typescript
|
||||
import {
|
||||
Document,
|
||||
VectorStoreIndex,
|
||||
PostgresDocumentStore,
|
||||
PostgresIndexStore,
|
||||
storageContextFromDefaults,
|
||||
} from "llamaindex";
|
||||
|
||||
const storageContext = await storageContextFromDefaults({
|
||||
docStore: new PostgresDocumentStore(),
|
||||
indexStore: new PostgresIndexStore(),
|
||||
});
|
||||
|
||||
const document = new Document({ text: "Test Text" });
|
||||
const index = await VectorStoreIndex.fromDocuments([document], {
|
||||
storageContext,
|
||||
});
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
- [StorageContext](../api/interfaces/StorageContext.md)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docs",
|
||||
"version": "0.0.64",
|
||||
"version": "0.0.67",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
# @llamaindex/autotool-01-node-example
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- llamaindex@0.5.26
|
||||
- @llamaindex/autotool@2.0.1
|
||||
|
||||
## 0.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4810364]
|
||||
- Updated dependencies [d3bc663]
|
||||
- llamaindex@0.5.25
|
||||
- @llamaindex/autotool@2.0.1
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.5.24
|
||||
- @llamaindex/autotool@2.0.1
|
||||
|
||||
## 0.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
"scripts": {
|
||||
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
|
||||
},
|
||||
"version": "0.0.4"
|
||||
"version": "0.0.7"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
# @llamaindex/autotool-02-next-example
|
||||
|
||||
## 0.1.51
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- llamaindex@0.5.26
|
||||
- @llamaindex/autotool@2.0.1
|
||||
|
||||
## 0.1.50
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4810364]
|
||||
- Updated dependencies [d3bc663]
|
||||
- llamaindex@0.5.25
|
||||
- @llamaindex/autotool@2.0.1
|
||||
|
||||
## 0.1.49
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.5.24
|
||||
- @llamaindex/autotool@2.0.1
|
||||
|
||||
## 0.1.48
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/autotool-02-next-example",
|
||||
"private": true,
|
||||
"version": "0.1.48",
|
||||
"version": "0.1.51",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
"unplugin": "^1.12.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"llamaindex": "^0.5.23",
|
||||
"llamaindex": "^0.5.26",
|
||||
"openai": "^4",
|
||||
"typescript": "^4"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @llamaindex/cloud
|
||||
|
||||
## 0.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4810364: fix: bump version
|
||||
|
||||
## 0.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 0bf8d80: fix: bump version
|
||||
|
||||
## 0.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/cloud",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.4",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# @llamaindex/experimental
|
||||
|
||||
## 0.0.76
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- llamaindex@0.5.26
|
||||
|
||||
## 0.0.75
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4810364]
|
||||
- Updated dependencies [d3bc663]
|
||||
- llamaindex@0.5.25
|
||||
|
||||
## 0.0.74
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.5.24
|
||||
|
||||
## 0.0.73
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/experimental",
|
||||
"description": "Experimental package for LlamaIndexTS",
|
||||
"version": "0.0.73",
|
||||
"version": "0.0.76",
|
||||
"type": "module",
|
||||
"types": "dist/type/index.d.ts",
|
||||
"main": "dist/cjs/index.js",
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# llamaindex
|
||||
|
||||
## 0.5.26
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- ffe0cd1: faet: add openai o1 support
|
||||
- ffe0cd1: feat: add PostgreSQL storage
|
||||
|
||||
## 0.5.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4810364: fix: handle `RouterQueryEngine` with string query
|
||||
- d3bc663: refactor: export vector store only in nodejs environment on top level
|
||||
|
||||
If you see some missing modules error, please change vector store related imports to `llamaindex/vector-store`
|
||||
|
||||
- Updated dependencies [4810364]
|
||||
- @llamaindex/cloud@0.2.4
|
||||
|
||||
## 0.5.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [0bf8d80]
|
||||
- @llamaindex/cloud@0.2.3
|
||||
|
||||
## 0.5.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# @llamaindex/cloudflare-worker-agent-test
|
||||
|
||||
## 0.0.60
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- llamaindex@0.5.26
|
||||
|
||||
## 0.0.59
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4810364]
|
||||
- Updated dependencies [d3bc663]
|
||||
- llamaindex@0.5.25
|
||||
|
||||
## 0.0.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.5.24
|
||||
|
||||
## 0.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/cloudflare-worker-agent-test",
|
||||
"version": "0.0.57",
|
||||
"version": "0.0.60",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# @llamaindex/next-agent-test
|
||||
|
||||
## 0.1.60
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- llamaindex@0.5.26
|
||||
|
||||
## 0.1.59
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4810364]
|
||||
- Updated dependencies [d3bc663]
|
||||
- llamaindex@0.5.25
|
||||
|
||||
## 0.1.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.5.24
|
||||
|
||||
## 0.1.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/next-agent-test",
|
||||
"version": "0.1.57",
|
||||
"version": "0.1.60",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# test-edge-runtime
|
||||
|
||||
## 0.1.59
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- llamaindex@0.5.26
|
||||
|
||||
## 0.1.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4810364]
|
||||
- Updated dependencies [d3bc663]
|
||||
- llamaindex@0.5.25
|
||||
|
||||
## 0.1.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.5.24
|
||||
|
||||
## 0.1.56
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/nextjs-edge-runtime-test",
|
||||
"version": "0.1.56",
|
||||
"version": "0.1.59",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# @llamaindex/next-node-runtime
|
||||
|
||||
## 0.0.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- llamaindex@0.5.26
|
||||
|
||||
## 0.0.40
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4810364]
|
||||
- Updated dependencies [d3bc663]
|
||||
- llamaindex@0.5.25
|
||||
|
||||
## 0.0.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.5.24
|
||||
|
||||
## 0.0.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/next-node-runtime-test",
|
||||
"version": "0.0.38",
|
||||
"version": "0.0.41",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# @llamaindex/waku-query-engine-test
|
||||
|
||||
## 0.0.60
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- Updated dependencies [ffe0cd1]
|
||||
- llamaindex@0.5.26
|
||||
|
||||
## 0.0.59
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4810364]
|
||||
- Updated dependencies [d3bc663]
|
||||
- llamaindex@0.5.25
|
||||
|
||||
## 0.0.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.5.24
|
||||
|
||||
## 0.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/waku-query-engine-test",
|
||||
"version": "0.0.57",
|
||||
"version": "0.0.60",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@@ -20,6 +20,7 @@
|
||||
"@types/react-dom": "18.3.0",
|
||||
"autoprefixer": "10.4.20",
|
||||
"tailwindcss": "3.4.10",
|
||||
"typescript": "5.5.4"
|
||||
"typescript": "5.5.4",
|
||||
"vite-plugin-wasm": "^3.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,15 +11,22 @@ export default async function RootLayout({ children }: RootLayoutProps) {
|
||||
const data = await getData();
|
||||
|
||||
return (
|
||||
<div className="font-['Nunito']">
|
||||
<meta property="description" content={data.description} />
|
||||
<link rel="icon" type="image/png" href={data.icon} />
|
||||
<Header />
|
||||
<main className="m-6 flex items-center *:min-h-64 *:min-w-64 lg:m-0 lg:min-h-svh lg:justify-center">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
<html>
|
||||
<head>
|
||||
<meta property="description" content={data.description} />
|
||||
<link rel="icon" type="image/png" href={data.icon} />
|
||||
<title>LlamaIndex Waku Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<div className="font-['Nunito']">
|
||||
<Header />
|
||||
<main className="m-6 flex items-center *:min-h-64 *:min-w-64 lg:m-0 lg:min-h-svh lg:justify-center">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -31,7 +38,6 @@ const getData = async () => {
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getConfig = async () => {
|
||||
return {
|
||||
render: "static",
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import wasm from "vite-plugin-wasm";
|
||||
|
||||
export default {
|
||||
plugins: [wasm()],
|
||||
ssr: {
|
||||
external: ["tiktoken"],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
import { LLMSingleSelector, Settings } from "llamaindex";
|
||||
import assert from "node:assert";
|
||||
import { test } from "node:test";
|
||||
import { mockLLMEvent } from "./utils.js";
|
||||
|
||||
await test("#1177", async (t) => {
|
||||
await mockLLMEvent(t, "#1177");
|
||||
await t.test(async () => {
|
||||
const selector = new LLMSingleSelector({
|
||||
llm: Settings.llm,
|
||||
});
|
||||
{
|
||||
const result = await selector.select(
|
||||
[
|
||||
{
|
||||
description: "Math calculation",
|
||||
},
|
||||
{
|
||||
description: "Search from google",
|
||||
},
|
||||
],
|
||||
"calculate 2 + 2",
|
||||
);
|
||||
assert.equal(result.selections.length, 1);
|
||||
assert.equal(result.selections.at(0)!.index, 0);
|
||||
}
|
||||
{
|
||||
const result = await selector.select(
|
||||
[
|
||||
{
|
||||
description: "Math calculation",
|
||||
},
|
||||
{
|
||||
description: "Search from google",
|
||||
},
|
||||
],
|
||||
{
|
||||
query: "calculate 2 + 2",
|
||||
},
|
||||
);
|
||||
assert.equal(result.selections.length, 1);
|
||||
assert.equal(result.selections.at(0)!.index, 0);
|
||||
}
|
||||
{
|
||||
const result = await selector.select(
|
||||
[
|
||||
{
|
||||
description: "Math calculation",
|
||||
},
|
||||
{
|
||||
description: "Search from google",
|
||||
},
|
||||
],
|
||||
{
|
||||
query: [
|
||||
{
|
||||
type: "text",
|
||||
text: "calculate 2 + 2",
|
||||
},
|
||||
],
|
||||
},
|
||||
);
|
||||
assert.equal(result.selections.length, 1);
|
||||
assert.equal(result.selections.at(0)!.index, 0);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"llmEventStart": [
|
||||
{
|
||||
"id": "PRESERVE_0",
|
||||
"messages": [
|
||||
{
|
||||
"content": "Some choices are given below. It is provided in a numbered list (1 to 42), where each item in the list corresponds to a summary.\n---------------------\n(1) Math calculation(2) Search from google\n---------------------\nUsing only the choices above and not prior knowledge, return the choice that is most relevant to the question: 'calculate 2 + 2'\n\n\nThe output should be ONLY JSON formatted as a JSON instance.\n\nHere is an example:\n[\n {\n \"choice\": 1,\n \"reason\": \"<insert reason for choice>\"\n },\n ...\n]\n",
|
||||
"role": "user"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PRESERVE_1",
|
||||
"messages": [
|
||||
{
|
||||
"content": "Some choices are given below. It is provided in a numbered list (1 to 42), where each item in the list corresponds to a summary.\n---------------------\n(1) Math calculation(2) Search from google\n---------------------\nUsing only the choices above and not prior knowledge, return the choice that is most relevant to the question: 'calculate 2 + 2'\n\n\nThe output should be ONLY JSON formatted as a JSON instance.\n\nHere is an example:\n[\n {\n \"choice\": 1,\n \"reason\": \"<insert reason for choice>\"\n },\n ...\n]\n",
|
||||
"role": "user"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PRESERVE_2",
|
||||
"messages": [
|
||||
{
|
||||
"content": "Some choices are given below. It is provided in a numbered list (1 to 42), where each item in the list corresponds to a summary.\n---------------------\n(1) Math calculation(2) Search from google\n---------------------\nUsing only the choices above and not prior knowledge, return the choice that is most relevant to the question: 'calculate 2 + 2'\n\n\nThe output should be ONLY JSON formatted as a JSON instance.\n\nHere is an example:\n[\n {\n \"choice\": 1,\n \"reason\": \"<insert reason for choice>\"\n },\n ...\n]\n",
|
||||
"role": "user"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"llmEventEnd": [
|
||||
{
|
||||
"id": "PRESERVE_0",
|
||||
"response": {
|
||||
"raw": null,
|
||||
"message": {
|
||||
"content": "[\n {\n \"choice\": 1,\n \"reason\": \"The question 'calculate 2 + 2' is directly asking for a math calculation, which corresponds to choice 1.\"\n }\n]",
|
||||
"role": "assistant",
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "PRESERVE_1",
|
||||
"response": {
|
||||
"raw": null,
|
||||
"message": {
|
||||
"content": "[\n {\n \"choice\": 1,\n \"reason\": \"The question 'calculate 2 + 2' is asking for a mathematical calculation, which directly corresponds to choice 1: Math calculation.\"\n }\n]",
|
||||
"role": "assistant",
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "PRESERVE_2",
|
||||
"response": {
|
||||
"raw": null,
|
||||
"message": {
|
||||
"content": "[\n {\n \"choice\": 1,\n \"reason\": \"The question 'calculate 2 + 2' is asking for a mathematical calculation, which directly corresponds to choice 1: Math calculation.\"\n }\n]",
|
||||
"role": "assistant",
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"llmEventStream": []
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import { Document, VectorStoreQueryMode } from "llamaindex";
|
||||
import { PGVectorStore } from "llamaindex/vector-store/PGVectorStore";
|
||||
import assert from "node:assert";
|
||||
import { test } from "node:test";
|
||||
import pg from "pg";
|
||||
import { registerTypes } from "pgvector/pg";
|
||||
|
||||
let pgClient: pg.Client | pg.Pool;
|
||||
test.afterEach(async () => {
|
||||
await pgClient.end();
|
||||
});
|
||||
|
||||
await test("init with client", async () => {
|
||||
pgClient = new pg.Client({
|
||||
database: "llamaindex_node_test",
|
||||
});
|
||||
await pgClient.connect();
|
||||
await pgClient.query("CREATE EXTENSION IF NOT EXISTS vector");
|
||||
await registerTypes(pgClient);
|
||||
const vectorStore = new PGVectorStore(pgClient);
|
||||
assert.deepStrictEqual(await vectorStore.client(), pgClient);
|
||||
});
|
||||
|
||||
await test("init with pool", async () => {
|
||||
pgClient = new pg.Pool({
|
||||
database: "llamaindex_node_test",
|
||||
});
|
||||
await pgClient.query("CREATE EXTENSION IF NOT EXISTS vector");
|
||||
const client = await pgClient.connect();
|
||||
await registerTypes(client);
|
||||
const vectorStore = new PGVectorStore(client);
|
||||
assert.deepStrictEqual(await vectorStore.client(), client);
|
||||
client.release();
|
||||
});
|
||||
|
||||
await test("init without client", async () => {
|
||||
const vectorStore = new PGVectorStore({
|
||||
database: "llamaindex_node_test",
|
||||
});
|
||||
pgClient = (await vectorStore.client()) as pg.Client;
|
||||
assert.notDeepStrictEqual(pgClient, undefined);
|
||||
});
|
||||
|
||||
await test("simple node", async () => {
|
||||
const dimensions = 3;
|
||||
const schemaName =
|
||||
"llamaindex_vector_store_test_" + Math.random().toString(36).substring(7);
|
||||
const nodeId = "5bb16627-f6c0-459c-bb18-71642813ef21";
|
||||
const node = new Document({
|
||||
text: "hello world",
|
||||
id_: nodeId,
|
||||
embedding: [0.1, 0.2, 0.3],
|
||||
});
|
||||
const vectorStore = new PGVectorStore({
|
||||
database: "llamaindex_node_test",
|
||||
dimensions,
|
||||
schemaName,
|
||||
});
|
||||
|
||||
await vectorStore.add([node]);
|
||||
|
||||
{
|
||||
const result = await vectorStore.query({
|
||||
mode: VectorStoreQueryMode.DEFAULT,
|
||||
similarityTopK: 1,
|
||||
queryEmbedding: [1, 2, 3],
|
||||
});
|
||||
const actualJSON = result.nodes![0]!.toJSON();
|
||||
assert.deepStrictEqual(actualJSON, {
|
||||
...node.toJSON(),
|
||||
hash: actualJSON.hash,
|
||||
metadata: actualJSON.metadata,
|
||||
});
|
||||
assert.deepStrictEqual(result.ids, [nodeId]);
|
||||
assert.deepStrictEqual(result.similarities, [1]);
|
||||
}
|
||||
|
||||
await vectorStore.delete(nodeId);
|
||||
|
||||
{
|
||||
const result = await vectorStore.query({
|
||||
mode: VectorStoreQueryMode.DEFAULT,
|
||||
similarityTopK: 1,
|
||||
queryEmbedding: [1, 2, 3],
|
||||
});
|
||||
assert.deepStrictEqual(result.nodes, []);
|
||||
}
|
||||
|
||||
pgClient = (await vectorStore.client()) as pg.Client;
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "llamaindex",
|
||||
"version": "0.5.23",
|
||||
"version": "0.5.26",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"keywords": [
|
||||
@@ -56,11 +56,9 @@
|
||||
"md-utils-ts": "^2.0.0",
|
||||
"mongodb": "^6.7.0",
|
||||
"notion-md-crawler": "^1.0.0",
|
||||
"openai": "^4.57.0",
|
||||
"openai": "^4.60.0",
|
||||
"papaparse": "^5.4.1",
|
||||
"pathe": "^1.1.2",
|
||||
"pg": "^8.12.0",
|
||||
"pgvector": "^0.2.0",
|
||||
"portkey-ai": "0.1.16",
|
||||
"rake-modified": "^1.0.8",
|
||||
"string-strip-html": "^13.4.8",
|
||||
@@ -72,11 +70,19 @@
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@notionhq/client": "^2.2.15"
|
||||
"@notionhq/client": "^2.2.15",
|
||||
"pg": "^8.12.0",
|
||||
"pgvector": "0.2.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@notionhq/client": {
|
||||
"optional": true
|
||||
},
|
||||
"pg": {
|
||||
"optional": true
|
||||
},
|
||||
"pgvector": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -85,6 +91,8 @@
|
||||
"@swc/core": "^1.7.22",
|
||||
"concurrently": "^8.2.2",
|
||||
"glob": "^11.0.0",
|
||||
"pg": "^8.12.0",
|
||||
"pgvector": "0.2.0",
|
||||
"typescript": "^5.5.4"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -59,10 +59,12 @@ class GlobalSettings implements Config {
|
||||
}
|
||||
|
||||
get llm(): LLM {
|
||||
if (CoreSettings.llm === null) {
|
||||
// fixme: we might need check internal error instead of try-catch here
|
||||
try {
|
||||
CoreSettings.llm;
|
||||
} catch (error) {
|
||||
CoreSettings.llm = new OpenAI();
|
||||
}
|
||||
|
||||
return CoreSettings.llm;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,3 +17,7 @@ export { GeminiVertexSession } from "./llm/gemini/vertex.js";
|
||||
// Expose AzureDynamicSessionTool for node.js runtime only
|
||||
export { JinaAIEmbedding } from "./embeddings/JinaAIEmbedding.js";
|
||||
export { AzureDynamicSessionTool } from "./tools/AzureDynamicSessionTool.node.js";
|
||||
|
||||
// Don't export vector store modules for non-node.js runtime on top level,
|
||||
// as we cannot guarantee that they will work in other environments
|
||||
export * from "./vector-store.js";
|
||||
|
||||
@@ -29,16 +29,16 @@ import {
|
||||
import type { BaseNodePostprocessor } from "../../postprocessors/types.js";
|
||||
import type { StorageContext } from "../../storage/StorageContext.js";
|
||||
import { storageContextFromDefaults } from "../../storage/StorageContext.js";
|
||||
import type { BaseIndexStore } from "../../storage/indexStore/types.js";
|
||||
import type { BaseSynthesizer } from "../../synthesizers/types.js";
|
||||
import type { QueryEngine } from "../../types.js";
|
||||
import type {
|
||||
MetadataFilters,
|
||||
VectorStore,
|
||||
VectorStoreByType,
|
||||
VectorStoreQueryResult,
|
||||
} from "../../storage/index.js";
|
||||
import type { BaseIndexStore } from "../../storage/indexStore/types.js";
|
||||
import { VectorStoreQueryMode } from "../../storage/vectorStore/types.js";
|
||||
import type { BaseSynthesizer } from "../../synthesizers/types.js";
|
||||
import type { QueryEngine } from "../../types.js";
|
||||
} from "../../vector-store/index.js";
|
||||
import { VectorStoreQueryMode } from "../../vector-store/types.js";
|
||||
import type { BaseIndexInit } from "../BaseIndex.js";
|
||||
import { BaseIndex } from "../BaseIndex.js";
|
||||
import { IndexDict, IndexStructType } from "../json-to-index-struct.js";
|
||||
|
||||
@@ -7,10 +7,7 @@ import {
|
||||
type Metadata,
|
||||
} from "@llamaindex/core/schema";
|
||||
import type { BaseDocumentStore } from "../storage/docStore/types.js";
|
||||
import type {
|
||||
VectorStore,
|
||||
VectorStoreByType,
|
||||
} from "../storage/vectorStore/types.js";
|
||||
import type { VectorStore, VectorStoreByType } from "../vector-store/types.js";
|
||||
import { IngestionCache, getTransformationHash } from "./IngestionCache.js";
|
||||
import {
|
||||
DocStoreStrategy,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BaseNode, TransformComponent } from "@llamaindex/core/schema";
|
||||
import type { BaseDocumentStore } from "../../storage/docStore/types.js";
|
||||
import type { VectorStore } from "../../storage/vectorStore/types.js";
|
||||
import type { VectorStore } from "../../vector-store/types.js";
|
||||
import { classify } from "./classify.js";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BaseNode, TransformComponent } from "@llamaindex/core/schema";
|
||||
import type { BaseDocumentStore } from "../../storage/docStore/types.js";
|
||||
import type { VectorStore } from "../../storage/vectorStore/types.js";
|
||||
import type { VectorStore } from "../../vector-store/types.js";
|
||||
import { classify } from "./classify.js";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { TransformComponent } from "@llamaindex/core/schema";
|
||||
import type { BaseDocumentStore } from "../../storage/docStore/types.js";
|
||||
import type { VectorStore } from "../../storage/vectorStore/types.js";
|
||||
import type { VectorStore } from "../../vector-store/types.js";
|
||||
import { DuplicatesStrategy } from "./DuplicatesStrategy.js";
|
||||
import { UpsertsAndDeleteStrategy } from "./UpsertsAndDeleteStrategy.js";
|
||||
import { UpsertsStrategy } from "./UpsertsStrategy.js";
|
||||
|
||||
@@ -97,6 +97,9 @@ export function getOpenAISession(
|
||||
}
|
||||
|
||||
export const GPT4_MODELS = {
|
||||
"chatgpt-4o-latest": {
|
||||
contextWindow: 128000,
|
||||
},
|
||||
"gpt-4": { contextWindow: 8192 },
|
||||
"gpt-4-32k": { contextWindow: 32768 },
|
||||
"gpt-4-32k-0613": { contextWindow: 32768 },
|
||||
@@ -129,12 +132,28 @@ export const GPT35_MODELS = {
|
||||
"gpt-3.5-turbo-0301": { contextWindow: 16385 },
|
||||
};
|
||||
|
||||
export const O1_MODELS = {
|
||||
"o1-preview": {
|
||||
contextWindow: 128000,
|
||||
},
|
||||
"o1-preview-2024-09-12": {
|
||||
contextWindow: 128000,
|
||||
},
|
||||
"o1-mini": {
|
||||
contextWindow: 128000,
|
||||
},
|
||||
"o1-mini-2024-09-12": {
|
||||
contextWindow: 128000,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* We currently support GPT-3.5 and GPT-4 models
|
||||
*/
|
||||
export const ALL_AVAILABLE_OPENAI_MODELS = {
|
||||
...GPT4_MODELS,
|
||||
...GPT35_MODELS,
|
||||
...O1_MODELS,
|
||||
} satisfies Record<ChatModel, { contextWindow: number }>;
|
||||
|
||||
export function isFunctionCallingModel(llm: LLM): llm is OpenAI {
|
||||
@@ -148,7 +167,8 @@ export function isFunctionCallingModel(llm: LLM): llm is OpenAI {
|
||||
}
|
||||
const isChatModel = Object.keys(ALL_AVAILABLE_OPENAI_MODELS).includes(model);
|
||||
const isOld = model.includes("0314") || model.includes("0301");
|
||||
return isChatModel && !isOld;
|
||||
const isO1 = model.startsWith("o1");
|
||||
return isChatModel && !isOld && !isO1;
|
||||
}
|
||||
|
||||
export type OpenAIAdditionalMetadata = {};
|
||||
|
||||
@@ -12,8 +12,8 @@ const formatStr = `The output should be ONLY JSON formatted as a JSON instance.
|
||||
Here is an example:
|
||||
[
|
||||
{
|
||||
choice: 1,
|
||||
reason: "<insert reason for choice>"
|
||||
"choice": 1,
|
||||
"reason": "<insert reason for choice>"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
@@ -159,7 +159,7 @@ export class LLMSingleSelector extends BaseSelector {
|
||||
const prompt = this.prompt.format({
|
||||
numChoices: `${choicesText.length}`,
|
||||
context: choicesText,
|
||||
query: extractText(query.query),
|
||||
query: extractText(query),
|
||||
});
|
||||
|
||||
const formattedPrompt = this.outputParser.format(prompt);
|
||||
|
||||
@@ -5,12 +5,12 @@ import {
|
||||
import { ModalityType, ObjectType } from "@llamaindex/core/schema";
|
||||
import { path } from "@llamaindex/env";
|
||||
import { getImageEmbedModel } from "../internal/settings/image-embed-model.js";
|
||||
import { SimpleVectorStore } from "../vector-store/SimpleVectorStore.js";
|
||||
import type { VectorStore, VectorStoreByType } from "../vector-store/types.js";
|
||||
import { SimpleDocumentStore } from "./docStore/SimpleDocumentStore.js";
|
||||
import type { BaseDocumentStore } from "./docStore/types.js";
|
||||
import { SimpleIndexStore } from "./indexStore/SimpleIndexStore.js";
|
||||
import type { BaseIndexStore } from "./indexStore/types.js";
|
||||
import { SimpleVectorStore } from "./vectorStore/SimpleVectorStore.js";
|
||||
import type { VectorStore, VectorStoreByType } from "./vectorStore/types.js";
|
||||
|
||||
export interface StorageContext {
|
||||
docStore: BaseDocumentStore;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { DEFAULT_NAMESPACE } from "@llamaindex/core/global";
|
||||
import { PostgresKVStore } from "../kvStore/PostgresKVStore.js";
|
||||
import { KVDocumentStore } from "./KVDocumentStore.js";
|
||||
|
||||
const DEFAULT_TABLE_NAME = "llamaindex_doc_store";
|
||||
|
||||
export class PostgresDocumentStore extends KVDocumentStore {
|
||||
constructor(config?: {
|
||||
schemaName?: string;
|
||||
tableName?: string;
|
||||
connectionString?: string;
|
||||
namespace?: string;
|
||||
}) {
|
||||
const kvStore = new PostgresKVStore({
|
||||
schemaName: config?.schemaName,
|
||||
tableName: config?.tableName || DEFAULT_TABLE_NAME,
|
||||
});
|
||||
const namespace = config?.namespace || DEFAULT_NAMESPACE;
|
||||
super(kvStore, namespace);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,13 @@
|
||||
export { SimpleChatStore } from "./chatStore/SimpleChatStore.js";
|
||||
export * from "./chatStore/types.js";
|
||||
export { PostgresDocumentStore } from "./docStore/PostgresDocumentStore.js";
|
||||
export { SimpleDocumentStore } from "./docStore/SimpleDocumentStore.js";
|
||||
export * from "./docStore/types.js";
|
||||
export * from "./FileSystem.js";
|
||||
export { PostgresIndexStore } from "./indexStore/PostgresIndexStore.js";
|
||||
export { SimpleIndexStore } from "./indexStore/SimpleIndexStore.js";
|
||||
export * from "./indexStore/types.js";
|
||||
export { PostgresKVStore } from "./kvStore/PostgresKVStore.js";
|
||||
export { SimpleKVStore } from "./kvStore/SimpleKVStore.js";
|
||||
export * from "./kvStore/types.js";
|
||||
export * from "./StorageContext.js";
|
||||
export { AstraDBVectorStore } from "./vectorStore/AstraDBVectorStore.js";
|
||||
export { ChromaVectorStore } from "./vectorStore/ChromaVectorStore.js";
|
||||
export { MilvusVectorStore } from "./vectorStore/MilvusVectorStore.js";
|
||||
export { MongoDBAtlasVectorSearch } from "./vectorStore/MongoDBAtlasVectorStore.js";
|
||||
export { PGVectorStore } from "./vectorStore/PGVectorStore.js";
|
||||
export { PineconeVectorStore } from "./vectorStore/PineconeVectorStore.js";
|
||||
export { QdrantVectorStore } from "./vectorStore/QdrantVectorStore.js";
|
||||
export { SimpleVectorStore } from "./vectorStore/SimpleVectorStore.js";
|
||||
export * from "./vectorStore/types.js";
|
||||
export { WeaviateVectorStore } from "./vectorStore/WeaviateVectorStore.js";
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { DEFAULT_NAMESPACE } from "@llamaindex/core/global";
|
||||
import { PostgresKVStore } from "../kvStore/PostgresKVStore.js";
|
||||
import { KVIndexStore } from "./KVIndexStore.js";
|
||||
|
||||
const DEFAULT_TABLE_NAME = "llamaindex_index_store";
|
||||
|
||||
export class PostgresIndexStore extends KVIndexStore {
|
||||
constructor(config?: {
|
||||
schemaName?: string;
|
||||
tableName?: string;
|
||||
connectionString?: string;
|
||||
namespace?: string;
|
||||
}) {
|
||||
const kvStore = new PostgresKVStore({
|
||||
schemaName: config?.schemaName,
|
||||
tableName: config?.tableName || DEFAULT_TABLE_NAME,
|
||||
});
|
||||
const namespace = config?.namespace || DEFAULT_NAMESPACE;
|
||||
super(kvStore, namespace);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import { DEFAULT_COLLECTION } from "@llamaindex/core/global";
|
||||
import type pg from "pg";
|
||||
import { BaseKVStore } from "./types.js";
|
||||
|
||||
export type DataType = Record<string, Record<string, any>>;
|
||||
|
||||
const DEFAULT_SCHEMA_NAME = "public";
|
||||
const DEFAULT_TABLE_NAME = "llamaindex_kv_store";
|
||||
|
||||
export class PostgresKVStore extends BaseKVStore {
|
||||
private schemaName: string;
|
||||
private tableName: string;
|
||||
private connectionString: string | undefined = undefined;
|
||||
private db?: pg.Client;
|
||||
|
||||
constructor(config?: {
|
||||
schemaName?: string | undefined;
|
||||
tableName?: string | undefined;
|
||||
connectionString?: string | undefined;
|
||||
}) {
|
||||
super();
|
||||
this.schemaName = config?.schemaName || DEFAULT_SCHEMA_NAME;
|
||||
this.tableName = config?.tableName || DEFAULT_TABLE_NAME;
|
||||
this.connectionString = config?.connectionString;
|
||||
}
|
||||
|
||||
private async getDb(): Promise<pg.Client> {
|
||||
if (!this.db) {
|
||||
try {
|
||||
const pg = await import("pg");
|
||||
const { Client } = pg.default ? pg.default : pg;
|
||||
const db = new Client({ connectionString: this.connectionString });
|
||||
await db.connect();
|
||||
await this.checkSchema(db);
|
||||
this.db = db;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return Promise.reject(err instanceof Error ? err : new Error(`${err}`));
|
||||
}
|
||||
}
|
||||
return Promise.resolve(this.db);
|
||||
}
|
||||
|
||||
private async checkSchema(db: pg.Client) {
|
||||
await db.query(`CREATE SCHEMA IF NOT EXISTS ${this.schemaName}`);
|
||||
const tbl = `CREATE TABLE IF NOT EXISTS ${this.schemaName}.${this.tableName} (
|
||||
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
|
||||
collection VARCHAR,
|
||||
key VARCHAR,
|
||||
value JSONB DEFAULT '{}'
|
||||
)`;
|
||||
await db.query(tbl);
|
||||
const idxs = `CREATE INDEX IF NOT EXISTS idx_${this.tableName}_collection ON ${this.schemaName}.${this.tableName} (collection);
|
||||
CREATE INDEX IF NOT EXISTS idx_${this.tableName}_key ON ${this.schemaName}.${this.tableName} (key);`;
|
||||
await db.query(idxs);
|
||||
return db;
|
||||
}
|
||||
|
||||
client() {
|
||||
return this.getDb();
|
||||
}
|
||||
|
||||
async put(
|
||||
key: string,
|
||||
val: any,
|
||||
collection: string = DEFAULT_COLLECTION,
|
||||
): Promise<void> {
|
||||
const db = await this.getDb();
|
||||
try {
|
||||
await db.query("BEGIN");
|
||||
const sql = `
|
||||
INSERT INTO ${this.schemaName}.${this.tableName}
|
||||
(collection, key, value)
|
||||
VALUES ($1, $2, $3)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
collection = EXCLUDED.collection,
|
||||
key = EXCLUDED.key,
|
||||
value = EXCLUDED.value
|
||||
RETURNING id
|
||||
`;
|
||||
const values = [collection, key, val];
|
||||
await db.query(sql, values);
|
||||
await db.query("COMMIT");
|
||||
} catch (error) {
|
||||
await db.query("ROLLBACK");
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async get(
|
||||
key: string,
|
||||
collection: string = DEFAULT_COLLECTION,
|
||||
): Promise<any> {
|
||||
const db = await this.getDb();
|
||||
try {
|
||||
await db.query("BEGIN");
|
||||
const sql = `SELECT * FROM ${this.schemaName}.${this.tableName} WHERE key = $1 AND collection = $2`;
|
||||
const result = await db.query(sql, [key, collection]);
|
||||
await db.query("COMMIT");
|
||||
return result.rows[0].value;
|
||||
} catch (error) {
|
||||
await db.query("ROLLBACK");
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async getAll(collection: string = DEFAULT_COLLECTION): Promise<DataType> {
|
||||
const db = await this.getDb();
|
||||
try {
|
||||
await db.query("BEGIN");
|
||||
const sql = `SELECT * FROM ${this.schemaName}.${this.tableName} WHERE collection = $1`;
|
||||
const result = await db.query(sql, [collection]);
|
||||
await db.query("COMMIT");
|
||||
return result.rows.reduce((acc, row) => {
|
||||
acc[row.key] = row.value;
|
||||
return acc;
|
||||
}, {});
|
||||
} catch (error) {
|
||||
await db.query("ROLLBACK");
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async delete(
|
||||
key: string,
|
||||
collection: string = DEFAULT_COLLECTION,
|
||||
): Promise<boolean> {
|
||||
const db = await this.getDb();
|
||||
try {
|
||||
await db.query("BEGIN");
|
||||
const sql = `DELETE FROM ${this.schemaName}.${this.tableName} WHERE key = $1 AND collection = $2`;
|
||||
const result = await db.query(sql, [key, collection]);
|
||||
await db.query("COMMIT");
|
||||
return !!result.rowCount && result.rowCount > 0;
|
||||
} catch (error) {
|
||||
await db.query("ROLLBACK");
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./vector-store/index.js";
|
||||
+53
-42
@@ -3,10 +3,9 @@ import type pg from "pg";
|
||||
import {
|
||||
FilterCondition,
|
||||
FilterOperator,
|
||||
VectorStoreBase,
|
||||
type IEmbedModel,
|
||||
type MetadataFilter,
|
||||
type MetadataFilterValue,
|
||||
VectorStoreBase,
|
||||
type VectorStoreNoEmbedModel,
|
||||
type VectorStoreQuery,
|
||||
type VectorStoreQueryResult,
|
||||
@@ -14,12 +13,22 @@ import {
|
||||
|
||||
import { escapeLikeString } from "./utils.js";
|
||||
|
||||
import type { BaseEmbedding } from "@llamaindex/core/embeddings";
|
||||
import type { BaseNode, Metadata } from "@llamaindex/core/schema";
|
||||
import { Document, MetadataMode } from "@llamaindex/core/schema";
|
||||
|
||||
export const PGVECTOR_SCHEMA = "public";
|
||||
export const PGVECTOR_TABLE = "llamaindex_embedding";
|
||||
|
||||
export type PGVectorStoreConfig = {
|
||||
schemaName?: string | undefined;
|
||||
tableName?: string | undefined;
|
||||
database?: string | undefined;
|
||||
connectionString?: string | undefined;
|
||||
dimensions?: number | undefined;
|
||||
embedModel?: BaseEmbedding | undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides support for writing and querying vector data in Postgres.
|
||||
* Note: Can't be used with data created using the Python version of the vector store (https://docs.llamaindex.ai/en/stable/examples/vector_stores/postgres.html)
|
||||
@@ -33,10 +42,12 @@ export class PGVectorStore
|
||||
private collection: string = "";
|
||||
private schemaName: string = PGVECTOR_SCHEMA;
|
||||
private tableName: string = PGVECTOR_TABLE;
|
||||
|
||||
private database: string | undefined = undefined;
|
||||
private connectionString: string | undefined = undefined;
|
||||
private dimensions: number = 1536;
|
||||
|
||||
private db?: pg.Client;
|
||||
private db?: pg.ClientBase;
|
||||
|
||||
/**
|
||||
* Constructs a new instance of the PGVectorStore
|
||||
@@ -48,26 +59,27 @@ export class PGVectorStore
|
||||
* PGPASSWORD=your database password
|
||||
* PGDATABASE=your database name
|
||||
* PGPORT=your database port
|
||||
*
|
||||
* @param {object} config - The configuration settings for the instance.
|
||||
* @param {string} config.schemaName - The name of the schema (optional). Defaults to PGVECTOR_SCHEMA.
|
||||
* @param {string} config.tableName - The name of the table (optional). Defaults to PGVECTOR_TABLE.
|
||||
* @param {string} config.connectionString - The connection string (optional).
|
||||
* @param {number} config.dimensions - The dimensions of the embedding model.
|
||||
*/
|
||||
constructor(
|
||||
config?: {
|
||||
schemaName?: string;
|
||||
tableName?: string;
|
||||
connectionString?: string;
|
||||
dimensions?: number;
|
||||
} & Partial<IEmbedModel>,
|
||||
) {
|
||||
super(config?.embedModel);
|
||||
this.schemaName = config?.schemaName ?? PGVECTOR_SCHEMA;
|
||||
this.tableName = config?.tableName ?? PGVECTOR_TABLE;
|
||||
this.connectionString = config?.connectionString;
|
||||
this.dimensions = config?.dimensions ?? 1536;
|
||||
constructor(configOrClient?: PGVectorStoreConfig | pg.ClientBase) {
|
||||
// We cannot import pg from top level, it might have side effects
|
||||
// so we only check if the config.connect function exists
|
||||
if (
|
||||
configOrClient &&
|
||||
"connect" in configOrClient &&
|
||||
typeof configOrClient.connect === "function"
|
||||
) {
|
||||
const db = configOrClient as pg.ClientBase;
|
||||
super();
|
||||
this.db = db;
|
||||
} else {
|
||||
const config = configOrClient as PGVectorStoreConfig;
|
||||
super(config?.embedModel);
|
||||
this.schemaName = config?.schemaName ?? PGVECTOR_SCHEMA;
|
||||
this.tableName = config?.tableName ?? PGVECTOR_TABLE;
|
||||
this.database = config?.database;
|
||||
this.connectionString = config?.connectionString;
|
||||
this.dimensions = config?.dimensions ?? 1536;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +104,7 @@ export class PGVectorStore
|
||||
return this.collection;
|
||||
}
|
||||
|
||||
private async getDb(): Promise<pg.Client> {
|
||||
private async getDb(): Promise<pg.ClientBase> {
|
||||
if (!this.db) {
|
||||
try {
|
||||
const pg = await import("pg");
|
||||
@@ -102,6 +114,7 @@ export class PGVectorStore
|
||||
// Create DB connection
|
||||
// Read connection params from env - see comment block above
|
||||
const db = new Client({
|
||||
database: this.database,
|
||||
connectionString: this.connectionString,
|
||||
});
|
||||
await db.connect();
|
||||
@@ -110,9 +123,6 @@ export class PGVectorStore
|
||||
await db.query("CREATE EXTENSION IF NOT EXISTS vector");
|
||||
await registerType(db);
|
||||
|
||||
// Check schema, table(s), index(es)
|
||||
await this.checkSchema(db);
|
||||
|
||||
// All good? Keep the connection reference
|
||||
this.db = db;
|
||||
} catch (err) {
|
||||
@@ -121,10 +131,15 @@ export class PGVectorStore
|
||||
}
|
||||
}
|
||||
|
||||
const db = this.db;
|
||||
|
||||
// Check schema, table(s), index(es)
|
||||
await this.checkSchema(db);
|
||||
|
||||
return Promise.resolve(this.db);
|
||||
}
|
||||
|
||||
private async checkSchema(db: pg.Client) {
|
||||
private async checkSchema(db: pg.ClientBase) {
|
||||
await db.query(`CREATE SCHEMA IF NOT EXISTS ${this.schemaName}`);
|
||||
|
||||
const tbl = `CREATE TABLE IF NOT EXISTS ${this.schemaName}.${this.tableName}(
|
||||
@@ -171,26 +186,22 @@ export class PGVectorStore
|
||||
}
|
||||
|
||||
private getDataToInsert(embeddingResults: BaseNode<Metadata>[]) {
|
||||
const result = [];
|
||||
for (let index = 0; index < embeddingResults.length; index++) {
|
||||
const row = embeddingResults[index]!;
|
||||
return embeddingResults.map((node) => {
|
||||
const id: any = node.id_.length ? node.id_ : null;
|
||||
const meta = node.metadata || {};
|
||||
if (!meta.create_date) {
|
||||
meta.create_date = new Date();
|
||||
}
|
||||
|
||||
const id: any = row.id_.length ? row.id_ : null;
|
||||
const meta = row.metadata || {};
|
||||
meta.create_date = new Date();
|
||||
|
||||
const params = [
|
||||
return [
|
||||
id,
|
||||
"",
|
||||
this.collection,
|
||||
row.getContent(MetadataMode.EMBED),
|
||||
node.getContent(MetadataMode.NONE),
|
||||
meta,
|
||||
"[" + row.getEmbedding().join(",") + "]",
|
||||
"[" + node.getEmbedding().join(",") + "]",
|
||||
];
|
||||
|
||||
result.push(params);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,7 +212,7 @@ export class PGVectorStore
|
||||
*/
|
||||
async add(embeddingResults: BaseNode<Metadata>[]): Promise<string[]> {
|
||||
if (embeddingResults.length === 0) {
|
||||
console.debug("Empty list sent to PGVectorStore::add");
|
||||
console.warn("Empty list sent to PGVectorStore::add");
|
||||
return [];
|
||||
}
|
||||
|
||||
+2
-5
@@ -2,11 +2,8 @@ import type { BaseEmbedding } from "@llamaindex/core/embeddings";
|
||||
import { DEFAULT_PERSIST_DIR } from "@llamaindex/core/global";
|
||||
import type { BaseNode } from "@llamaindex/core/schema";
|
||||
import { fs, path } from "@llamaindex/env";
|
||||
import {
|
||||
getTopKEmbeddings,
|
||||
getTopKMMREmbeddings,
|
||||
} from "../../internal/utils.js";
|
||||
import { exists } from "../FileSystem.js";
|
||||
import { getTopKEmbeddings, getTopKMMREmbeddings } from "../internal/utils.js";
|
||||
import { exists } from "../storage/FileSystem.js";
|
||||
import {
|
||||
FilterOperator,
|
||||
VectorStoreBase,
|
||||
@@ -0,0 +1,10 @@
|
||||
export * from "./AstraDBVectorStore.js";
|
||||
export * from "./ChromaVectorStore.js";
|
||||
export * from "./MilvusVectorStore.js";
|
||||
export * from "./MongoDBAtlasVectorStore.js";
|
||||
export * from "./PGVectorStore.js";
|
||||
export * from "./PineconeVectorStore.js";
|
||||
export * from "./QdrantVectorStore.js";
|
||||
export * from "./SimpleVectorStore.js";
|
||||
export * from "./types.js";
|
||||
export * from "./WeaviateVectorStore.js";
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import type { BaseEmbedding } from "@llamaindex/core/embeddings";
|
||||
import type { BaseNode, ModalityType } from "@llamaindex/core/schema";
|
||||
import { getEmbeddedModel } from "../../internal/settings/EmbedModel.js";
|
||||
import { getEmbeddedModel } from "../internal/settings/EmbedModel.js";
|
||||
|
||||
export interface VectorStoreQueryResult {
|
||||
nodes?: BaseNode[];
|
||||
@@ -2,7 +2,7 @@ import { Document, MetadataMode } from "@llamaindex/core/schema";
|
||||
import {
|
||||
metadataDictToNode,
|
||||
nodeToMetadata,
|
||||
} from "llamaindex/storage/vectorStore/utils";
|
||||
} from "llamaindex/vector-store/utils";
|
||||
import { beforeEach, describe, expect, test } from "vitest";
|
||||
|
||||
describe("Testing VectorStore utils", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { BaseNode } from "@llamaindex/core/schema";
|
||||
import { QdrantVectorStore } from "llamaindex/storage/index";
|
||||
import { QdrantVectorStore } from "llamaindex/vector-store";
|
||||
|
||||
export class TestableQdrantVectorStore extends QdrantVectorStore {
|
||||
public nodes: BaseNode[] = [];
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import type { Mocked } from "vitest";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
import { VectorStoreQueryMode } from "llamaindex/storage/index";
|
||||
import { VectorStoreQueryMode } from "llamaindex/vector-store";
|
||||
import { TestableQdrantVectorStore } from "../mocks/TestableQdrantVectorStore.js";
|
||||
|
||||
vi.mock("@qdrant/js-client-rest");
|
||||
Generated
+55
-18
@@ -152,7 +152,7 @@ importers:
|
||||
version: 2.4.6
|
||||
chromadb:
|
||||
specifier: ^1.8.1
|
||||
version: 1.8.1(@google/generative-ai@0.12.0)(cohere-ai@7.13.0(@aws-sdk/client-sso-oidc@3.637.0(@aws-sdk/client-sts@3.637.0))(encoding@0.1.13))(encoding@0.1.13)(openai@4.57.0(encoding@0.1.13)(zod@3.23.8))
|
||||
version: 1.8.1(@google/generative-ai@0.12.0)(cohere-ai@7.13.0(@aws-sdk/client-sso-oidc@3.637.0(@aws-sdk/client-sts@3.637.0))(encoding@0.1.13))(encoding@0.1.13)(openai@4.60.0(encoding@0.1.13)(zod@3.23.8))
|
||||
commander:
|
||||
specifier: ^12.1.0
|
||||
version: 12.1.0
|
||||
@@ -276,7 +276,7 @@ importers:
|
||||
version: 1.1.0(@types/react@18.3.5)(react@18.3.1)
|
||||
ai:
|
||||
specifier: ^3.3.21
|
||||
version: 3.3.21(openai@4.57.0(zod@3.23.8))(react@18.3.1)(sswr@2.1.0(svelte@4.2.19))(svelte@4.2.19)(vue@3.4.38(typescript@5.5.4))(zod@3.23.8)
|
||||
version: 3.3.21(openai@4.60.0(zod@3.23.8))(react@18.3.1)(sswr@2.1.0(svelte@4.2.19))(svelte@4.2.19)(vue@3.4.38(typescript@5.5.4))(zod@3.23.8)
|
||||
class-variance-authority:
|
||||
specifier: ^0.7.0
|
||||
version: 0.7.0
|
||||
@@ -554,7 +554,7 @@ importers:
|
||||
version: 4.7.0
|
||||
chromadb:
|
||||
specifier: 1.8.1
|
||||
version: 1.8.1(@google/generative-ai@0.12.0)(cohere-ai@7.13.0(@aws-sdk/client-sso-oidc@3.637.0(@aws-sdk/client-sts@3.637.0))(encoding@0.1.13))(encoding@0.1.13)(openai@4.57.0(encoding@0.1.13)(zod@3.23.8))
|
||||
version: 1.8.1(@google/generative-ai@0.12.0)(cohere-ai@7.13.0(@aws-sdk/client-sso-oidc@3.637.0(@aws-sdk/client-sts@3.637.0))(encoding@0.1.13))(encoding@0.1.13)(openai@4.60.0(encoding@0.1.13)(zod@3.23.8))
|
||||
cohere-ai:
|
||||
specifier: 7.13.0
|
||||
version: 7.13.0(@aws-sdk/client-sso-oidc@3.637.0(@aws-sdk/client-sts@3.637.0))(encoding@0.1.13)
|
||||
@@ -586,20 +586,14 @@ importers:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0(encoding@0.1.13)
|
||||
openai:
|
||||
specifier: ^4.57.0
|
||||
version: 4.57.0(encoding@0.1.13)(zod@3.23.8)
|
||||
specifier: ^4.60.0
|
||||
version: 4.60.0(encoding@0.1.13)(zod@3.23.8)
|
||||
papaparse:
|
||||
specifier: ^5.4.1
|
||||
version: 5.4.1
|
||||
pathe:
|
||||
specifier: ^1.1.2
|
||||
version: 1.1.2
|
||||
pg:
|
||||
specifier: ^8.12.0
|
||||
version: 8.12.0
|
||||
pgvector:
|
||||
specifier: ^0.2.0
|
||||
version: 0.2.0
|
||||
portkey-ai:
|
||||
specifier: 0.1.16
|
||||
version: 0.1.16
|
||||
@@ -643,6 +637,12 @@ importers:
|
||||
glob:
|
||||
specifier: ^11.0.0
|
||||
version: 11.0.0
|
||||
pg:
|
||||
specifier: ^8.12.0
|
||||
version: 8.12.0
|
||||
pgvector:
|
||||
specifier: 0.2.0
|
||||
version: 0.2.0
|
||||
typescript:
|
||||
specifier: ^5.5.4
|
||||
version: 5.5.4
|
||||
@@ -700,7 +700,7 @@ importers:
|
||||
dependencies:
|
||||
ai:
|
||||
specifier: ^3.3.21
|
||||
version: 3.3.21(openai@4.57.0(zod@3.23.8))(react@18.3.1)(sswr@2.1.0(svelte@4.2.19))(svelte@4.2.19)(vue@3.4.38(typescript@5.5.4))(zod@3.23.8)
|
||||
version: 3.3.21(openai@4.60.0(zod@3.23.8))(react@18.3.1)(sswr@2.1.0(svelte@4.2.19))(svelte@4.2.19)(vue@3.4.38(typescript@5.5.4))(zod@3.23.8)
|
||||
llamaindex:
|
||||
specifier: workspace:*
|
||||
version: link:../../..
|
||||
@@ -840,6 +840,9 @@ importers:
|
||||
typescript:
|
||||
specifier: 5.5.4
|
||||
version: 5.5.4
|
||||
vite-plugin-wasm:
|
||||
specifier: ^3.3.0
|
||||
version: 3.3.0(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))
|
||||
|
||||
packages/llamaindex/tests:
|
||||
devDependencies:
|
||||
@@ -8385,6 +8388,15 @@ packages:
|
||||
zod:
|
||||
optional: true
|
||||
|
||||
openai@4.60.0:
|
||||
resolution: {integrity: sha512-U/wNmrUPdfsvU1GrKRP5mY5YHR3ev6vtdfNID6Sauz+oquWD8r+cXPL1xiUlYniosPKajy33muVHhGS/9/t6KA==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
zod: ^3.23.8
|
||||
peerDependenciesMeta:
|
||||
zod:
|
||||
optional: true
|
||||
|
||||
opener@1.5.2:
|
||||
resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==}
|
||||
hasBin: true
|
||||
@@ -10689,6 +10701,11 @@ packages:
|
||||
engines: {node: ^18.0.0 || >=20.0.0}
|
||||
hasBin: true
|
||||
|
||||
vite-plugin-wasm@3.3.0:
|
||||
resolution: {integrity: sha512-tVhz6w+W9MVsOCHzxo6SSMSswCeIw4HTrXEi6qL3IRzATl83jl09JVO1djBqPSwfjgnpVHNLYcaMbaDX5WB/pg==}
|
||||
peerDependencies:
|
||||
vite: ^2 || ^3 || ^4 || ^5
|
||||
|
||||
vite@5.4.2:
|
||||
resolution: {integrity: sha512-dDrQTRHp5C1fTFzcSaMxjk6vdpKvT+2/mIdE07Gw2ykehT49O0z/VHS3zZ8iV/Gh8BJJKHWOe5RjaNrW5xf/GA==}
|
||||
engines: {node: ^18.0.0 || >=20.0.0}
|
||||
@@ -15958,7 +15975,7 @@ snapshots:
|
||||
clean-stack: 2.2.0
|
||||
indent-string: 4.0.0
|
||||
|
||||
ai@3.3.21(openai@4.57.0(zod@3.23.8))(react@18.3.1)(sswr@2.1.0(svelte@4.2.19))(svelte@4.2.19)(vue@3.4.38(typescript@5.5.4))(zod@3.23.8):
|
||||
ai@3.3.21(openai@4.60.0(zod@3.23.8))(react@18.3.1)(sswr@2.1.0(svelte@4.2.19))(svelte@4.2.19)(vue@3.4.38(typescript@5.5.4))(zod@3.23.8):
|
||||
dependencies:
|
||||
'@ai-sdk/provider': 0.0.22
|
||||
'@ai-sdk/provider-utils': 1.0.17(zod@3.23.8)
|
||||
@@ -15975,7 +15992,7 @@ snapshots:
|
||||
secure-json-parse: 2.7.0
|
||||
zod-to-json-schema: 3.23.2(zod@3.23.8)
|
||||
optionalDependencies:
|
||||
openai: 4.57.0(zod@3.23.8)
|
||||
openai: 4.60.0(zod@3.23.8)
|
||||
react: 18.3.1
|
||||
sswr: 2.1.0(svelte@4.2.19)
|
||||
svelte: 4.2.19
|
||||
@@ -16652,14 +16669,14 @@ snapshots:
|
||||
|
||||
chownr@2.0.0: {}
|
||||
|
||||
chromadb@1.8.1(@google/generative-ai@0.12.0)(cohere-ai@7.13.0(@aws-sdk/client-sso-oidc@3.637.0(@aws-sdk/client-sts@3.637.0))(encoding@0.1.13))(encoding@0.1.13)(openai@4.57.0(encoding@0.1.13)(zod@3.23.8)):
|
||||
chromadb@1.8.1(@google/generative-ai@0.12.0)(cohere-ai@7.13.0(@aws-sdk/client-sso-oidc@3.637.0(@aws-sdk/client-sts@3.637.0))(encoding@0.1.13))(encoding@0.1.13)(openai@4.60.0(encoding@0.1.13)(zod@3.23.8)):
|
||||
dependencies:
|
||||
cliui: 8.0.1
|
||||
isomorphic-fetch: 3.0.0(encoding@0.1.13)
|
||||
optionalDependencies:
|
||||
'@google/generative-ai': 0.12.0
|
||||
cohere-ai: 7.13.0(@aws-sdk/client-sso-oidc@3.637.0(@aws-sdk/client-sts@3.637.0))(encoding@0.1.13)
|
||||
openai: 4.57.0(encoding@0.1.13)(zod@3.23.8)
|
||||
openai: 4.60.0(encoding@0.1.13)(zod@3.23.8)
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
|
||||
@@ -20925,7 +20942,23 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
|
||||
openai@4.57.0(zod@3.23.8):
|
||||
openai@4.60.0(encoding@0.1.13)(zod@3.23.8):
|
||||
dependencies:
|
||||
'@types/node': 18.19.47
|
||||
'@types/node-fetch': 2.6.11
|
||||
'@types/qs': 6.9.15
|
||||
abort-controller: 3.0.0
|
||||
agentkeepalive: 4.5.0
|
||||
form-data-encoder: 1.7.2
|
||||
formdata-node: 4.4.1
|
||||
node-fetch: 2.7.0(encoding@0.1.13)
|
||||
qs: 6.13.0
|
||||
optionalDependencies:
|
||||
zod: 3.23.8
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
|
||||
openai@4.60.0(zod@3.23.8):
|
||||
dependencies:
|
||||
'@types/node': 18.19.47
|
||||
'@types/node-fetch': 2.6.11
|
||||
@@ -23350,7 +23383,7 @@ snapshots:
|
||||
|
||||
union@0.5.0:
|
||||
dependencies:
|
||||
qs: 6.11.2
|
||||
qs: 6.13.0
|
||||
|
||||
unique-string@3.0.0:
|
||||
dependencies:
|
||||
@@ -23532,6 +23565,10 @@ snapshots:
|
||||
- supports-color
|
||||
- terser
|
||||
|
||||
vite-plugin-wasm@3.3.0(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6)):
|
||||
dependencies:
|
||||
vite: 5.4.2(@types/node@22.5.1)(terser@5.31.6)
|
||||
|
||||
vite@5.4.2(@types/node@22.5.1)(terser@5.31.6):
|
||||
dependencies:
|
||||
esbuild: 0.21.5
|
||||
|
||||
Reference in New Issue
Block a user