Compare commits

...

14 Commits

Author SHA1 Message Date
github-actions[bot] fffe93fac8 Release 0.11.7 (#2013)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-06-12 10:34:24 +07:00
Marcus Schiesser dbd857f6b5 chore: add changeset 2025-06-11 16:20:32 +07:00
정물결 a4d394f727 fix: correct SimpleDirectoryReader import path (#2011) 2025-06-10 12:43:01 +07:00
Marcus Schiesser 3c857f4132 chore: move ajv to dev deps (#2012) 2025-06-10 12:20:54 +07:00
Thuc Pham 36cfb93eb2 feat: export snapshot apis from llama-flow (#2009) 2025-06-10 11:56:33 +07:00
github-actions[bot] ab4762f026 Release (#2005)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-06 14:45:39 +07:00
Peter Goldstein 56763dc57d Update to the latest Gemini 2.5 Pro Preview key (#2004) 2025-06-06 11:25:41 +07:00
github-actions[bot] 5375fdd704 Release (#2003)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-06-05 09:57:35 +07:00
Marcus Schiesser e7484efca5 feat: weaviate: Add metadata sanitization before adding node. Add err… (#2001) 2025-06-04 11:48:18 +07:00
Marcus Schiesser c958a1645a docs: update chat-ui (#2002) 2025-06-03 17:01:07 +07:00
github-actions[bot] 0140a257c4 Release 0.11.6 (#1999)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-06-02 18:03:31 +07:00
GhosT 40161fe8d2 chore: Bump @llama-flow/core package version (#1998)
Co-authored-by: Marcus Schiesser <marcus.schiesser@googlemail.com>
2025-06-02 17:28:47 +07:00
github-actions[bot] d883fe7351 Release @llamaindex/google@0.3.7 (#1994)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-31 14:04:14 +07:00
Parham Saidi 2bc6914784 fix: ignore empty parts for gemini which confuses agent (#1993) 2025-05-30 22:47:21 +07:00
46 changed files with 1177 additions and 243 deletions
+18
View File
@@ -1,5 +1,23 @@
# @llamaindex/doc
## 0.2.26
### Patch Changes
- a4d394f: fix: correct SimpleDirectoryReader import path in documentation example
- Updated dependencies [dbd857f]
- Updated dependencies [3c857f4]
- @llamaindex/workflow@1.1.8
- llamaindex@0.11.7
## 0.2.25
### Patch Changes
- Updated dependencies [40161fe]
- @llamaindex/workflow@1.1.7
- llamaindex@0.11.6
## 0.2.24
### Patch Changes
+14
View File
@@ -15,6 +15,20 @@ const config = {
"twoslash",
"typescript",
],
async redirects() {
return [
{
source: "/docs/chat-ui/:path*.mdx",
destination: "/docs/chat-ui/:path*",
permanent: true,
},
{
source: "/docs/llamaflow/:path*.mdx",
destination: "/docs/llamaflow/:path*",
permanent: true,
},
];
},
turbopack: {
resolveAlias: {
fs: { browser: "./fallback.js" },
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/doc",
"version": "0.2.24",
"version": "0.2.26",
"private": true,
"scripts": {
"postinstall": "fumadocs-mdx",
@@ -16,7 +16,7 @@
"@huggingface/transformers": "^3.5.0",
"@icons-pack/react-simple-icons": "^10.1.0",
"@llama-flow/docs": "0.0.8",
"@llamaindex/chat-ui-docs": "0.0.3",
"@llamaindex/chat-ui-docs": "^0.0.5",
"@llamaindex/cloud": "workspace:*",
"@llamaindex/core": "workspace:*",
"@llamaindex/node-parser": "workspace:*",
@@ -39,13 +39,13 @@
"clsx": "2.1.1",
"foxact": "^0.2.41",
"framer-motion": "^11.11.17",
"fumadocs-core": "^15.2.7",
"fumadocs-core": "^15.5.0",
"fumadocs-docgen": "^2.0.0",
"fumadocs-mdx": "^11.6.0",
"fumadocs-openapi": "^8.0.1",
"fumadocs-twoslash": "^3.1.1",
"fumadocs-typescript": "^4.0.2",
"fumadocs-ui": "^15.2.7",
"fumadocs-mdx": "^11.6.6",
"fumadocs-openapi": "^9.0.5",
"fumadocs-twoslash": "^3.1.3",
"fumadocs-typescript": "^4.0.5",
"fumadocs-ui": "^15.5.0",
"hast-util-to-jsx-runtime": "^2.3.2",
"llamaindex": "workspace:*",
"lucide-react": "^0.460.0",
+5
View File
@@ -13,6 +13,11 @@ export const docs = defineDocs({
"./src/content/docs",
"./node_modules/@llama-flow/docs",
"./node_modules/@llamaindex/chat-ui-docs",
// NOTE: When adding external docs (like chat-ui or llama-flow above),
// make sure to also update:
// 1. scripts/validate-links.mts - add to ALLOWED_LINKS array
// 2. next.config.mjs - add redirect for .mdx files
// 3. src/content/docs/meta.json - add to pages array
],
docs: {
async: true,
+2 -1
View File
@@ -113,7 +113,8 @@ export default function HomePage() {
description="Truly powerful retrieval-augmented generation applications use agentic techniques, and LlamaIndex.TS makes it easy to build them."
>
<CodeBlock
code={`import { SimpleDirectoryReader, VectorStoreIndex } from "llamaindex";
code={`import { VectorStoreIndex } from "llamaindex";
import { SimpleDirectoryReader } from "@llamaindex/readers/directory";
import { openai } from "@llamaindex/openai";
import { agent } from "@llamaindex/workflow";
@@ -1,5 +1,18 @@
# @llamaindex/cloudflare-worker-agent-test
## 0.0.168
### Patch Changes
- Updated dependencies [3c857f4]
- llamaindex@0.11.7
## 0.0.167
### Patch Changes
- llamaindex@0.11.6
## 0.0.166
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloudflare-worker-agent-test",
"version": "0.0.166",
"version": "0.0.168",
"type": "module",
"private": true,
"scripts": {
+13
View File
@@ -1,5 +1,18 @@
# @llamaindex/next-agent-test
## 0.1.168
### Patch Changes
- Updated dependencies [3c857f4]
- llamaindex@0.11.7
## 0.1.167
### Patch Changes
- llamaindex@0.11.6
## 0.1.166
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-agent-test",
"version": "0.1.166",
"version": "0.1.168",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,5 +1,18 @@
# test-edge-runtime
## 0.1.167
### Patch Changes
- Updated dependencies [3c857f4]
- llamaindex@0.11.7
## 0.1.166
### Patch Changes
- llamaindex@0.11.6
## 0.1.165
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/nextjs-edge-runtime-test",
"version": "0.1.165",
"version": "0.1.167",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,5 +1,18 @@
# @llamaindex/next-node-runtime
## 0.1.35
### Patch Changes
- Updated dependencies [3c857f4]
- llamaindex@0.11.7
## 0.1.34
### Patch Changes
- llamaindex@0.11.6
## 0.1.33
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-node-runtime-test",
"version": "0.1.33",
"version": "0.1.35",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,5 +1,18 @@
# vite-import-llamaindex
## 0.0.34
### Patch Changes
- Updated dependencies [3c857f4]
- llamaindex@0.11.7
## 0.0.33
### Patch Changes
- llamaindex@0.11.6
## 0.0.32
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "vite-import-llamaindex",
"private": true,
"version": "0.0.32",
"version": "0.0.34",
"type": "module",
"scripts": {
"build": "vite build",
@@ -1,5 +1,18 @@
# @llamaindex/waku-query-engine-test
## 0.0.168
### Patch Changes
- Updated dependencies [3c857f4]
- llamaindex@0.11.7
## 0.0.167
### Patch Changes
- llamaindex@0.11.6
## 0.0.166
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/waku-query-engine-test",
"version": "0.0.166",
"version": "0.0.168",
"type": "module",
"private": true,
"scripts": {
+17
View File
@@ -1,5 +1,22 @@
# examples
## 0.3.21
### Patch Changes
- Updated dependencies [dbd857f]
- Updated dependencies [3c857f4]
- @llamaindex/workflow@1.1.8
- llamaindex@0.11.7
- @llamaindex/tools@0.0.15
## 0.3.20
### Patch Changes
- Updated dependencies [e7484ef]
- @llamaindex/weaviate@0.0.24
## 0.3.19
### Patch Changes
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/examples",
"version": "0.3.19",
"version": "0.3.21",
"private": true,
"scripts": {
"lint": "eslint .",
@@ -48,13 +48,13 @@
"@llamaindex/replicate": "^0.0.51",
"@llamaindex/supabase": "^0.1.8",
"@llamaindex/together": "^0.0.19",
"@llamaindex/tools": "^0.0.14",
"@llamaindex/tools": "^0.0.15",
"@llamaindex/upstash": "^0.0.23",
"@llamaindex/vercel": "^0.1.9",
"@llamaindex/vllm": "^0.0.45",
"@llamaindex/voyage-ai": "^1.0.15",
"@llamaindex/weaviate": "^0.0.23",
"@llamaindex/workflow": "^1.1.6",
"@llamaindex/weaviate": "^0.0.24",
"@llamaindex/workflow": "^1.1.8",
"@llamaindex/xai": "workspace:^0.0.6",
"@notionhq/client": "^2.2.15",
"@pinecone-database/pinecone": "^4.0.0",
@@ -64,7 +64,7 @@
"commander": "^12.1.0",
"dotenv": "^16.4.5",
"js-tiktoken": "^1.0.14",
"llamaindex": "^0.11.5",
"llamaindex": "^0.11.7",
"mongodb": "6.7.0",
"postgres": "^3.4.4",
"wikipedia": "^2.1.2",
+13
View File
@@ -1,5 +1,18 @@
# @llamaindex/autotool
## 8.0.7
### Patch Changes
- Updated dependencies [3c857f4]
- llamaindex@0.11.7
## 8.0.6
### Patch Changes
- llamaindex@0.11.6
## 8.0.5
### Patch Changes
@@ -1,5 +1,20 @@
# @llamaindex/autotool-01-node-example
## 0.0.115
### Patch Changes
- Updated dependencies [3c857f4]
- llamaindex@0.11.7
- @llamaindex/autotool@8.0.7
## 0.0.114
### Patch Changes
- llamaindex@0.11.6
- @llamaindex/autotool@8.0.6
## 0.0.113
### Patch Changes
@@ -13,5 +13,5 @@
"scripts": {
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
},
"version": "0.0.113"
"version": "0.0.115"
}
+1 -1
View File
@@ -6,7 +6,7 @@
"url": "git+https://github.com/run-llama/LlamaIndexTS.git",
"directory": "packages/autotool"
},
"version": "8.0.5",
"version": "8.0.7",
"description": "auto transpile your JS function to LLM Agent compatible",
"files": [
"dist",
+13
View File
@@ -1,5 +1,18 @@
# @llamaindex/experimental
## 0.0.184
### Patch Changes
- Updated dependencies [3c857f4]
- llamaindex@0.11.7
## 0.0.183
### Patch Changes
- llamaindex@0.11.6
## 0.0.182
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/experimental",
"description": "Experimental package for LlamaIndexTS",
"version": "0.0.182",
"version": "0.0.184",
"type": "module",
"types": "dist/type/index.d.ts",
"main": "dist/cjs/index.js",
+15
View File
@@ -1,5 +1,20 @@
# llamaindex
## 0.11.7
### Patch Changes
- 3c857f4: chore: move ajv to dev deps
- Updated dependencies [dbd857f]
- @llamaindex/workflow@1.1.8
## 0.11.6
### Patch Changes
- Updated dependencies [40161fe]
- @llamaindex/workflow@1.1.7
## 0.11.5
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "llamaindex",
"version": "0.11.5",
"version": "0.11.7",
"license": "MIT",
"type": "module",
"keywords": [
@@ -24,14 +24,14 @@
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"@llamaindex/node-parser": "workspace:*",
"@llamaindex/workflow": "1.1.6",
"@llamaindex/workflow": "workspace:*",
"@types/lodash": "^4.17.7",
"@types/node": "^22.9.0",
"ajv": "^8.17.1",
"lodash": "^4.17.21",
"magic-bytes.js": "^1.10.0"
},
"devDependencies": {
"ajv": "^8.17.1",
"@types/node": "^22.9.0"
},
"engines": {
+12
View File
@@ -1,5 +1,17 @@
# @llamaindex/google
## 0.3.8
### Patch Changes
- 56763dc: Update to the latest Gemini 2.5 Pro Preview key
## 0.3.7
### Patch Changes
- 2bc6914: fix: ignore empty parts for gemini which confuses agent
## 0.3.6
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/google",
"description": "Google Adapter for LlamaIndex",
"version": "0.3.6",
"version": "0.3.8",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
+32 -20
View File
@@ -25,6 +25,7 @@ import { streamConverter } from "@llamaindex/core/utils";
import { wrapLLMEvent } from "@llamaindex/core/decorator";
import type { JSONObject } from "@llamaindex/core/global";
import { randomUUID } from "@llamaindex/env";
import { DEFAULT_GEMINI_PARAMS, SUPPORT_TOOL_CALL_MODELS } from "../base";
import type { GEMINI_MODEL } from "../types";
import {
@@ -117,7 +118,7 @@ export class GoogleStudio extends ToolCallLLM<GoogleAdditionalChatOptions> {
getToolCallsFromResponse(response: GenerateContentResponse): ToolCall[] {
if (!response.functionCalls) return [];
return response.functionCalls.map((call) => ({
id: call.id ?? "",
id: call.id ?? randomUUID(),
name: call.name ?? "",
input: call.args as JSONObject,
}));
@@ -170,6 +171,35 @@ export class GoogleStudio extends ToolCallLLM<GoogleAdditionalChatOptions> {
};
}
async *reduceStream(
stream: AsyncGenerator<GenerateContentResponse>,
): AsyncIterable<ChatResponseChunk> {
for await (const response of stream) {
if (response.functionCalls?.length) {
const toolCalls = this.getToolCallsFromResponse(response) as ToolCall[];
yield {
delta: "",
raw: response,
options: { toolCall: toolCalls },
} as ChatResponseChunk;
}
const text = response.candidates
?.flatMap((candidate) => candidate.content?.parts)
.map((part) => part?.text ?? "")
.filter((text) => text)
.join("");
if (!text) continue;
yield {
delta: text,
raw: response,
options: {
inlineData: getGoogleStudioInlineData(response),
},
} as ChatResponseChunk;
}
}
protected async *streamChat(
params: GoogleChatParamsStreaming,
): GoogleChatStreamResponse {
@@ -190,25 +220,7 @@ export class GoogleStudio extends ToolCallLLM<GoogleAdditionalChatOptions> {
contents: mapChatMessagesToGoogleMessages(params.messages),
config,
});
yield* streamConverter(response, (response) => {
if (response.functionCalls?.length) {
return {
delta: "",
raw: response,
options: {
toolCall: this.getToolCallsFromResponse(response),
},
};
}
return {
delta: response.text ?? "",
raw: response,
options: {
inlineData: getGoogleStudioInlineData(response),
},
};
});
yield* this.reduceStream(response);
}
chat(params: GoogleChatParamsStreaming): Promise<GoogleChatStreamResponse>;
+1 -1
View File
@@ -75,7 +75,7 @@ export enum GEMINI_MODEL {
GEMINI_2_0_PRO_EXPERIMENTAL = "gemini-2.0-pro-exp-02-05",
GEMINI_2_0_FLASH_LIVE = "gemini-2.0-flash-live-001",
GEMINI_2_5_PRO_PREVIEW = "gemini-2.5-pro-preview-03-25",
GEMINI_2_5_PRO_PREVIEW_LATEST = "gemini-2.5-pro-preview-05-06",
GEMINI_2_5_PRO_PREVIEW_LATEST = "gemini-2.5-pro-preview-06-05",
GEMINI_2_5_FLASH_PREVIEW = "gemini-2.5-flash-preview-05-20",
}
@@ -1,5 +1,11 @@
# @llamaindex/weaviate
## 0.0.24
### Patch Changes
- e7484ef: Add metadata sanitization before adding node. Add error handling
## 0.0.23
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/weaviate",
"description": "Weaviate Storage for LlamaIndex",
"version": "0.0.23",
"version": "0.0.24",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -35,11 +35,13 @@
},
"scripts": {
"build": "bunchee",
"dev": "bunchee --watch"
"dev": "bunchee --watch",
"test": "vitest run"
},
"devDependencies": {
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*"
"@llamaindex/env": "workspace:*",
"vitest": "^3.2.0"
},
"peerDependencies": {
"@llamaindex/core": "workspace:*",
@@ -23,6 +23,7 @@ import {
} from "@llamaindex/core/vector-store";
import { getEnv } from "@llamaindex/env";
import type { BaseHybridOptions } from "weaviate-client";
import { sanitizeMetadata } from "./sanitize";
const NODE_SCHEMA = [
{
@@ -119,6 +120,7 @@ const toWeaviateFilter = (
export class WeaviateVectorStore extends BaseVectorStore {
public storesText: boolean = true;
private flatMetadata: boolean = true;
private sanitizeMetadata: boolean = true;
private weaviateClient?: WeaviateClient;
private clusterURL!: string;
@@ -142,6 +144,7 @@ export class WeaviateVectorStore extends BaseVectorStore {
contentKey?: string;
metadataKey?: string;
embeddingKey?: string;
sanitizeMetadata?: boolean;
},
) {
super(init);
@@ -169,6 +172,7 @@ export class WeaviateVectorStore extends BaseVectorStore {
this.contentKey = init?.contentKey ?? "text";
this.embeddingKey = init?.embeddingKey ?? "vectors";
this.metadataKey = init?.metadataKey ?? "node_info";
this.sanitizeMetadata = init?.sanitizeMetadata ?? true;
}
public client() {
@@ -186,11 +190,14 @@ export class WeaviateVectorStore extends BaseVectorStore {
this.contentKey,
this.flatMetadata,
);
const processedMetadata = this.sanitizeMetadata
? sanitizeMetadata(metadata)
: metadata;
const body = {
[this.idKey]: node.id_,
[this.embeddingKey]: node.getEmbedding(),
properties: {
...metadata,
...processedMetadata,
[this.contentKey]: node.getContent(MetadataMode.NONE),
[this.metadataKey]: JSON.stringify(metadata),
relationships: JSON.stringify({ ref_doc_id: metadata.ref_doc_id }),
@@ -200,6 +207,15 @@ export class WeaviateVectorStore extends BaseVectorStore {
}),
);
if (result.hasErrors) {
const errorMessages = Object.values(result.errors)
.map((error) => error.message)
.join("; ");
throw new Error(
`Failed to add nodes to Weaviate: ${errorMessages}. If the error is related to metadata, try calling sanitizeMetadata on your data before adding it to the vector store.`,
);
}
return Object.values(result.uuids);
}
@@ -1 +1,2 @@
export * from "./sanitize";
export * from "./WeaviateVectorStore";
@@ -0,0 +1,44 @@
/**
* Sanitize all keys in a metadata object to conform to Weaviate naming requirements
*/
export const sanitizeMetadata = <T extends Record<string, unknown>>(
metadata: T,
): Record<string, T[keyof T]> => {
const sanitized: Record<string, T[keyof T]> = {};
for (const [key, value] of Object.entries(metadata)) {
const sanitizedKey = sanitizePropertyName(key);
if (sanitizedKey !== key) {
console.warn(
`Weaviate metadata property name "${key}" was sanitized to "${sanitizedKey}" to comply with GraphQL naming requirements.`,
);
}
sanitized[sanitizedKey] = value as T[keyof T];
}
return sanitized;
}; /**
* Sanitize property names to conform to Weaviate's GraphQL naming requirements.
* Names must match the pattern [_A-Za-z][_0-9A-Za-z]*
*/
const sanitizePropertyName = (name: string): string => {
// Replace invalid characters with underscores
let sanitized = name.replace(/[^_A-Za-z0-9]/g, "_");
// Ensure it starts with a letter or underscore
if (!/^[_A-Za-z]/.test(sanitized)) {
sanitized = "_" + sanitized;
}
// Remove consecutive underscores
sanitized = sanitized.replace(/_+/g, "_");
// Remove trailing underscores
sanitized = sanitized.replace(/_+$/, "");
// Ensure it's not empty
if (!sanitized) {
sanitized = "_property";
}
return sanitized;
};
@@ -0,0 +1,33 @@
import { Settings } from "@llamaindex/core/global";
import { vi } from "vitest";
// Mock embedding model
export const mockEmbedding = {
getTextEmbedding: vi.fn(() => Promise.resolve([0.1, 0.2, 0.3])),
getTextEmbeddings: vi.fn(() => Promise.resolve([[0.1, 0.2, 0.3]])),
};
// Mock weaviate collection
export const mockCollection = {
data: {
insertMany: vi.fn(),
},
config: {
get: vi.fn(() => Promise.resolve({ properties: [] })),
},
};
// Mock weaviate client
export const mockClient = {
collections: {
exists: vi.fn(() => Promise.resolve(true)),
get: vi.fn(() => mockCollection),
createFromSchema: vi.fn(() => Promise.resolve(mockCollection)),
},
};
// Setup embedding model for tests
export const setupMockEmbedding = () => {
(Settings as unknown as { embedModel: typeof mockEmbedding }).embedModel =
mockEmbedding;
};
@@ -0,0 +1,125 @@
import { Document } from "@llamaindex/core/schema";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { WeaviateVectorStore } from "../src/WeaviateVectorStore";
import {
mockClient,
mockCollection,
setupMockEmbedding,
} from "./mocks/weaviate.mocks";
// Mock the weaviate-client module
vi.mock("weaviate-client", () => {
return {
default: {
connectToWeaviateCloud: vi.fn(() => Promise.resolve(mockClient)),
ApiKey: vi.fn(),
},
connectToWeaviateCloud: vi.fn(() => Promise.resolve(mockClient)),
ApiKey: vi.fn(),
};
});
describe("sanitize", () => {
// Shared test data
const testCloudOptions = {
clusterURL: "https://test-cluster.weaviate.network",
apiKey: "test-api-key",
};
const testDocument = new Document({
text: "This is a test document for embedding.",
metadata: {
source: "whatever",
"hyphenated-column-name": "foobar", // Invalid GraphQL property name
},
embedding: [0.1, 0.2, 0.3],
});
beforeEach(() => {
vi.clearAllMocks();
// Set up embedding model for tests
setupMockEmbedding();
});
describe("metadata property name sanitization", () => {
it("should throw Weaviate error when sanitization is disabled and property names are invalid", async () => {
// Setup mock to return an error for invalid property names
mockCollection.data.insertMany.mockResolvedValue({
hasErrors: true,
errors: {
"0": {
message:
"'hyphenated-column-name' is not a valid nested property name of 'metadata'. NestedProperty names in Weaviate are restricted to valid GraphQL names, which must be \"/[_A-Za-z][_0-9A-Za-z]*/\".",
},
},
uuids: {},
});
const vectorStore = new WeaviateVectorStore({
cloudOptions: testCloudOptions,
sanitizeMetadata: false,
});
await expect(vectorStore.add([testDocument])).rejects.toThrow(
"Failed to add nodes to Weaviate",
);
});
it("should automatically sanitize invalid property names when sanitization is enabled", async () => {
// Setup mock to return success
mockCollection.data.insertMany.mockResolvedValue({
hasErrors: false,
errors: {},
uuids: { "0": "test-uuid-1" },
});
const vectorStore = new WeaviateVectorStore({
cloudOptions: testCloudOptions,
sanitizeMetadata: true,
});
const result = await vectorStore.add([testDocument]);
// Verify that insertMany was called with sanitized metadata
expect(mockCollection.data.insertMany).toHaveBeenCalledWith([
expect.objectContaining({
properties: expect.objectContaining({
// The hyphenated key should be sanitized to use underscores
hyphenated_column_name: "foobar",
source: "whatever",
text: "This is a test document for embedding.",
}),
}),
]);
expect(result).toEqual(["test-uuid-1"]);
});
it("should sanitize property names by default when sanitizeMetadata option is not specified", async () => {
// Setup mock to return success
mockCollection.data.insertMany.mockResolvedValue({
hasErrors: false,
errors: {},
uuids: { "0": "test-uuid-1" },
});
const vectorStore = new WeaviateVectorStore({
cloudOptions: testCloudOptions,
// sanitizeMetadata not specified, should default to true
});
await vectorStore.add([testDocument]);
// Verify that insertMany was called with sanitized metadata (default behavior)
expect(mockCollection.data.insertMany).toHaveBeenCalledWith([
expect.objectContaining({
properties: expect.objectContaining({
hyphenated_column_name: "foobar", // sanitized
source: "whatever",
text: "This is a test document for embedding.",
}),
}),
]);
});
});
});
+6
View File
@@ -1,5 +1,11 @@
# @llamaindex/tools
## 0.0.15
### Patch Changes
- 3c857f4: chore: move ajv to dev deps
## 0.0.14
### Patch Changes
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/tools",
"description": "LlamaIndex Tools",
"version": "0.0.14",
"version": "0.0.15",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -37,7 +37,8 @@
"@types/papaparse": "^5.3.15",
"vitest": "^2.1.5",
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*"
"@llamaindex/env": "workspace:*",
"ajv": "^8.12.0"
},
"peerDependencies": {
"@llamaindex/core": "workspace:*",
@@ -47,7 +48,6 @@
"@apidevtools/swagger-parser": "^10.1.0",
"@e2b/code-interpreter": "^1.0.4",
"@modelcontextprotocol/sdk": "^1.8.0",
"ajv": "^8.12.0",
"duck-duck-scrape": "^2.2.5",
"formdata-node": "^6.0.3",
"got": "^14.4.1",
+12
View File
@@ -1,5 +1,17 @@
# @llamaindex/workflow
## 1.1.8
### Patch Changes
- dbd857f: feat: export snapshot apis from llama-flow
## 1.1.7
### Patch Changes
- 40161fe: chore: Bump @llama-flow/core package version
## 1.1.6
### Patch Changes
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/workflow",
"description": "Workflow API",
"version": "1.1.6",
"version": "1.1.8",
"type": "module",
"types": "dist/index.d.ts",
"module": "dist/index.js",
@@ -48,6 +48,6 @@
"zod": "^3.23.8"
},
"dependencies": {
"@llama-flow/core": "^0.4.1"
"@llama-flow/core": "^0.4.3"
}
}
+1
View File
@@ -1,4 +1,5 @@
export * from "@llama-flow/core";
export * from "@llama-flow/core/middleware/snapshot";
export * from "@llama-flow/core/middleware/state";
export * from "@llama-flow/core/stream/run";
export * from "./agent/index.js";
+643 -185
View File
File diff suppressed because it is too large Load Diff
+17
View File
@@ -1,5 +1,22 @@
# @llamaindex/unit-test
## 0.1.35
### Patch Changes
- Updated dependencies [dbd857f]
- Updated dependencies [3c857f4]
- @llamaindex/workflow@1.1.8
- llamaindex@0.11.7
## 0.1.34
### Patch Changes
- Updated dependencies [40161fe]
- @llamaindex/workflow@1.1.7
- llamaindex@0.11.6
## 0.1.33
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/unit-test",
"private": true,
"version": "0.1.33",
"version": "0.1.35",
"type": "module",
"scripts": {
"test": "vitest run"