Skip to content

Conversation

@thucpn
Copy link
Collaborator

@thucpn thucpn commented Sep 4, 2025

@llamaindex/core

  • use zod 4 as deps, also provide zod utils
  • can parse/safe-parse both zod v3 and zod v4 schemas from user
  • can convert zod schema (both zod v3 and zod v4) to json schema
  • update FunctionTool to allow accept both zod v3 and zod v4

@llamaindex/openai & @llamaindex/ollama

  • can use zod 3 or zod 4 schemas as response format

@llamaindex/tools

  • use exported zod from core package (then no need zod as peer anymore)

@llamaindex/workflow

  • fix ZodEvent typing issue (happened in main branch also)
  • use new zodToJsonSchema to be able to convert handoff tool
  • use exported zod from core package

@llamaindex/vercel

  • bump ai to version 5 and @ai-sdk/openai to latest to compatible with zod4
  • use exported zod from core package

Related issue: (should be fixed after merging this PR)

Sandbox to try
https://stackblitz.com/~/github.com/thucpn/zod-llamaindex-sandbox

@changeset-bot
Copy link

changeset-bot bot commented Sep 4, 2025

🦋 Changeset detected

Latest commit: ddcf963

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 62 packages
Name Type
@llamaindex/core Patch
@llamaindex/tools Patch
@llamaindex/workflow Patch
@llamaindex/ollama Patch
@llamaindex/openai Patch
@llamaindex/vercel Patch
@llamaindex/unit-test Patch
@llamaindex/doc Patch
@llamaindex/cloud Patch
@llamaindex/community Patch
llamaindex Patch
@llamaindex/node-parser Patch
@llamaindex/readers Patch
@llamaindex/anthropic Patch
@llamaindex/assemblyai Patch
@llamaindex/aws Patch
@llamaindex/clip Patch
@llamaindex/cohere Patch
@llamaindex/deepinfra Patch
@llamaindex/discord Patch
@llamaindex/excel Patch
@llamaindex/google Patch
@llamaindex/huggingface Patch
@llamaindex/jinaai Patch
@llamaindex/mistral Patch
@llamaindex/mixedbread Patch
@llamaindex/notion Patch
@llamaindex/perplexity Patch
@llamaindex/portkey-ai Patch
@llamaindex/replicate Patch
@llamaindex/voyage-ai Patch
@llamaindex/astra Patch
@llamaindex/azure Patch
@llamaindex/chroma Patch
@llamaindex/elastic-search Patch
@llamaindex/firestore Patch
@llamaindex/milvus Patch
@llamaindex/mongodb Patch
@llamaindex/pinecone Patch
@llamaindex/postgres Patch
@llamaindex/qdrant Patch
@llamaindex/supabase Patch
@llamaindex/upstash Patch
@llamaindex/weaviate Patch
@llamaindex/bm25-retriever Patch
@llamaindex/deepseek Patch
@llamaindex/fireworks Patch
@llamaindex/groq Patch
@llamaindex/together Patch
@llamaindex/vllm Patch
@llamaindex/xai Patch
@llamaindex/llamaindex-test Patch
@llamaindex/llama-parse-browser-test Patch
@llamaindex/cloudflare-worker-agent-test Patch
@llamaindex/next-agent-test Patch
@llamaindex/nextjs-edge-runtime-test Patch
@llamaindex/next-node-runtime-test Patch
vite-import-llamaindex Patch
@llamaindex/waku-query-engine-test Patch
@llamaindex/autotool Patch
@llamaindex/experimental Patch
@llamaindex/autotool-01-node-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Sep 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
llamaindex-ts-doc Ready Ready Preview Comment Sep 10, 2025 2:31pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 4, 2025

Open in StackBlitz

@llamaindex/autotool

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/autotool@2186

@llamaindex/cloud

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/cloud@2186

@llamaindex/community

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/community@2186

@llamaindex/core

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/core@2186

@llamaindex/env

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/env@2186

@llamaindex/experimental

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/experimental@2186

llamaindex

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/llamaindex@2186

@llamaindex/node-parser

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/node-parser@2186

@llamaindex/readers

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/readers@2186

@llamaindex/tools

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/tools@2186

@llamaindex/wasm-tools

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/wasm-tools@2186

@llamaindex/workflow

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/workflow@2186

@llamaindex/anthropic

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/anthropic@2186

@llamaindex/assemblyai

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/assemblyai@2186

@llamaindex/aws

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/aws@2186

@llamaindex/clip

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/clip@2186

@llamaindex/cohere

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/cohere@2186

@llamaindex/deepinfra

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/deepinfra@2186

@llamaindex/deepseek

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/deepseek@2186

@llamaindex/discord

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/discord@2186

@llamaindex/excel

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/excel@2186

@llamaindex/fireworks

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/fireworks@2186

@llamaindex/google

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/google@2186

@llamaindex/groq

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/groq@2186

@llamaindex/huggingface

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/huggingface@2186

@llamaindex/jinaai

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/jinaai@2186

@llamaindex/mistral

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/mistral@2186

@llamaindex/mixedbread

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/mixedbread@2186

@llamaindex/notion

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/notion@2186

@llamaindex/ollama

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/ollama@2186

@llamaindex/openai

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/openai@2186

@llamaindex/perplexity

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/perplexity@2186

@llamaindex/portkey-ai

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/portkey-ai@2186

@llamaindex/replicate

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/replicate@2186

@llamaindex/together

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/together@2186

@llamaindex/vercel

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/vercel@2186

@llamaindex/vllm

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/vllm@2186

@llamaindex/voyage-ai

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/voyage-ai@2186

@llamaindex/xai

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/xai@2186

@llamaindex/astra

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/astra@2186

@llamaindex/azure

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/azure@2186

@llamaindex/chroma

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/chroma@2186

@llamaindex/elastic-search

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/elastic-search@2186

@llamaindex/firestore

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/firestore@2186

@llamaindex/milvus

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/milvus@2186

@llamaindex/mongodb

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/mongodb@2186

@llamaindex/pinecone

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/pinecone@2186

@llamaindex/postgres

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/postgres@2186

@llamaindex/qdrant

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/qdrant@2186

@llamaindex/supabase

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/supabase@2186

@llamaindex/upstash

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/upstash@2186

@llamaindex/weaviate

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/weaviate@2186

commit: ddcf963

@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
dist/LlamaIndexImportTest.js 508.03 KB (+0.98% 🔺) 10.2 s (+0.98% 🔺) 2 s (+22.65% 🔺) 12.1 s

@thucpn thucpn marked this pull request as ready for review September 10, 2025 12:30
@thucpn thucpn changed the title chore: support zod v4 & v3 feat: support zod v4 & v3 Sep 10, 2025
done
- name: Install
run: npm add ${{ runner.temp }}/*.tgz
run: npm add ${{ runner.temp }}/*.tgz --legacy-peer-deps
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use --legacy-peer-deps to temporarily fix peer conflict caused by the old @llamaindex/cloud when checking type in example (Run npm add /home/runner/work/_temp/*.tgz)

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @llama-flow/core@0.4.4
npm error Found: zod@4.1.5
npm error node_modules/zod
npm error   zod@"^4.1.5" from the root project
npm error   peer zod@"^3.25.76 || ^4" from @ai-sdk/openai@2.0.27
npm error   node_modules/@ai-sdk/openai
npm error     @ai-sdk/openai@"^2.0.27" from the root project
npm error   3 more (@llamaindex/core, ai, @ai-sdk/provider-utils)
npm error
npm error Could not resolve dependency:
npm error peerOptional zod@"^3.24.2" from @llama-flow/core@0.4.4
npm error node_modules/@llama-flow/core
npm error   peer @llama-flow/core@"^0.4.1" from @llamaindex/cloud@4.1.2
npm error   node_modules/@llamaindex/cloud
npm error     @llamaindex/cloud@"file:../llamaindex-cloud-4.1.2.tgz" from the root project
npm error     1 more (llamaindex)
npm error
npm error Conflicting peer dependency: zod@3.25.76
npm error node_modules/zod
npm error   peerOptional zod@"^3.24.2" from @llama-flow/core@0.4.4
npm error   node_modules/@llama-flow/core
npm error     peer @llama-flow/core@"^0.4.1" from @llamaindex/cloud@4.1.2
npm error     node_modules/@llamaindex/cloud
npm error       @llamaindex/cloud@"file:../llamaindex-cloud-4.1.2.tgz" from the root project
npm error       1 more (llamaindex)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed after #2145 is merged

Copy link
Collaborator

@marcusschiesser marcusschiesser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job!

@marcusschiesser marcusschiesser merged commit 5da1cda into main Sep 11, 2025
25 checks passed
@marcusschiesser marcusschiesser deleted the feat/zodv4 branch September 11, 2025 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants