Compare commits

..

7 Commits

Author SHA1 Message Date
Adrian Lyjak 71f30242eb include total 2025-07-12 01:34:11 -04:00
Adrian Lyjak f6447bbb49 fix docs build for agent data 2025-07-11 23:17:35 -04:00
Adrian Lyjak 9b0477f268 Adjust agent data types
- Updates ExtractedData to match python type declarations
- Updates client interface to more closely align python implementation
- Updates some incorrect types
- Removes agent-data/extract API. That isn't an existing thing
- Move to beta namespace to reflect instability
2025-07-11 21:19:13 +00:00
NIEDASEN af3f86694b feat: add supportToolCall getter to DeepSeekLLM class (#2085)
Co-authored-by: Marcus Schiesser <marcus.schiesser@googlemail.com>
2025-07-11 16:11:22 +08:00
github-actions[bot] 5cce681f62 Release 0.11.15 (#2084)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-10 19:08:05 -07:00
Alex Yang 48b0d88941 chore: bump dev deps (#2082) 2025-07-10 19:00:37 -07:00
Alex Yang f18577263a fix(cloud): missing file (#2083) 2025-07-10 18:33:41 -07:00
60 changed files with 2412 additions and 2422 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@llamaindex/cloud": patch
---
Bug fixes for new beta agent-data cloud API
+5
View File
@@ -0,0 +1,5 @@
---
"@llamaindex/deepseek": patch
---
feat: add supportToolCall getter to DeepSeekLLM class
+9
View File
@@ -1,5 +1,14 @@
# @llamaindex/doc
## 0.2.36
### Patch Changes
- Updated dependencies [48b0d88]
- Updated dependencies [f185772]
- @llamaindex/cloud@4.0.20
- llamaindex@0.11.15
## 0.2.35
### Patch Changes
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/doc",
"version": "0.2.35",
"version": "0.2.36",
"private": true,
"scripts": {
"postinstall": "fumadocs-mdx",
@@ -76,21 +76,21 @@
"@next/env": "^15.3.0",
"@tailwindcss/postcss": "^4.0.9",
"@types/mdx": "^2.0.13",
"@types/node": "22.9.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"@types/node": "24.0.13",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"autoprefixer": "^10.4.20",
"cross-env": "^7.0.3",
"fast-glob": "^3.3.2",
"gray-matter": "^4.0.3",
"postcss": "^8.5.3",
"postcss": "^8.5.6",
"raw-loader": "^4.0.2",
"remark": "^15.0.1",
"remark-gfm": "^4.0.0",
"remark-mdx": "^3.1.0",
"remark-stringify": "^11.0.0",
"tailwindcss": "^4.0.9",
"tsx": "^4.19.3",
"tailwindcss": "^4.1.11",
"tsx": "^4.20.3",
"typedoc": "0.28.3",
"typedoc-plugin-markdown": "^4.6.2",
"typedoc-plugin-merge-modules": " ^7.0.0",
@@ -21,7 +21,7 @@ Where as the `llamaindex` package is working with Next.js, some provider package
Make sure to use `withLlamaIndex` to make sure that LlamaIndex.TS works well with Next.js.
```js
```javascript
// next.config.mjs / next.config.ts
import withLlamaIndex from "llamaindex/next";
@@ -15,7 +15,7 @@ npm i @langtrase/typescript-sdk
## Initialize
```js
```javascript
import * as Langtrace from "@langtrase/typescript-sdk";
Langtrace.init({ api_key: "<YOUR_API_KEY>" });
```
@@ -12,7 +12,7 @@ LLM applications. It connects to [all major observability platforms](https://www
npm i @traceloop/node-server-sdk
```
```js
```javascript
import * as traceloop from "@traceloop/node-server-sdk";
traceloop.initialize({
@@ -175,7 +175,7 @@ Try it out ⬇️
And also update the `next.config.js` to make `@llamaindex/env` work properly.
```js
```javascript
const config = {
webpack: (config) => {
if (Array.isArray(config.target) && config.target.includes('web')) {
+1
View File
@@ -6,6 +6,7 @@
],
"exclude": [
"../../packages/autotool/**/src/index.ts",
"../../packages/cloud/src/beta/**",
"**/node_modules/**",
"**/dist/**",
"**/test/**",
@@ -1,5 +1,11 @@
# @llamaindex/cloudflare-worker-agent-test
## 0.0.176
### Patch Changes
- llamaindex@0.11.15
## 0.0.175
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloudflare-worker-agent-test",
"version": "0.0.175",
"version": "0.0.176",
"type": "module",
"private": true,
"scripts": {
@@ -1,5 +1,13 @@
# @llamaindex/llama-parse-browser-test
## 0.0.75
### Patch Changes
- Updated dependencies [48b0d88]
- Updated dependencies [f185772]
- @llamaindex/cloud@4.0.20
## 0.0.74
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/llama-parse-browser-test",
"private": true,
"version": "0.0.74",
"version": "0.0.75",
"type": "module",
"scripts": {
"dev": "vite",
+6
View File
@@ -1,5 +1,11 @@
# @llamaindex/next-agent-test
## 0.1.176
### Patch Changes
- llamaindex@0.11.15
## 0.1.175
### Patch Changes
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-agent-test",
"version": "0.1.175",
"version": "0.1.176",
"private": true,
"scripts": {
"dev": "next dev",
@@ -15,11 +15,11 @@
"react-dom": "19.0.0"
},
"devDependencies": {
"@types/node": "^22.9.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"eslint": "9.16.0",
"eslint-config-next": "15.1.0",
"@types/node": "^24.0.13",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"eslint": "9.30.1",
"eslint-config-next": "15.3.5",
"typescript": "^5.8.3"
}
}
@@ -1,5 +1,11 @@
# test-edge-runtime
## 0.1.175
### Patch Changes
- llamaindex@0.11.15
## 0.1.174
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/nextjs-edge-runtime-test",
"version": "0.1.174",
"version": "0.1.175",
"private": true,
"scripts": {
"dev": "next dev",
@@ -14,9 +14,9 @@
"react-dom": "^19.1.0"
},
"devDependencies": {
"@types/node": "^22.9.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"@types/node": "^24.0.13",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"typescript": "^5.8.3"
}
}
@@ -1,5 +1,11 @@
# @llamaindex/next-node-runtime
## 0.1.44
### Patch Changes
- llamaindex@0.11.15
## 0.1.43
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-node-runtime-test",
"version": "0.1.43",
"version": "0.1.44",
"private": true,
"scripts": {
"dev": "next dev",
@@ -16,11 +16,11 @@
"react-dom": "19.0.0"
},
"devDependencies": {
"@types/node": "^22.9.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"eslint": "9.16.0",
"eslint-config-next": "15.1.0",
"@types/node": "^24.0.13",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"eslint": "9.30.1",
"eslint-config-next": "15.3.5",
"typescript": "^5.8.3"
}
}
@@ -1,5 +1,11 @@
# vite-import-llamaindex
## 0.0.42
### Patch Changes
- llamaindex@0.11.15
## 0.0.41
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "vite-import-llamaindex",
"private": true,
"version": "0.0.41",
"version": "0.0.42",
"type": "module",
"scripts": {
"build": "vite build",
@@ -1,5 +1,11 @@
# @llamaindex/waku-query-engine-test
## 0.0.176
### Patch Changes
- llamaindex@0.11.15
## 0.0.175
### Patch Changes
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/waku-query-engine-test",
"version": "0.0.175",
"version": "0.0.176",
"type": "module",
"private": true,
"scripts": {
@@ -18,10 +18,10 @@
},
"devDependencies": {
"@tailwindcss/postcss": "^4.1.4",
"@types/react": "19.0.10",
"@types/react-dom": "19.0.4",
"@types/react": "19.1.8",
"@types/react-dom": "19.1.6",
"rollup": "4.38.0",
"tailwindcss": "^4.1.4",
"tailwindcss": "^4.1.11",
"typescript": "5.8.3"
}
}
+3 -3
View File
@@ -19,14 +19,14 @@
"@llamaindex/openai": "workspace:*",
"@llamaindex/pinecone": "workspace:*",
"@llamaindex/postgres": "workspace:*",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"@types/pg": "^8.11.8",
"consola": "^3.2.3",
"dotenv": "^16.4.5",
"dotenv": "^17.2.0",
"llamaindex": "workspace:*",
"pg": "^8.12.0",
"pgvector": "0.2.0",
"tsx": "^4.19.3",
"tsx": "^4.20.3",
"zod": "^3.25.76"
}
}
@@ -15,15 +15,15 @@
},
"devDependencies": {
"@eslint/js": "^9.25.0",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.5.2",
"eslint": "^9.25.0",
"eslint": "^9.30.1",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.19",
"globals": "^16.0.0",
"typescript": "~5.8.3",
"typescript-eslint": "^8.30.1",
"typescript-eslint": "^8.36.0",
"vite": "^6.3.5"
}
}
+3 -3
View File
@@ -63,7 +63,7 @@
"ai": "^4.3.17",
"ajv": "^8.17.1",
"commander": "^12.1.0",
"dotenv": "^16.4.5",
"dotenv": "^17.2.0",
"js-tiktoken": "^1.0.14",
"llamaindex": "^0.11.14",
"mongodb": "6.7.0",
@@ -72,8 +72,8 @@
"zod": "^3.25.76"
},
"devDependencies": {
"@types/node": "^22.9.0",
"tsx": "^4.19.3",
"@types/node": "^24.0.13",
"tsx": "^4.20.3",
"typescript": "^5.8.3"
},
"stackblitz": {
+2
View File
@@ -0,0 +1,2 @@
packages:
- "**"
+3 -2
View File
@@ -23,11 +23,12 @@
"@llamaindex/cloud": "workspace:* || ^2.0.24",
"@llamaindex/excel": "workspace:*",
"@llamaindex/readers": "workspace:* || ^1.0.25",
"@notionhq/client": "^4.0.0",
"llamaindex": "workspace:* || ^0.8.37"
},
"devDependencies": {
"@types/node": "^22.9.0",
"tsx": "^4.19.3",
"@types/node": "^24.0.13",
"tsx": "^4.20.3",
"typescript": "^5.8.3"
}
}
+7 -7
View File
@@ -23,12 +23,12 @@
"@changesets/cli": "^2.27.5",
"@eslint/js": "^9.25.0",
"bunchee": "6.4.0",
"eslint": "9.22.0",
"eslint-config-next": "^15.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^2.3.3",
"eslint-plugin-react": "7.37.2",
"eslint-plugin-turbo": "^2.5.0",
"eslint": "9.30.1",
"eslint-config-next": "^15.3.5",
"eslint-config-prettier": "^10.1.5",
"eslint-config-turbo": "^2.5.4",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-turbo": "^2.5.4",
"globals": "^15.12.0",
"husky": "^9.1.7",
"lint-staged": "^15.2.11",
@@ -38,7 +38,7 @@
"prettier-plugin-tailwindcss": "^0.6.11",
"turbo": "^2.4.4",
"typescript": "^5.8.3",
"typescript-eslint": "^8.18.0",
"typescript-eslint": "^8.36.0",
"vitest": "^3.1.1"
},
"packageManager": "pnpm@10.8.1",
+6
View File
@@ -1,5 +1,11 @@
# @llamaindex/autotool
## 8.0.15
### Patch Changes
- llamaindex@0.11.15
## 8.0.14
### Patch Changes
@@ -1,5 +1,12 @@
# @llamaindex/autotool-01-node-example
## 0.0.123
### Patch Changes
- llamaindex@0.11.15
- @llamaindex/autotool@8.0.15
## 0.0.122
### Patch Changes
@@ -8,10 +8,10 @@
"openai": "^4.73.1"
},
"devDependencies": {
"tsx": "^4.19.3"
"tsx": "^4.20.3"
},
"scripts": {
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
},
"version": "0.0.122"
"version": "0.0.123"
}
+3 -3
View File
@@ -6,7 +6,7 @@
"url": "git+https://github.com/run-llama/LlamaIndexTS.git",
"directory": "packages/autotool"
},
"version": "8.0.14",
"version": "8.0.15",
"description": "auto transpile your JS function to LLM Agent compatible",
"files": [
"dist",
@@ -74,11 +74,11 @@
"devDependencies": {
"@swc/types": "^0.1.12",
"@types/json-schema": "^7.0.15",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"llamaindex": "workspace:*",
"next": "^15.3.3",
"rollup": "^4.28.1",
"tsx": "^4.19.3",
"tsx": "^4.20.3",
"typescript": "^5.8.3",
"vitest": "^2.1.5",
"webpack": "^5.97.1"
+7
View File
@@ -1,5 +1,12 @@
# @llamaindex/cloud
## 4.0.20
### Patch Changes
- 48b0d88: fix: exports in `api` submodule
- f185772: fix(cloud): missing file
## 4.0.19
### Patch Changes
+10 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloud",
"version": "4.0.19",
"version": "4.0.20",
"type": "module",
"license": "MIT",
"scripts": {
@@ -11,20 +11,22 @@
"files": [
"openapi.json",
"./api",
"./reader"
"./reader",
"./parse",
"./beta/agent"
],
"exports": {
"./openapi.json": "./openapi.json",
"./agent": {
"./beta/agent": {
"require": {
"types": "./agent/dist/index.d.cts",
"default": "./agent/dist/index.cjs"
"types": "./beta/agent/dist/index.d.cts",
"default": "./beta/agent/dist/index.cjs"
},
"import": {
"types": "./agent/dist/index.d.ts",
"default": "./agent/dist/index.js"
"types": "./beta/agent/dist/index.d.ts",
"default": "./beta/agent/dist/index.js"
},
"default": "./agent/dist/index.js"
"default": "./beta/agent/dist/index.js"
},
"./api": {
"require": {
-291
View File
@@ -1,291 +0,0 @@
import { createClient, createConfig } from "@hey-api/client-fetch";
import { getEnv } from "@llamaindex/env";
import pRetry from "p-retry";
import {
createAgentDataApiV1BetaAgentDataPost,
deleteAgentDataApiV1BetaAgentDataItemIdDelete,
getAgentDataApiV1BetaAgentDataItemIdGet,
searchAgentDataApiV1BetaAgentDataSearchPost,
updateAgentDataApiV1BetaAgentDataItemIdPut,
type AgentData,
} from "../client";
import type {
CreateAgentDataOptions,
ExtractedData,
ExtractOptions,
ListAgentDataOptions,
TypedAgentData,
TypedAgentDataItems,
UpdateAgentDataOptions,
} from "./types";
/**
* Async client for agent data operations
*/
export class AgentClient {
private client: ReturnType<typeof createClient>;
private baseUrl: string;
private headers: Record<string, string>;
constructor(options?: { apiKey?: string; baseUrl?: string }) {
const apiKey = options?.apiKey || getEnv("LLAMA_CLOUD_API_KEY");
this.baseUrl = options?.baseUrl || "https://api.cloud.llamaindex.ai/";
this.headers = {
"X-SDK-Name": "llamaindex-ts",
...(apiKey && { Authorization: `Bearer ${apiKey}` }),
};
this.client = createClient(
createConfig({
baseUrl: this.baseUrl,
headers: this.headers,
}),
);
}
/**
* Create new agent data
*/
async create<T = unknown>(
options: CreateAgentDataOptions<T>,
): Promise<TypedAgentData<T>> {
const response = await createAgentDataApiV1BetaAgentDataPost({
throwOnError: true,
body: {
agent_slug: options.agentSlug,
...(options.collection !== undefined && {
collection: options.collection,
}),
data: options.data as Record<string, unknown>,
},
client: this.client,
});
return this.transformResponse(response.data);
}
/**
* Get agent data by ID
*/
async get<T = unknown>(id: string): Promise<TypedAgentData<T> | null> {
try {
const response = await getAgentDataApiV1BetaAgentDataItemIdGet({
throwOnError: true,
path: { item_id: id },
client: this.client,
});
return this.transformResponse(response.data);
} catch (error) {
if (
error instanceof Error &&
"response" in error &&
(error as { response?: { status?: number } }).response?.status === 404
) {
return null;
}
throw error;
}
}
/**
* Update agent data
*/
async update<T = unknown>(
id: string,
options: UpdateAgentDataOptions<T>,
): Promise<TypedAgentData<T>> {
const response = await updateAgentDataApiV1BetaAgentDataItemIdPut({
throwOnError: true,
path: { item_id: id },
body: {
data: options.data as Record<string, unknown>,
},
client: this.client,
});
return this.transformResponse(response.data);
}
/**
* Delete agent data
*/
async delete(id: string): Promise<void> {
await deleteAgentDataApiV1BetaAgentDataItemIdDelete({
throwOnError: true,
path: { item_id: id },
client: this.client,
});
}
/**
* List agent data
*/
async list<T = unknown>(
options: ListAgentDataOptions,
): Promise<TypedAgentDataItems<T>> {
const response = await searchAgentDataApiV1BetaAgentDataSearchPost({
throwOnError: true,
body: {
agent_slug: options.agentSlug,
...(options.collection !== undefined && {
collection: options.collection,
}),
...(options.filter !== undefined && { filter: options.filter }),
...(options.orderBy !== undefined && { order_by: options.orderBy }),
...(options.pageSize !== undefined && { page_size: options.pageSize }),
...(options.pageToken !== undefined && {
page_token: options.pageToken,
}),
...(options.offset !== undefined && { offset: options.offset }),
},
client: this.client,
});
const result: TypedAgentDataItems<T> = {
items: response.data.items.map((item: AgentData) =>
this.transformResponse(item),
),
};
if (
response.data.total_size !== null &&
response.data.total_size !== undefined
) {
result.totalSize = response.data.total_size;
}
if (
response.data.next_page_token !== null &&
response.data.next_page_token !== undefined
) {
result.nextPageToken = response.data.next_page_token;
}
return result;
}
/**
* Extract data from agent with retry logic
*/
async extract<T = unknown>(
agentId: string,
input: unknown,
options?: ExtractOptions,
): Promise<ExtractedData<T>> {
const extractOptions = {
retries: options?.retryCount || 3,
onFailedAttempt: (error: {
attemptNumber: number;
retriesLeft: number;
}) => {
console.log(
`Extraction attempt ${error.attemptNumber} failed. ${error.retriesLeft} retries left.`,
);
},
minTimeout: options?.retryDelay || 1000,
maxTimeout: options?.timeout || 30000,
};
return pRetry(async () => {
// Note: The extract endpoint might not be in the generated client yet
// Using the native fetch API for this endpoint
const response = await fetch(
`${this.baseUrl}/api/v1/beta/agent-data/${agentId}/extract`,
{
method: "POST",
body: JSON.stringify({ input }),
headers: {
"Content-Type": "application/json",
...this.headers,
},
},
);
if (!response.ok) {
throw new Error(`Failed to extract data: ${response.statusText}`);
}
const extractedData = (await response.json()) as ExtractedData<T>;
// If status is still pending or in progress, poll for completion
if (
extractedData.status === "pending" ||
extractedData.status === "in_progress"
) {
return this.pollExtraction<T>(extractedData.id, options);
}
return extractedData;
}, extractOptions);
}
/**
* Poll for extraction completion
*/
private async pollExtraction<T = unknown>(
extractionId: string,
options?: ExtractOptions,
): Promise<ExtractedData<T>> {
const pollInterval = 2000; // 2 seconds
const maxAttempts = Math.floor((options?.timeout || 30000) / pollInterval);
for (let i = 0; i < maxAttempts; i++) {
await new Promise((resolve) => setTimeout(resolve, pollInterval));
const response = await fetch(
`${this.baseUrl}/api/v1/extractions/${extractionId}`,
{
headers: this.headers,
},
);
if (!response.ok) {
throw new Error(
`Failed to get extraction status: ${response.statusText}`,
);
}
const extractedData = (await response.json()) as ExtractedData<T>;
if (
extractedData.status === "completed" ||
extractedData.status === "failed"
) {
return extractedData;
}
}
throw new Error("Extraction timeout exceeded");
}
/**
* Transform API response to typed data
*/
private transformResponse<T = unknown>(data: AgentData): TypedAgentData<T> {
const result: TypedAgentData<T> = {
id: data.id!,
agentSlug: data.agent_slug,
data: data.data as T,
createdAt: new Date(data.created_at!),
updatedAt: new Date(data.updated_at!),
};
if (data.collection !== undefined) {
result.collection = data.collection;
}
return result;
}
}
/**
* Create a new AsyncAgentDataClient instance
*/
export function createAgentDataClient(options?: {
apiKey?: string;
baseUrl?: string;
}): AgentClient {
return new AgentClient(options);
}
-98
View File
@@ -1,98 +0,0 @@
/**
* Status types for agent data processing
*/
export enum StatusType {
PENDING = "pending",
IN_PROGRESS = "in_progress",
COMPLETED = "completed",
FAILED = "failed",
}
/**
* Filter operation for searching/filtering agent data
*/
export interface FilterOperation {
[key: string]: unknown;
}
/**
* Base extracted data interface
*/
export interface ExtractedData<T = unknown> {
id: string;
status: StatusType;
data?: T;
error?: string;
createdAt: Date;
updatedAt: Date;
}
/**
* TypedAgentData interface for typed agent data
*/
export interface TypedAgentData<T = unknown> {
id: string;
agentSlug: string;
collection?: string;
data: T;
createdAt: Date;
updatedAt: Date;
}
/**
* Collection of typed agent data items
*/
export interface TypedAgentDataItems<T = unknown> {
items: TypedAgentData<T>[];
totalSize?: number;
nextPageToken?: string;
}
/**
* Options for creating agent data
*/
export interface CreateAgentDataOptions<T = unknown> {
agentSlug: string;
collection?: string;
data: T;
}
/**
* Options for updating agent data
*/
export interface UpdateAgentDataOptions<T = unknown> {
data: T;
}
/**
* Sort options for listing
*/
export interface SortOptions {
field: string;
order: "asc" | "desc";
}
/**
* Options for listing agent data
*/
export interface ListAgentDataOptions {
agentSlug: string;
collection?: string;
filter?: Record<string, FilterOperation>;
orderBy?: string;
pageSize?: number;
pageToken?: string;
offset?: number;
}
/**
* Options for extraction
*/
export interface ExtractOptions {
timeout?: number;
retryCount?: number;
retryDelay?: number;
}
export type ExtractedT<T> = T;
export type AgentDataT<T> = T;
-16
View File
@@ -7,21 +7,5 @@ client.setConfig({
},
});
export {
AgentClient,
createAgentDataClient,
StatusTypeEnum,
type AgentDataT,
type CreateAgentDataOptions,
type ExtractedData,
type ExtractedT,
type ExtractOptions,
type ListAgentDataOptions,
type SortOptions,
type StatusType,
type TypedAgentData,
type TypedAgentDataItems,
type UpdateAgentDataOptions,
} from "./agent";
export * from "./client";
export { client };
+314
View File
@@ -0,0 +1,314 @@
import { createClient, createConfig } from "@hey-api/client-fetch";
import { getEnv } from "@llamaindex/env";
import {
aggregateAgentDataApiV1BetaAgentDataAggregatePost,
createAgentDataApiV1BetaAgentDataPost,
deleteAgentDataApiV1BetaAgentDataItemIdDelete,
getAgentDataApiV1BetaAgentDataItemIdGet,
searchAgentDataApiV1BetaAgentDataSearchPost,
updateAgentDataApiV1BetaAgentDataItemIdPut,
type AgentData,
type AggregateGroup,
} from "../../client";
import type {
AggregateAgentDataOptions,
SearchAgentDataOptions,
TypedAgentData,
TypedAgentDataItems,
TypedAggregateGroup,
TypedAggregateGroupItems,
} from "./types";
/**
* Async client for agent data operations
*/
export class AgentClient<T = unknown> {
private client: ReturnType<typeof createClient>;
private baseUrl: string;
private headers: Record<string, string>;
private collection: string;
private agentUrlId: string;
constructor({
apiKey = getEnv("LLAMA_CLOUD_API_KEY"),
baseUrl = "https://api.cloud.llamaindex.ai/",
collection = "default",
agentUrlId = "default",
}: {
apiKey?: string;
baseUrl?: string;
collection?: string;
agentUrlId?: string;
}) {
this.baseUrl = baseUrl;
this.headers = {
"X-SDK-Name": "llamaindex-ts",
...(apiKey && { Authorization: `Bearer ${apiKey}` }),
};
this.client = createClient(
createConfig({
baseUrl: this.baseUrl,
headers: this.headers,
}),
);
this.collection = collection;
this.agentUrlId = agentUrlId;
}
/**
* Create new agent data
*/
async createItem(data: T): Promise<TypedAgentData<T>> {
const response = await createAgentDataApiV1BetaAgentDataPost({
throwOnError: true,
body: {
agent_slug: this.agentUrlId,
collection: this.collection,
data: data as Record<string, unknown>,
},
client: this.client,
});
return this.transformResponse(response.data);
}
/**
* Get agent data by ID
*/
async getItem(id: string): Promise<TypedAgentData<T> | null> {
try {
const response = await getAgentDataApiV1BetaAgentDataItemIdGet({
throwOnError: true,
path: { item_id: id },
client: this.client,
});
return this.transformResponse(response.data);
} catch (error) {
if (
error instanceof Error &&
"response" in error &&
(error as { response?: { status?: number } }).response?.status === 404
) {
return null;
}
throw error;
}
}
/**
* Update agent data
*/
async updateItem(id: string, data: T): Promise<TypedAgentData<T>> {
const response = await updateAgentDataApiV1BetaAgentDataItemIdPut({
throwOnError: true,
path: { item_id: id },
body: {
data: data as Record<string, unknown>,
},
client: this.client,
});
return this.transformResponse(response.data);
}
/**
* Delete agent data
*/
async deleteItem(id: string): Promise<void> {
await deleteAgentDataApiV1BetaAgentDataItemIdDelete({
throwOnError: true,
path: { item_id: id },
client: this.client,
});
}
/**
* List agent data
*/
async search(
options: SearchAgentDataOptions,
): Promise<TypedAgentDataItems<T>> {
const response = await searchAgentDataApiV1BetaAgentDataSearchPost({
throwOnError: true,
body: {
agent_slug: this.agentUrlId,
...(this.collection !== undefined && {
collection: this.collection,
}),
...(options.filter !== undefined && { filter: options.filter }),
...(options.orderBy !== undefined && { order_by: options.orderBy }),
...(options.pageSize !== undefined && { page_size: options.pageSize }),
...(options.offset !== undefined && { offset: options.offset }),
...(options.includeTotal !== undefined && {
include_total: options.includeTotal,
}),
},
client: this.client,
});
const result: TypedAgentDataItems<T> = {
items: response.data.items.map((item: AgentData) =>
this.transformResponse(item),
),
};
if (
response.data.total_size !== null &&
response.data.total_size !== undefined
) {
result.totalSize = response.data.total_size;
}
if (
response.data.next_page_token !== null &&
response.data.next_page_token !== undefined
) {
result.nextPageToken = response.data.next_page_token;
}
return result;
}
/**
* Aggregate agent data into groups
*/
async aggregate(
options: AggregateAgentDataOptions,
): Promise<TypedAggregateGroupItems<T>> {
const response = await aggregateAgentDataApiV1BetaAgentDataAggregatePost({
throwOnError: true,
body: {
agent_slug: this.agentUrlId,
...(this.collection !== undefined && {
collection: this.collection,
}),
...(options.filter !== undefined && { filter: options.filter }),
...(options.groupBy !== undefined && { group_by: options.groupBy }),
...(options.count !== undefined && { count: options.count }),
...(options.first !== undefined && { first: options.first }),
...(options.orderBy !== undefined && { order_by: options.orderBy }),
...(options.offset !== undefined && { offset: options.offset }),
...(options.pageSize !== undefined && { page_size: options.pageSize }),
},
client: this.client,
});
const result: TypedAggregateGroupItems<T> = {
items: response.data.items.map((item) =>
this.transformAggregateResponse(item),
),
};
if (
response.data.total_size !== null &&
response.data.total_size !== undefined
) {
result.totalSize = response.data.total_size;
}
if (
response.data.next_page_token !== null &&
response.data.next_page_token !== undefined
) {
result.nextPageToken = response.data.next_page_token;
}
return result;
}
/**
* Transform API response to typed data
*/
private transformResponse(data: AgentData): TypedAgentData<T> {
const result: TypedAgentData<T> = {
id: data.id!,
agentUrlId: data.agent_slug,
data: data.data as T,
createdAt: new Date(data.created_at!),
updatedAt: new Date(data.updated_at!),
};
if (data.collection !== undefined) {
result.collection = data.collection;
}
return result;
}
/**
* Transform API aggregate response to typed data
*/
private transformAggregateResponse(
data: AggregateGroup,
): TypedAggregateGroup<T> {
const result: TypedAggregateGroup<T> = {
groupKey: data.group_key,
};
if (data.count !== null && data.count !== undefined) {
result.count = data.count;
}
if (data.first_item !== null && data.first_item !== undefined) {
result.firstItem = data.first_item as T;
}
return result;
}
}
export interface AgentDataClientOptions<T = unknown> {
/** API key for the client */
apiKey?: string;
/** Base URL for the client */
/** Base URL of the llama cloud api */
baseUrl?: string;
/** If running in an agent runtime, optionally provide the window url to infer the agent url id */
windowUrl?: string;
/** Agent URL ID for the client, if not provided, it will be inferred from the window url, or fall back to "default" */
agentUrlId?: string;
/** Collection name for the client, defaults to "default" */
collection?: string;
}
/**
* Create a new AsyncAgentDataClient instance
* @param options - The options for the client
* @returns A new AgentClient instance
*/
export function createAgentDataClient<T = unknown>({
apiKey,
baseUrl,
windowUrl,
agentUrlId,
collection = "default",
}: {
apiKey?: string;
baseUrl?: string;
windowUrl?: string;
agentUrlId?: string;
collection?: string;
} = {}): AgentClient<T> {
if (windowUrl && !agentUrlId) {
try {
const path = new URL(windowUrl).pathname;
// /deployments/<agent-url-id>/ui/ -> ["", "deployments", "<agent-url-id>", "ui"]
agentUrlId = path.split("/")[2];
} catch (error) {
console.warn(
"Failed to infer agent url id from window url, falling back to default",
error,
);
}
}
return new AgentClient({
...(apiKey && { apiKey }),
...(baseUrl && { baseUrl }),
...(agentUrlId && { agentUrlId }),
collection,
});
}
@@ -1,18 +1,16 @@
export { AgentClient, createAgentDataClient } from "./client";
export type {
AgentDataT,
CreateAgentDataOptions,
ExtractOptions,
AggregateAgentDataOptions,
ComparisonOperator,
ExtractedData,
ExtractedT,
FilterOperation,
ListAgentDataOptions,
SortOptions,
SearchAgentDataOptions,
StatusType,
TypedAgentData,
TypedAgentDataItems,
UpdateAgentDataOptions,
TypedAggregateGroup,
TypedAggregateGroupItems,
} from "./types";
export { StatusType as StatusTypeEnum } from "./types";
+138
View File
@@ -0,0 +1,138 @@
import type { FilterOperation as RawFilterOperation } from "../../client/types.gen";
/**
* Status types for agent data processing
*/
export const StatusType = {
ERROR: "error",
ACCEPTED: "accepted",
REJECTED: "rejected",
PENDING_REVIEW: "pending_review",
} as const;
export type StatusType = (typeof StatusType)[keyof typeof StatusType];
export const ComparisonOperator = {
GT: "gt",
GTE: "gte",
LT: "lt",
LTE: "lte",
EQ: "eq",
INCLUDES: "includes",
} as const;
export type ComparisonOperator =
(typeof ComparisonOperator)[keyof typeof ComparisonOperator];
/**
* Filter operation for searching/filtering agent data
*/
export type FilterOperation = RawFilterOperation;
/**
* Base extracted data interface
*/
export interface ExtractedData<T = unknown> {
/** The original data that was extracted from the document. For tracking changes. Should not be updated. */
original_data: T;
/** The latest state of the data. Will differ if data has been updated. */
data?: T;
/** The status of the extracted data. Prefer to use the StatusType values, but any string is allowed. */
status: StatusType | string;
/** Confidence scores, if any, for each primitive field in the original_data data. */
confidence?: Record<string, unknown>;
/** The ID of the file that was used to extract the data. */
file_id?: string;
/** The name of the file that was used to extract the data. */
file_name?: string;
/** The hash of the file that was used to extract the data. */
file_hash?: string;
/** Additional metadata about the extracted data, such as errors, tokens, etc. */
metadata?: Record<string, unknown>;
}
/**
* TypedAgentData interface for typed agent data
*/
export interface TypedAgentData<T = unknown> {
/** The unique ID of the agent data record. */
id: string;
/** The ID of the agent that created the data. */
agentUrlId: string;
/** The collection of the agent data. */
collection?: string;
/** The data of the agent data. Usually an ExtractedData&lt;SomeOtherType&gt; */
data: T;
/** The date and time the data was created. */
createdAt: Date;
/** The date and time the data was last updated. */
updatedAt: Date;
}
/**
* Paginated response of typed agent data items
*/
export interface TypedAgentDataItems<T = unknown> {
items: TypedAgentData<T>[];
totalSize?: number;
nextPageToken?: string;
}
/**
* Options for listing agent data
*/
export interface SearchAgentDataOptions {
/** Filter options for the list. */
filter?: Record<string, FilterOperation>;
/** Order by options for the list. */
orderBy?: string;
/** Page size for the list. */
pageSize?: number;
/** Offset for the list. */
offset?: number;
/**
* Whether to include the total number of items in the response.
* Should use only for first request to build total pagination, and not subsequent requests.
*/
includeTotal?: boolean;
}
/**
* Options for aggregating agent data
*/
export interface AggregateAgentDataOptions {
/** Filter options for the aggregation. */
filter?: Record<string, FilterOperation>;
/** Fields to group by. */
groupBy?: string[];
/** Whether to count the number of items in each group. */
count?: boolean;
/** Whether to return the first item in each group. */
first?: boolean;
/** Order by options for the aggregation. */
orderBy?: string;
/** Offset for the aggregation. */
offset?: number;
/** Page size for the aggregation. */
pageSize?: number;
}
/**
* Single aggregation group result
*/
export interface TypedAggregateGroup<T = unknown> {
/** The group key values */
groupKey: Record<string, unknown>;
/** Count of items in the group */
count?: number;
/** First item in the group */
firstItem?: T;
}
/**
* Paginated response of aggregated agent data
*/
export interface TypedAggregateGroupItems<T = unknown> {
items: TypedAggregateGroup<T>[];
totalSize?: number;
nextPageToken?: string;
}
+1 -1
View File
@@ -310,7 +310,7 @@
},
"dependencies": {
"@llamaindex/env": "workspace:*",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"magic-bytes.js": "^1.10.0",
"zod": "^3.25.76",
"zod-to-json-schema": "^3.24.6"
+3 -3
View File
@@ -117,14 +117,14 @@
},
"devDependencies": {
"@huggingface/transformers": "^3.5.0",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"@types/readable-stream": "^4.0.15",
"vitest": "^2.1.5"
},
"dependencies": {
"pathe": "^1.1.2",
"@aws-crypto/sha256-js": "^5.2.0",
"js-tiktoken": "^1.0.12"
"js-tiktoken": "^1.0.12",
"pathe": "^1.1.2"
},
"peerDependencies": {
"@huggingface/transformers": "^3.5.0",
+6
View File
@@ -1,5 +1,11 @@
# @llamaindex/experimental
## 0.0.192
### Patch Changes
- llamaindex@0.11.15
## 0.0.191
### Patch Changes
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/experimental",
"description": "Experimental package for LlamaIndexTS",
"version": "0.0.191",
"version": "0.0.192",
"type": "module",
"types": "dist/type/index.d.ts",
"main": "dist/cjs/index.js",
@@ -62,7 +62,7 @@
},
"dependencies": {
"@types/lodash": "^4.17.7",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"jsonpath": "^1.1.1",
"llamaindex": "workspace:*",
"lodash": "^4.17.21"
+8
View File
@@ -1,5 +1,13 @@
# llamaindex
## 0.11.15
### Patch Changes
- Updated dependencies [48b0d88]
- Updated dependencies [f185772]
- @llamaindex/cloud@4.0.20
## 0.11.14
### Patch Changes
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "llamaindex",
"version": "0.11.14",
"version": "0.11.15",
"license": "MIT",
"type": "module",
"keywords": [
@@ -26,13 +26,13 @@
"@llamaindex/node-parser": "workspace:*",
"@llamaindex/workflow": "workspace:*",
"@types/lodash": "^4.17.7",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"lodash": "^4.17.21",
"magic-bytes.js": "^1.10.0"
},
"devDependencies": {
"ajv": "^8.17.1",
"@types/node": "^22.9.0"
"@types/node": "^22.9.0",
"ajv": "^8.17.1"
},
"engines": {
"node": ">=18.0.0"
+1 -1
View File
@@ -42,7 +42,7 @@
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"@types/html-to-text": "^9.0.4",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"tree-sitter": "^0.22.1",
"web-tree-sitter": "^0.24.4"
},
+1 -1
View File
@@ -44,7 +44,7 @@
"devDependencies": {
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"@types/node": "^22.9.0"
"@types/node": "^24.0.13"
},
"dependencies": {
"@aws-sdk/client-bedrock-agent-runtime": "^3.706.0",
+4
View File
@@ -34,6 +34,10 @@ export class DeepSeekLLM extends OpenAI {
...rest,
});
}
get supportToolCall() {
return true;
}
}
/**
@@ -57,11 +57,11 @@
"test": "vitest run"
},
"devDependencies": {
"dotenv": "^16.4.7",
"vitest": "^2.1.5",
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"@types/node": "^22.9.0"
"@types/node": "^24.0.13",
"dotenv": "^17.2.0",
"vitest": "^2.1.5"
},
"peerDependencies": {
"@llamaindex/core": "workspace:*",
@@ -72,7 +72,7 @@
"@azure/identity": "^4.4.1",
"@azure/search-documents": "^12.1.0",
"@llamaindex/openai": "workspace:*",
"openai": "^4.90.0",
"mongodb": "^6.7.0"
"mongodb": "^6.7.0",
"openai": "^4.90.0"
}
}
+1 -1
View File
@@ -167,7 +167,7 @@
"devDependencies": {
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"p-limit": "^6.1.0",
"string-strip-html": "^13.4.8"
},
+1 -1
View File
@@ -35,7 +35,7 @@
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"@modelcontextprotocol/server-filesystem": "^2025.7.1",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"@types/papaparse": "^5.3.15",
"ajv": "^8.12.0",
"vitest": "^2.1.5"
+1 -1
View File
@@ -5,7 +5,7 @@
"type": "module",
"dependencies": {
"@assemblyscript/loader": "^0.27.31",
"@types/node": "^22.9.0"
"@types/node": "^24.0.13"
},
"devDependencies": {
"@swc/cli": "^0.5.0",
+1 -1
View File
@@ -39,7 +39,7 @@
"devDependencies": {
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"vitest": "^2.1.5"
},
"peerDependencies": {
+1748 -1919
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -18,7 +18,7 @@
"devDependencies": {
"@llamaindex/openai": "workspace:*",
"@llamaindex/workflow": "workspace:*",
"@types/node": "^22.9.0",
"@types/node": "^24.0.13",
"llamaindex": "workspace:*",
"zod": "^3.25.76"
}
+9
View File
@@ -1,5 +1,14 @@
# @llamaindex/unit-test
## 0.1.44
### Patch Changes
- Updated dependencies [48b0d88]
- Updated dependencies [f185772]
- @llamaindex/cloud@4.0.20
- llamaindex@0.11.15
## 0.1.43
### Patch Changes
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/unit-test",
"private": true,
"version": "0.1.43",
"version": "0.1.44",
"type": "module",
"scripts": {
"test": "vitest run"
@@ -9,8 +9,8 @@
"devDependencies": {
"@azure/cosmos": "^4.1.1",
"@faker-js/faker": "^9.2.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"msw": "^2.6.5",
"vitest": "^2.1.5"
},