Compare commits

..

4 Commits

Author SHA1 Message Date
Marcus Schiesser fb093ac578 Update .changeset/brown-roses-smash.md 2025-05-05 16:03:46 +07:00
leehuwuj 4a8c29746d relock 2025-05-05 15:45:25 +07:00
leehuwuj 15bbddf451 chore: add changeset for bumping llama-flow to version 0.4.1 2025-05-05 15:43:47 +07:00
leehuwuj 9a788f35ee chore: update @llama-flow/core to version 0.4.1 and export additional stream functionality 2025-05-05 15:41:33 +07:00
66 changed files with 390 additions and 541 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@llamaindex/workflow": patch
---
Bump llama-flow@0.4.1
+6
View File
@@ -0,0 +1,6 @@
---
"@llamaindex/cloud": patch
"llamaindex": patch
---
feat: bump llama cloud sdk
+5
View File
@@ -0,0 +1,5 @@
---
"@llamaindex/workflow": minor
---
Update workflows to llama-flow syntax
+6
View File
@@ -0,0 +1,6 @@
---
"@llamaindex/resolution-tests": patch
"llamaindex": patch
---
fix: node10 module resolution fail in sub llamaindex packages
-13
View File
@@ -1,18 +1,5 @@
# @llamaindex/doc
## 0.2.16
### Patch Changes
- Updated dependencies [7e8e454]
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [bc53342]
- Updated dependencies [41953a3]
- @llamaindex/workflow@1.1.0
- @llamaindex/cloud@4.0.5
- llamaindex@0.10.4
## 0.2.15
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/doc",
"version": "0.2.16",
"version": "0.2.15",
"private": true,
"scripts": {
"postinstall": "fumadocs-mdx",
+3 -4
View File
@@ -26,7 +26,7 @@ const llm = openai();
const response = await llm.chat({
messages: [{ content: "Tell me a joke.", role: "user" }],
});`,
`import { agent } from "@llamaindex/workflow";
`import { agent } from "llamaindex";
import { openai } from "@llamaindex/openai";
const analyseAgent = agent({
@@ -36,7 +36,7 @@ const analyseAgent = agent({
});
const response = await analyseAgent.run(\`Analyse the given data:
\${data}\`);`,
`import { agent, multiAgent } from "@llamaindex/workflow";
`import { agent, multiAgent } from "llamaindex";
import { openai } from "@llamaindex/openai";
const analyseAgent = agent({
@@ -113,9 +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 { agent, SimpleDirectoryReader, VectorStoreIndex } from "llamaindex";
import { openai } from "@llamaindex/openai";
import { agent } from "@llamaindex/workflow";
// load documents from current directoy into an index
const reader = new SimpleDirectoryReader();
@@ -9,10 +9,10 @@ To install llamaindex, run the following command:
npm i llamaindex
```
In most cases, you'll also need an LLM package and the Workflow package to use LlamaIndex. For example, to use the OpenAI LLM with agents, you would install the following:
In most cases, you'll also need an LLM package to use LlamaIndex. For example, to use the OpenAI LLM, you would install the following:
```package-install
npm i @llamaindex/openai @llamaindex/workflow
npm i @llamaindex/openai
```
Go to [LLM APIs](/docs/llamaindex/modules/models/llms) to find out how to use other LLMs.
@@ -40,7 +40,19 @@ Make sure to set [moduleResolution](https://www.typescriptlang.org/docs/handbook
}
```
We recommend using `bundler` or `nodenext`, but due to popularity of `node`, we still added support for it.
We recommend using `bundler` or `nodenext`, but due to popularity of `node`, we still added support for it, but with import path limitations.
So you may encounter type errors when importing sub paths from the `llamaindex` package like:
```ts
import { Settings } from "llamaindex";
```
The simplest way to fix this without changing `moduleResolution` is to import directly from `llamaindex`:
```ts
import { Settings } from "llamaindex";
```
## Enable AsyncIterable for `Web Stream` API
@@ -56,8 +68,7 @@ Some modules uses `Web Stream` API like `ReadableStream` and `WritableStream`, y
```
```typescript
import { tool } from 'llamaindex'
import { agent } from "@llamaindex/workflow";
import { agent, tool } from 'llamaindex'
import { openai } from "@llamaindex/openai";
Settings.llm = openai({
@@ -12,8 +12,7 @@ Agent Workflows are a powerful system that enables you to create and orchestrate
The simplest use case is creating a single agent with specific tools. Here's an example of creating an assistant that tells jokes:
```typescript
import { tool } from "llamaindex";
import { agent } from "@llamaindex/workflow";
import { agent, tool } from "llamaindex";
import { openai } from "@llamaindex/openai";
// Define a joke-telling tool
@@ -41,17 +40,17 @@ console.log(result); // Baby Llama is called cria
Agent Workflows provide a unified interface for event streaming, making it easy to track and respond to different events during execution:
```typescript
import { agentToolCallEvent, agentStreamEvent } from "@llamaindex/workflow";
import { AgentToolCall, AgentStream } from "llamaindex";
// Get the workflow execution context
const events = workflow.runStream("Tell me something funny");
const context = workflow.run("Tell me something funny");
// Stream and handle events
for await (const event of events) {
if (agentToolCallEvent.include(event)) {
for await (const event of context) {
if (event instanceof AgentToolCall) {
console.log(`Tool being called: ${event.data.toolName}`);
}
if (agentStreamEvent.include(event)) {
if (event instanceof AgentStream) {
process.stdout.write(event.data.delta);
}
}
@@ -69,8 +68,7 @@ An Agent Workflow can orchestrate multiple agents, enabling complex interactions
Here's an example of a multi-agent system that combines joke-telling and weather information:
```typescript
import { tool } from "llamaindex";
import { multiAgent, agent } from "@llamaindex/workflow";
import { multiAgent, agent, tool } from "llamaindex";
import { openai } from "@llamaindex/openai";
import { z } from "zod";
@@ -17,8 +17,7 @@ The `parameters` field in the tool configuration is defined using `zod`, a TypeS
Example:
```ts
import { tool } from "llamaindex";
import { agent } from "@llamaindex/workflow";
import { agent, tool } from "llamaindex";
import { z } from "zod";
// first arg is LLM input, second is bound arg
@@ -47,7 +46,7 @@ In this example, `z.object` is used to define a schema for the `parameters` wher
You can import built-in tools from the `@llamaindex/tools` package.
```ts
import { agent } from "@llamaindex/workflow";
import { agent } from "llamaindex";
import { wiki } from "@llamaindex/tools";
const researchAgent = agent({
@@ -65,7 +64,7 @@ If you have a MCP server running, you can fetch tools from the server and use th
```ts
// 1. Import MCP tools adapter
import { mcp } from "@llamaindex/tools";
import { agent } from "@llamaindex/workflow";
import { agent } from "llamaindex";
// 2. Initialize a MCP client
// by npx
@@ -115,8 +114,7 @@ Note: calling the `bind` method will return a new `FunctionTool` instance, witho
Example to pass a `userToken` as additional argument:
```ts
import { tool } from "llamaindex";
import { agent } from "@llamaindex/workflow";
import { agent, tool } from "llamaindex";
// first arg is LLM input, second is bound arg
const queryKnowledgeBase = async ({ question }, { userToken }) => {
@@ -6,13 +6,256 @@ A `Workflow` in LlamaIndex is a lightweight, event-driven abstraction used to ch
Workflows are designed to be flexible and can be used to build agents, RAG flows, extraction flows, or anything else you want to implement.
To use workflows install this package:
```package-install
npm i @llamaindex/workflow
npm i @llama-flow/core @llamaindex/openai
```
This package is a stable, production-ready version of our [llama-flow](../../../llamaflow) project.
## Getting Started
While you can still reference the llama-flow documentation for detailed information about the underlying concepts, we recommend using the `@llamaindex/workflow` package for all new projects to ensure stability and long-term availability.
Let's explore a simple workflow example where a joke is generated and then critiqued and iterated on:
```typescript
import { OpenAI } from "@llamaindex/openai";
import { createWorkflow, workflowEvent } from "@llama-flow/core";
import { withStore } from "@llama-flow/core/middleware/store";
// Create LLM instance
const llm = new OpenAI({ model: "gpt-4.1-mini", apiKey: "..."});
// Define our workflow events
const startEvent = workflowEvent<string>(); // Input topic for joke
const jokeEvent = workflowEvent<{ joke: string }>(); // Intermediate joke
const critiqueEvent = workflowEvent<{ joke: string, critique: string }>(); // Intermediate critique
const resultEvent = workflowEvent<{ joke: string, critique: string }>(); // Final joke + critique
// Create our workflow
const jokeFlow = withStore(
() => ({
numIterations: 0,
maxIterations: 3,
}),
createWorkflow()
);
// Define handlers for each step
jokeFlow.handle([startEvent], async (event) => {
// Prompt the LLM to write a joke
const prompt = `Write your best joke about ${event.data}. Write the joke between <joke> and </joke> tags.`;
const response = await llm.complete({ prompt });
// Parse the joke from the response
const joke = response.text.match(/<joke>([\s\S]*?)<\/joke>/)?.[1]?.trim() ?? response.text;
return jokeEvent.with({ joke: joke });
});
jokeFlow.handle([jokeEvent], async (event) => {
// Prompt the LLM to critique the joke
const prompt = `Give a thorough critique of the following joke. If the joke needs improvement, put "IMPROVE" somewhere in the critique: ${event.data.joke}`;
const response = await llm.complete({ prompt });
// If the critique includes "IMPROVE", keep iterating, else, return the result
if (response.text.includes("IMPROVE")) {
return critiqueEvent.with({ joke: event.data.joke, critique: response.text });
}
return resultEvent.with({ joke: event.data.joke, critique: response.text });
});
jokeFlow.handle([critiqueEvent], async (event) => {
// Keep track of the number of iterations
const store = jokeFlow.getStore();
store.numIterations++;
// Write a new joke based on the previous joke and critique
const prompt = `Write a new joke based on the following critique and the original joke. Write the joke between <joke> and </joke> tags.\n\nJoke: ${event.data.joke}\n\nCritique: ${event.data.critique}`;
const response = await llm.complete({ prompt });
// Parse the joke from the response
const joke = response.text.match(/<joke>([\s\S]*?)<\/joke>/)?.[1]?.trim() ?? response.text;
// If we've done less than the max number of iterations, keep iterating
// else, return the result
if (store.numIterations < store.maxIterations) {
return jokeEvent.with({ joke: joke });
}
return resultEvent.with({ joke: joke, critique: event.data.critique });
});
// Usage
async function main() {
const { stream, sendEvent } = jokeFlow.createContext();
sendEvent(startEvent.with("pirates"));
let result: { joke: string, critique: string } | undefined;
for await (const event of stream) {
// console.log(event.data); optionally log the event data
if (resultEvent.include(event)) {
result = event.data;
break; // Stop when we get the final result
}
}
console.log(result);
}
main().catch(console.error);
```
There are a few moving pieces here, so let's go through this step by step.
### Defining Workflow Events
```typescript
const startEvent = workflowEvent<string>(); // Input topic for joke
const jokeEvent = workflowEvent<{ joke: string }>(); // Intermediate joke
const critiqueEvent = workflowEvent<{ joke: string, critique: string }>(); // Intermediate critique
const resultEvent = workflowEvent<{ joke: string, critique: string }>(); // Final joke + critique
```
Events are defined using the `workflowEvent` function and contain arbitrary data provided as a generic type. In this example, we have four events:
- `startEvent`: Takes a string input (the joke topic)
- `jokeEvent`: Contains an object with a joke property
- `critiqueEvent`: Contains both the joke and its critique, used for the feedback loop
- `resultEvent`: Contains the final joke and critique after any iterations
### Setting up the Workflow with Store Middleware
```typescript
const jokeFlow = withStore(
() => ({
numIterations: 0,
maxIterations: 3,
}),
createWorkflow()
);
```
Our workflow is implemented using the `createWorkflow()` function, enhanced with the `withStore` middleware. The store provides shared state across all handlers, which in this case tracks:
- `numIterations`: Counts how many iterations of joke improvement we've done
- `maxIterations`: Sets a limit to prevent infinite loops
This store will be accesible within workflows by using the `jokeFlow.getStore()` function.
### Adding Handlers with Loops
We have three key handlers in our workflow:
1. The first handler processes the `startEvent`, generates an initial joke, and emits a `jokeEvent`:
```typescript
jokeFlow.handle([startEvent], async (event) => {
// Prompt the LLM to write a joke
const prompt = `Write your best joke about ${event.data}. Write the joke between <joke> and </joke> tags.`;
const response = await llm.complete({ prompt });
// Parse the joke from the response
const joke = response.text.match(/<joke>([\s\S]*?)<\/joke>/)?.[1]?.trim() ?? response.text;
return jokeEvent.with({ joke: joke });
});
```
2. The second handler handles the `jokeEvent`, critiques the joke, and either:
- Emits a `critiqueEvent` if the joke needs improvement
- Emits a `resultEvent` if the joke is good enough
```typescript
jokeFlow.handle([jokeEvent], async (event) => {
// Prompt the LLM to critique the joke
const prompt = `Give a thorough critique of the following joke. If the joke needs improvement, put "IMPROVE" somewhere in the critique: ${event.data.joke}`;
const response = await llm.complete({ prompt });
// If the critique includes "IMPROVE", keep iterating, else, return the result
if (response.text.includes("IMPROVE")) {
return critiqueEvent.with({ joke: event.data.joke, critique: response.text });
}
return resultEvent.with({ joke: event.data.joke, critique: response.text });
});
```
3. The third handler processes the `critiqueEvent`, generates an improved joke based on the critique, and either:
- Loops back to the joke evaluation (if under the iteration limit)
- Emits the final `resultEvent` (if iteration limit reached)
```typescript
jokeFlow.handle([critiqueEvent], async (event) => {
// Keep track of the number of iterations
const store = jokeFlow.getStore();
store.numIterations++;
// Write a new joke based on the previous joke and critique
const prompt = `Write a new joke based on the following critique and the original joke. Write the joke between <joke> and </joke> tags.\n\nJoke: ${event.data.joke}\n\nCritique: ${event.data.critique}`;
const response = await llm.complete({ prompt });
// Parse the joke from the response
const joke = response.text.match(/<joke>([\s\S]*?)<\/joke>/)?.[1]?.trim() ?? response.text;
// If we've done less than the max number of iterations, keep iterating
// else, return the result
if (store.numIterations < store.maxIterations) {
return jokeEvent.with({ joke: joke });
}
return resultEvent.with({ joke: joke, critique: event.data.critique });
});
```
### Running the Workflow
```typescript
async function main() {
const { stream, sendEvent } = jokeFlow.createContext();
sendEvent(startEvent.with("pirates"));
let result: { joke: string, critique: string } | undefined;
for await (const event of stream) {
// console.log(event.data); optionally log the event data
if (resultEvent.include(event)) {
result = event.data;
break; // Stop when we get the final result
}
}
console.log(result);
}
```
To run the workflow, we:
1. Create a workflow context with `createContext()`
2. Trigger the initial event with `sendEvent()`
3. Listen to the event stream and process events as they arrive
4. Use `include()` to check if an event is of a specific type
5. Break the loop when we receive our final result
### Using Stream Utilities
Workflows provide utility functions to make working with event streams easier:
```typescript
import { collect } from "@llama-flow/core/stream/consumer";
import { until } from "@llama-flow/core/stream/until";
// Create a workflow context and send the initial event
const { stream, sendEvent } = jokeFlow.createContext();
sendEvent(startEvent.with("pirates"));
// Collect all events until we get a resultEvent
const allEvents = await collect(until(stream, resultEvent));
// The last event will be the resultEvent
const finalEvent = allEvents[allEvents.length - 1];
console.log(finalEvent.data); // Output the joke and critique
```
The stream utilities make it easier to work with the asynchronous event flow. In this example, we use:
- `collect`: Aggregates all events into an array
- `until`: Creates a stream that emits events until a condition is met (in this case, until a resultEvent is received)
You can combine these utilities with other stream operators like `filter` and `map` to create powerful processing pipelines.
## Next Steps
To learn more about workflows, check out [the documentation in the tutorial section](../../../llamaflow).
@@ -120,11 +120,11 @@ async function main() {
```ts
import { BEDROCK_MODELS, Bedrock } from "@llamaindex/community";
import { tool } from "llamaindex";
import { agent } from "@llamaindex/workflow";
import { FunctionTool, LLMAgent } from "llamaindex";
import { z } from "zod";
const sumNumbers = tool(
const sumNumbers = FunctionTool.from(
({ a, b }: { a: number; b: number }) => `${a + b}`,
{
name: "sumNumbers",
description: "Use this function to sum two numbers",
@@ -136,11 +136,11 @@ const sumNumbers = tool(
description: "The second number",
}),
}),
execute: ({ a, b }: { a: number; b: number }) => `${a + b}`,
},
);
const divideNumbers = tool(
const divideNumbers = FunctionTool.from(
({ a, b }: { a: number; b: number }) => `${a / b}`,
{
name: "divideNumbers",
description: "Use this function to divide two numbers",
@@ -152,7 +152,6 @@ const divideNumbers = tool(
description: "The divisor b to divide by",
}),
}),
execute: ({ a, b }: { a: number; b: number }) => `${a / b}`,
},
);
@@ -162,15 +161,15 @@ const bedrock = new Bedrock({
});
async function main() {
const myAgent = agent({
const agent = new LLMAgent({
llm: bedrock,
tools: [sumNumbers, divideNumbers],
});
const response = await myAgent.run(
"How much is 5 + 5? then divide by 2",
);
const response = await agent.chat({
message: "How much is 5 + 5? then divide by 2",
});
console.log(response);
console.log(response.message);
}
```
@@ -15,7 +15,7 @@ In LlamaIndex, an agent is a semi-autonomous piece of software powered by an LLM
You'll need to have a recent version of [Node.js](https://nodejs.org/en) installed. Then you can install LlamaIndex.TS by running
```package-install
npm i llamaindex @llamaindex/openai @llamaindex/readers @llamaindex/huggingface @llamaindex/workflow
npm i llamaindex @llamaindex/openai @llamaindex/readers @llamaindex/huggingface
```
## Choose your model
@@ -35,16 +35,11 @@ First we'll need to pull in our dependencies. These are:
import "dotenv/config";
import {
agent,
agentStreamEvent,
openai,
} from "@llamaindex/workflow";
import {
AgentStream,
tool,
openai,
Settings,
} from "llamaindex";
import {
openai,
} from "@llamaindex/openai";
import { z } from "zod";
```
@@ -113,10 +108,11 @@ const myAgent = agent({ tools });
### Ask the agent a question
We can use the `run` method to ask our agent a question, and it will use the tools we've defined to find an answer.
We can use the `chat` interface to ask our agent a question, and it will use the tools we've defined to find an answer.
```javascript
const result = await myAgent.run("Sum 101 and 303");
const context = myAgent.run("Sum 101 and 303");
const result = await context;
console.log(result.data);
```
You will see the following output:
@@ -127,13 +123,12 @@ You will see the following output:
{ result: 'The sum of 101 and 303 is 404.' }
```
To stream the response, you need to call `runStream`, which returns a stream of events.
The `agentStreamEvent` provides chunks of the response as they become available. This allows you to display the response incrementally rather than waiting for the full response:
To stream the response, you can use the `AgentStream` event which provides chunks of the response as they become available. This allows you to display the response incrementally rather than waiting for the full response:
```javascript
const events = myAgent.runStream("Add 101 and 303");
for await (const event of events) {
if (agentStreamEvent.include(event)) {
const context = myAgent.run("Add 101 and 303");
for await (const event of context) {
if (event instanceof AgentStream) {
process.stdout.write(event.data.delta);
}
}
@@ -145,18 +140,18 @@ for await (const event of events) {
The sum of 101 and 303 is 404.
```
Note that we're filtering for `agentStreamEvent` as an agent might return other events - more about that in the following section.
### Logging workflow events
To log the workflow events, you can check the event type and log the event data.
```javascript
const events = myAgent.runStream("Sum 202 and 404");
for await (const event of events) {
if (agentStreamEvent.include(event)) {
const context = myAgent.run("Sum 202 and 404");
for await (const event of context) {
if (event instanceof AgentStream) {
// Stream the response
process.stdout.write(event.data.delta);
for (const chunk of event.data.delta) {
process.stdout.write(chunk);
}
} else {
// Log other events
console.log("\nWorkflow event:", JSON.stringify(event, null, 2));
@@ -30,16 +30,16 @@ Settings.llm = ollama({
### Run local agent
You can also create local agent by importing `agent` from `@llamaindex/workflow`.
You can also create local agent by importing `agent` from `llamaindex`.
```javascript
import { agent } from "@llamaindex/workflow";
import { agent } from "llamaindex";
const workflow = agent({
tools: [getWeatherTool],
});
const resutl = workflow.run(
const workflowContext = workflow.run(
"What's the weather like in San Francisco?",
);
```
@@ -25,8 +25,7 @@ We'll be bringing in `SimpleDirectoryReader`, `HuggingFaceEmbedding`, `VectorSto
```javascript
import { QueryEngineTool, Settings, VectorStoreIndex } from "llamaindex";
import { agent } from "@llamaindex/workflow";
import { openai } from "@llamaindex/openai";
import { OpenAI, OpenAIAgent } from "@llamaindex/openai";
import { HuggingFaceEmbedding } from "@llamaindex/huggingface";
import { SimpleDirectoryReader } from "@llamaindex/readers/directory";
```
@@ -8,10 +8,9 @@ We have a comprehensive, step-by-step [guide to building agents in LlamaIndex.TS
In a new folder:
```package-install
```bash npm2yarn
npm init
npm i -D typescript @types/node
npm i @llamaindex/openai @llamaindex/workflow llamaindex zod
```
## Run agent
@@ -21,14 +20,15 @@ Create the file `example.ts`. This code will:
- Create two tools for use by the agent:
- A `sumNumbers` tool that adds two numbers
- A `divideNumbers` tool that divides numbers
-
- Give an example of the data structure we wish to generate
- Prompt the LLM with instructions and the example, plus a sample transcript
<include cwd>../../examples/agents/agent/openai.ts</include>
<include cwd>../../examples/agent/openai.ts</include>
To run the code:
```package-install
```bash
npx tsx example.ts
```
@@ -36,18 +36,9 @@ You should expect output something like:
```
{
result: '5 + 5 is 10. Then, 10 divided by 2 is 5.',
state: {
memory: ChatMemoryBuffer {
chatStore: SimpleChatStore {},
chatStoreKey: 'chat_history',
tokenLimit: 750000
},
scratchpad: [],
currentAgentName: 'Agent',
agents: [ 'Agent' ],
nextAgentName: null
}
content: 'The sum of 5 + 5 is 10. When you divide 10 by 2, you get 5.',
role: 'assistant',
options: {}
}
Done
```
@@ -4,7 +4,7 @@
"basic_agent",
"rag",
"agents",
"workflows",
"../../llamaflow",
"local_llm",
"chatbot",
"structured_data_extraction"
@@ -16,7 +16,7 @@ LlamaIndex uses a two stage method when using an LLM with your data:
1. **indexing stage**: preparing a knowledge base, and
2. **querying stage**: retrieving relevant context from the knowledge to assist the LLM in responding to a question
![](/_static/concepts/rag.jpg)
![](./_static/concepts/rag.jpg)
This process is also known as Retrieval Augmented Generation (RAG).
@@ -28,7 +28,7 @@ Let's explore each stage in detail.
LlamaIndex.TS help you prepare the knowledge base with a suite of data connectors and indexes.
![](/_static/concepts/indexing.jpg)
![](./_static/concepts/indexing.jpg)
[**Data Loaders**](/docs/llamaindex/modules/data/readers):
A data connector (i.e. `Reader`) ingest data from different data sources and data formats into a simple `Document` representation (text and simple metadata).
@@ -54,7 +54,7 @@ LlamaIndex provides composable modules that help you build and integrate RAG pip
These building blocks can be customized to reflect ranking preferences, as well as composed to reason over multiple knowledge bases in a structured way.
![](/_static/concepts/querying.jpg)
![](./_static/concepts/querying.jpg)
#### Building Blocks
@@ -8,10 +8,9 @@ One of the most common use-cases for LlamaIndex is Retrieval-Augmented Generatio
In a new folder, run:
```package-install
```bash npm2yarn
npm init
npm i -D typescript @types/node
npm i llamaindex
```
Then, check out the [installation](/docs/llamaindex/getting_started/installation) steps to install LlamaIndex.TS and prepare an OpenAI key.
@@ -35,7 +34,7 @@ Create a `tsconfig.json` file in the same folder:
Now you can run the code with
```package-install
```bash
npx tsx example.ts
```
@@ -10,10 +10,9 @@ You can use [other LLMs](/docs/llamaindex/modules/models/llms) via their APIs; i
In a new folder:
```package-install
```bash npm2yarn
npm init
npm i -D typescript @types/node
npm i @llamaindex/openai zod
```
## Extract data
@@ -28,7 +27,7 @@ Create the file `example.ts`. This code will:
To run the code:
```package-install
```bash
npx tsx example.ts
```
@@ -1,176 +0,0 @@
---
title: Workflows
---
A `Workflow` in LlamaIndex is a lightweight, event-driven abstraction used to chain together several events. Workflows are made up of `handlers`, with each one responsible for processing specific event types and emitting new events.
Workflows are designed to be flexible and can be used to build agents, RAG flows, extraction flows, or anything else you want to implement.
```package-install
npm i @llamaindex/workflow @llamaindex/openai
```
## Getting Started
Let's explore a simple workflow example where a joke is generated and then critiqued and iterated on:
<include cwd>../../examples/agents/workflow/joke.ts</include>
There are a few moving pieces here, so let's go through this step by step.
### Defining Workflow Events
```typescript
const startEvent = workflowEvent<string>(); // Input topic for joke
const jokeEvent = workflowEvent<{ joke: string }>(); // Intermediate joke
const critiqueEvent = workflowEvent<{ joke: string; critique: string }>(); // Intermediate critique
const resultEvent = workflowEvent<{ joke: string; critique: string }>(); // Final joke + critique
```
Events are defined using the `workflowEvent` function and contain arbitrary data provided as a generic type. In this example, we have four events:
- `startEvent`: Takes a string input (the joke topic)
- `jokeEvent`: Contains an object with a joke property
- `critiqueEvent`: Contains both the joke and its critique, used for the feedback loop
- `resultEvent`: Contains the final joke and critique after any iterations
### Setting up the Workflow with Stateful Middleware
```typescript
const { withState, getContext } = createStatefulMiddleware(() => ({
numIterations: 0,
maxIterations: 3,
}));
const jokeFlow = withState(createWorkflow());
```
Our workflow is implemented using the `createWorkflow()` function, enhanced with the `withState` middleware. This middleware provides shared state across all handlers, which in this case tracks:
- `numIterations`: Counts how many iterations of joke improvement we've done
- `maxIterations`: Sets a limit to prevent infinite loops
This state will be accessible within workflows by using the `getContext().state` function.
### Adding Handlers with Loops
We have three key handlers in our workflow:
1. The first handler processes the `startEvent`, generates an initial joke, and emits a `jokeEvent`:
```typescript
jokeFlow.handle([startEvent], async (event) => {
// Prompt the LLM to write a joke
const prompt = `Write your best joke about ${event.data}. Write the joke between <joke> and </joke> tags.`;
const response = await llm.complete({ prompt });
// Parse the joke from the response
const joke =
response.text.match(/<joke>([\s\S]*?)<\/joke>/)?.[1]?.trim() ??
response.text;
return jokeEvent.with({ joke: joke });
});
```
2. The second handler handles the `jokeEvent`, critiques the joke, and either:
- Emits a `critiqueEvent` if the joke needs improvement
- Emits a `resultEvent` if the joke is good enough
```typescript
jokeFlow.handle([jokeEvent], async (event) => {
// Prompt the LLM to critique the joke
const prompt = `Give a thorough critique of the following joke. If the joke needs improvement, put "IMPROVE" somewhere in the critique: ${event.data.joke}`;
const response = await llm.complete({ prompt });
// If the critique includes "IMPROVE", keep iterating, else, return the result
if (response.text.includes("IMPROVE")) {
return critiqueEvent.with({
joke: event.data.joke,
critique: response.text,
});
}
return resultEvent.with({ joke: event.data.joke, critique: response.text });
});
```
3. The third handler processes the `critiqueEvent`, generates an improved joke based on the critique, and either:
- Loops back to the joke evaluation (if under the iteration limit)
- Emits the final `resultEvent` (if iteration limit reached)
```typescript
jokeFlow.handle([critiqueEvent], async (event) => {
// Keep track of the number of iterations
const state = getContext().state;
state.numIterations++;
// Write a new joke based on the previous joke and critique
const prompt = `Write a new joke based on the following critique and the original joke. Write the joke between <joke> and </joke> tags.\n\nJoke: ${event.data.joke}\n\nCritique: ${event.data.critique}`;
const response = await llm.complete({ prompt });
// Parse the joke from the response
const joke =
response.text.match(/<joke>([\s\S]*?)<\/joke>/)?.[1]?.trim() ??
response.text;
// If we've done less than the max number of iterations, keep iterating
// else, return the result
if (state.numIterations < state.maxIterations) {
return jokeEvent.with({ joke: joke });
}
return resultEvent.with({ joke: joke, critique: event.data.critique });
});
```
### Running the Workflow
```typescript
async function main() {
const { stream, sendEvent } = jokeFlow.createContext();
sendEvent(startEvent.with("pirates"));
let result: { joke: string, critique: string } | undefined;
for await (const event of stream) {
// console.log(event.data); optionally log the event data
if (resultEvent.include(event)) {
result = event.data;
break; // Stop when we get the final result
}
}
console.log(result);
}
```
To run the workflow, we:
1. Create a workflow context with `createContext()`
2. Trigger the initial event with `sendEvent()`
3. Listen to the event stream and process events as they arrive
4. Use `include()` to check if an event is of a specific type
5. Break the loop when we receive our final result
### Using Stream Utilities
The `stream` returned by `createContext` contains utility functions to make working with event streams easier:
```typescript
// Create a workflow context and send the initial event
const { stream, sendEvent } = jokeFlow.createContext();
sendEvent(startEvent.with("pirates"));
// Collect all events until we get a resultEvent
const allEvents = await stream.until(resultEvent).toArray();
// The last event will be the resultEvent
const finalEvent = allEvents.at(-1);
console.log(finalEvent.data); // Output the joke and critique
```
The stream utilities make it easier to work with the asynchronous event flow. In this example, we use:
- `toArray`: Aggregates all events into an array
- `until`: Creates a stream that emits events until a condition is met (in this case, until a resultEvent is received)
You can combine these utilities with other stream operators like `filter` and `map` to create powerful processing pipelines.
## Next Steps
To learn more about workflows, check out [the Workflows documentation](/docs/llamaindex/modules/agents/workflows).
+1 -1
View File
@@ -1,3 +1,3 @@
{
"pages": ["llamaindex", "api", "llamaflow"]
"pages": ["llamaindex", "api"]
}
@@ -1,14 +1,5 @@
# @llamaindex/cloudflare-worker-agent-test
## 0.0.158
### Patch Changes
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [41953a3]
- llamaindex@0.10.4
## 0.0.157
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloudflare-worker-agent-test",
"version": "0.0.158",
"version": "0.0.157",
"type": "module",
"private": true,
"scripts": {
@@ -1,12 +1,5 @@
# @llamaindex/llama-parse-browser-test
## 0.0.60
### Patch Changes
- Updated dependencies [2225ffd]
- @llamaindex/cloud@4.0.5
## 0.0.59
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/llama-parse-browser-test",
"private": true,
"version": "0.0.60",
"version": "0.0.59",
"type": "module",
"scripts": {
"dev": "vite",
-9
View File
@@ -1,14 +1,5 @@
# @llamaindex/next-agent-test
## 0.1.158
### Patch Changes
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [41953a3]
- llamaindex@0.10.4
## 0.1.157
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-agent-test",
"version": "0.1.158",
"version": "0.1.157",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,14 +1,5 @@
# test-edge-runtime
## 0.1.157
### Patch Changes
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [41953a3]
- llamaindex@0.10.4
## 0.1.156
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/nextjs-edge-runtime-test",
"version": "0.1.157",
"version": "0.1.156",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,14 +1,5 @@
# @llamaindex/next-node-runtime
## 0.1.25
### Patch Changes
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [41953a3]
- llamaindex@0.10.4
## 0.1.24
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-node-runtime-test",
"version": "0.1.25",
"version": "0.1.24",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,14 +1,5 @@
# vite-import-llamaindex
## 0.0.24
### Patch Changes
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [41953a3]
- llamaindex@0.10.4
## 0.0.23
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "vite-import-llamaindex",
"private": true,
"version": "0.0.24",
"version": "0.0.23",
"type": "module",
"scripts": {
"build": "vite build",
@@ -1,14 +1,5 @@
# @llamaindex/waku-query-engine-test
## 0.0.158
### Patch Changes
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [41953a3]
- llamaindex@0.10.4
## 0.0.157
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/waku-query-engine-test",
"version": "0.0.158",
"version": "0.0.157",
"type": "module",
"private": true,
"scripts": {
+1 -1
View File
@@ -26,7 +26,7 @@ const divideNumbers = tool({
async function main() {
const mathAgent = agent({
tools: [sumNumbers, divideNumbers],
llm: openai({ model: "gpt-4.1-mini" }),
llm: openai({ model: "gpt-4o-mini" }),
verbose: false,
});
+2 -3
View File
@@ -15,10 +15,9 @@
"circular-check": "madge --circular ./packages/**/**/dist/index.js",
"release": "pnpm run build && changeset publish",
"release-snapshot": "pnpm run build && changeset publish --tag snapshot",
"new-version": "changeset version && pnpm postversion && pnpm format:write && pnpm run build",
"new-version": "changeset version && pnpm format:write && pnpm run build",
"new-snapshot": "pnpm run build && changeset version --snapshot",
"lint-staged": "lint-staged",
"postversion": "node scripts/repin-workflow.mjs"
"lint-staged": "lint-staged"
},
"devDependencies": {
"@changesets/cli": "^2.27.5",
-9
View File
@@ -1,14 +1,5 @@
# @llamaindex/autotool
## 7.0.4
### Patch Changes
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [41953a3]
- llamaindex@0.10.4
## 7.0.3
### Patch Changes
@@ -1,15 +1,5 @@
# @llamaindex/autotool-01-node-example
## 0.0.105
### Patch Changes
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [41953a3]
- llamaindex@0.10.4
- @llamaindex/autotool@7.0.4
## 0.0.104
### Patch Changes
@@ -13,5 +13,5 @@
"scripts": {
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
},
"version": "0.0.105"
"version": "0.0.104"
}
+1 -1
View File
@@ -6,7 +6,7 @@
"url": "git+https://github.com/run-llama/LlamaIndexTS.git",
"directory": "packages/autotool"
},
"version": "7.0.4",
"version": "7.0.3",
"description": "auto transpile your JS function to LLM Agent compatible",
"files": [
"dist",
-6
View File
@@ -1,11 +1,5 @@
# @llamaindex/cloud
## 4.0.5
### Patch Changes
- 2225ffd: feat: bump llama cloud sdk
## 4.0.4
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloud",
"version": "4.0.5",
"version": "4.0.4",
"type": "module",
"license": "MIT",
"scripts": {
-9
View File
@@ -1,14 +1,5 @@
# @llamaindex/experimental
## 0.0.174
### Patch Changes
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [41953a3]
- llamaindex@0.10.4
## 0.0.173
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/experimental",
"description": "Experimental package for LlamaIndexTS",
"version": "0.0.174",
"version": "0.0.173",
"type": "module",
"types": "dist/type/index.d.ts",
"main": "dist/cjs/index.js",
-13
View File
@@ -1,18 +1,5 @@
# llamaindex
## 0.10.4
### Patch Changes
- 2225ffd: feat: bump llama cloud sdk
- 6ddf1c1: Show warning to use @llamaindex/workflow when using depracted workflows
- 41953a3: fix: node10 module resolution fail in sub llamaindex packages
- Updated dependencies [7e8e454]
- Updated dependencies [2225ffd]
- Updated dependencies [bc53342]
- @llamaindex/workflow@1.1.0
- @llamaindex/cloud@4.0.5
## 0.10.3
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "llamaindex",
"version": "0.10.4",
"version": "0.10.3",
"license": "MIT",
"type": "module",
"keywords": [
@@ -25,7 +25,7 @@
"@llamaindex/env": "workspace:*",
"@llamaindex/node-parser": "workspace:*",
"@llamaindex/openai": "workspace:*",
"@llamaindex/workflow": "1.0.3",
"@llamaindex/workflow": "1.0.4",
"@types/lodash": "^4.17.7",
"@types/node": "^22.9.0",
"ajv": "^8.17.1",
+1 -1
View File
@@ -68,6 +68,7 @@ export * from "@llamaindex/core/storage/index-store";
export * from "@llamaindex/core/storage/kv-store";
export * from "@llamaindex/core/utils";
export * from "@llamaindex/openai";
export * from "@llamaindex/workflow";
export * from "./agent/index.js";
export * from "./cloud/index.js";
export * from "./engines/index.js";
@@ -85,5 +86,4 @@ export * from "./selectors/index.js";
export * from "./storage/StorageContext.js";
export * from "./tools/index.js";
export * from "./types.js";
export * from "./workflow.js";
export { Settings };
-19
View File
@@ -1,19 +0,0 @@
import { Workflow as OriginalWorkflow } from "@llamaindex/workflow";
export * from "@llamaindex/workflow";
/**
* @deprecated The Workflow class is deprecated. Please import directly from "@llamaindex/workflow" in the future.
*/
export class Workflow<ContextData, Start, Stop> extends OriginalWorkflow<
ContextData,
Start,
Stop
> {
constructor(...args: any[]) {
// Need to figure out the constructor args for Workflow
console.warn(
"The Workflow class exported from 'llamaindex' is deprecated. Please use workflows directly from '@llamaindex/workflow' in the future. See https://ts.llamaindex.ai/docs/llamaindex/modules/agents/workflows for usage.",
);
super(...args);
}
}
-6
View File
@@ -1,11 +1,5 @@
# @llamaindex/google
## 0.2.6
### Patch Changes
- 73e2578: Add support for gemini-2.5-pro-preview-05-06
## 0.2.5
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/google",
"description": "Google Adapter for LlamaIndex",
"version": "0.2.6",
"version": "0.2.5",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
-2
View File
@@ -64,7 +64,6 @@ export const GEMINI_MODEL_INFO_MAP: Record<GEMINI_MODEL, GeminiModelInfo> = {
[GEMINI_MODEL.GEMINI_2_0_FLASH_THINKING_EXP]: { contextWindow: 32768 },
[GEMINI_MODEL.GEMINI_2_0_PRO_EXPERIMENTAL]: { contextWindow: 2 * 10 ** 6 },
[GEMINI_MODEL.GEMINI_2_5_PRO_PREVIEW]: { contextWindow: 10 ** 6 },
[GEMINI_MODEL.GEMINI_2_5_PRO_PREVIEW_LATEST]: { contextWindow: 10 ** 6 },
[GEMINI_MODEL.GEMINI_2_5_FLASH_PREVIEW]: { contextWindow: 10 ** 6 },
};
@@ -83,7 +82,6 @@ export const SUPPORT_TOOL_CALL_MODELS: GEMINI_MODEL[] = [
GEMINI_MODEL.GEMINI_2_0_FLASH,
GEMINI_MODEL.GEMINI_2_0_PRO_EXPERIMENTAL,
GEMINI_MODEL.GEMINI_2_5_PRO_PREVIEW,
GEMINI_MODEL.GEMINI_2_5_PRO_PREVIEW_LATEST,
GEMINI_MODEL.GEMINI_2_5_FLASH_PREVIEW,
];
-1
View File
@@ -74,7 +74,6 @@ export enum GEMINI_MODEL {
GEMINI_2_0_FLASH_THINKING_EXP = "gemini-2.0-flash-thinking-exp-01-21",
GEMINI_2_0_PRO_EXPERIMENTAL = "gemini-2.0-pro-exp-02-05",
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_FLASH_PREVIEW = "gemini-2.5-flash-preview-04-17",
}
-10
View File
@@ -1,15 +1,5 @@
# @llamaindex/workflow
## 1.1.0
### Minor Changes
- bc53342: Update workflows to llama-flow syntax
### Patch Changes
- 7e8e454: Bump llama-flow@0.4.1
## 1.0.4
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/workflow",
"description": "Workflow API",
"version": "1.1.0",
"version": "1.0.4",
"type": "module",
"types": "dist/index.d.ts",
"module": "dist/index.js",
+19 -33
View File
@@ -2,13 +2,11 @@ import {
createWorkflow,
getContext,
workflowEvent,
type Handler,
type Workflow,
type WorkflowContext,
type WorkflowEvent,
type WorkflowEventData,
} from "@llama-flow/core";
import { createStatefulMiddleware } from "@llama-flow/core/middleware/state";
import { collect } from "@llama-flow/core/stream/consumer";
import { until } from "@llama-flow/core/stream/until";
import { Settings } from "@llamaindex/core/global";
import type { ChatMessage, MessageContent } from "@llamaindex/core/llms";
import { ChatMemoryBuffer } from "@llamaindex/core/memory";
@@ -140,7 +138,7 @@ export const agent = (params: SingleAgentParams): AgentWorkflow => {
* based on the LlamaIndexTS workflow system. It supports single agent workflows
* with multiple tools.
*/
export class AgentWorkflow implements Workflow {
export class AgentWorkflow {
private stateful = createStatefulMiddleware(
(state: AgentWorkflowState) => state,
);
@@ -195,17 +193,6 @@ export class AgentWorkflow implements Workflow {
this.setupWorkflowSteps();
}
handle<
const AcceptEvents extends WorkflowEvent<unknown>[],
Result extends ReturnType<WorkflowEvent<unknown>["with"]> | void,
>(accept: AcceptEvents, handler: Handler<AcceptEvents, Result>): void {
this.workflow.handle(accept, handler);
}
createContext(): WorkflowContext {
return this.workflow.createContext(this.createInitialState());
}
private addAgents(agents: BaseWorkflowAgent[]): void {
const agentNames = new Set(agents.map((a) => a.name));
if (agentNames.size !== agents.length) {
@@ -321,6 +308,7 @@ export class AgentWorkflow implements Workflow {
"Either provide a user message or a chat history with a user message as the last message",
);
}
state.userInput = lastMessage.content as string;
} else {
throw new Error("No user message or chat history provided");
}
@@ -569,18 +557,6 @@ export class AgentWorkflow implements Workflow {
}
}
private createInitialState(): AgentWorkflowState {
return {
memory: new ChatMemoryBuffer({
llm: this.agents.get(this.rootAgentName)?.llm ?? Settings.llm,
}),
scratchpad: [],
currentAgentName: this.rootAgentName,
agents: Array.from(this.agents.keys()),
nextAgentName: null,
};
}
runStream(
userInput: string,
params?: {
@@ -591,7 +567,18 @@ export class AgentWorkflow implements Workflow {
if (this.agents.size === 0) {
throw new Error("No agents added to workflow");
}
const state = params?.state ?? this.createInitialState();
const state: AgentWorkflowState = {
...(params?.state ?? {
memory: new ChatMemoryBuffer({
llm: this.agents.get(this.rootAgentName)?.llm ?? Settings.llm,
}),
scratchpad: [],
currentAgentName: this.rootAgentName,
agents: Array.from(this.agents.keys()),
nextAgentName: null,
}),
userInput: userInput,
};
const { sendEvent, stream } = this.workflow.createContext(state);
sendEvent(
@@ -600,7 +587,7 @@ export class AgentWorkflow implements Workflow {
chatHistory: params?.chatHistory,
}),
);
return stream.until(stopAgentEvent);
return until(stream, stopAgentEvent);
}
async run(
@@ -610,9 +597,8 @@ export class AgentWorkflow implements Workflow {
state?: AgentWorkflowState;
},
): Promise<WorkflowEventData<AgentResultData>> {
const finalEvent = (await this.runStream(userInput, params).toArray()).at(
-1,
);
const allEvents = await collect(this.runStream(userInput, params));
const finalEvent = allEvents[allEvents.length - 1];
if (!stopAgentEvent.include(finalEvent)) {
throw new Error(
`Agent stopped with unexpected ${finalEvent?.toString() ?? "unknown"} event.`,
+1
View File
@@ -4,6 +4,7 @@ import { BaseMemory } from "@llamaindex/core/memory";
import type { AgentOutput, AgentToolCallResult } from "./events";
export type AgentWorkflowState = {
userInput: string;
memory: BaseMemory;
scratchpad: ChatMessage[];
agents: string[];
+2 -15
View File
@@ -1040,8 +1040,8 @@ importers:
specifier: workspace:*
version: link:../providers/openai
'@llamaindex/workflow':
specifier: 1.0.3
version: 1.0.3(@llamaindex/core@packages+core)(@llamaindex/env@packages+env)(zod@3.24.2)
specifier: 1.0.4
version: link:../workflow
'@types/lodash':
specifier: ^4.17.7
version: 4.17.16
@@ -3661,13 +3661,6 @@ packages:
'@types/react':
optional: true
'@llamaindex/workflow@1.0.3':
resolution: {integrity: sha512-GzYzLfn12BTQiLVwFr9tGl1Sa7PPVErLLQAJMgvfjUK8cv764SpJGqln8iKTxnKF05HcRrmJeE7ZD9Lzpf7UrA==}
peerDependencies:
'@llamaindex/core': 0.6.2
'@llamaindex/env': 0.1.29
zod: ^3.23.8
'@manypkg/find-root@1.1.0':
resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==}
@@ -15442,12 +15435,6 @@ snapshots:
optionalDependencies:
'@types/react': 19.0.10
'@llamaindex/workflow@1.0.3(@llamaindex/core@packages+core)(@llamaindex/env@packages+env)(zod@3.24.2)':
dependencies:
'@llamaindex/core': link:packages/core
'@llamaindex/env': link:packages/env
zod: 3.24.2
'@manypkg/find-root@1.1.0':
dependencies:
'@babel/runtime': 7.26.9
-7
View File
@@ -1,7 +0,0 @@
# @llamaindex/resolution-tests
## 0.0.2
### Patch Changes
- 41953a3: fix: node10 module resolution fail in sub llamaindex packages
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/resolution-tests",
"private": true,
"version": "0.0.2",
"version": "0.0.1",
"type": "module",
"scripts": {
"test": "pnpm run test:node && pnpm run test:node16 && pnpm run test:nodenext && pnpm run test:bundler",
-22
View File
@@ -1,22 +0,0 @@
import fs from "node:fs";
import path, { dirname } from "node:path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const pkgPath = path.join(
__dirname,
"..",
"packages",
"llamaindex",
"package.json",
);
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
pkg.dependencies["@llamaindex/workflow"] = "1.0.3";
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
console.log(
"Re-pinned @llamaindex/workflow to 1.0.3 in llamaindex package.json",
);
-13
View File
@@ -1,18 +1,5 @@
# @llamaindex/unit-test
## 0.1.25
### Patch Changes
- Updated dependencies [7e8e454]
- Updated dependencies [2225ffd]
- Updated dependencies [6ddf1c1]
- Updated dependencies [bc53342]
- Updated dependencies [41953a3]
- @llamaindex/workflow@1.1.0
- @llamaindex/cloud@4.0.5
- llamaindex@0.10.4
## 0.1.24
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/unit-test",
"private": true,
"version": "0.1.25",
"version": "0.1.24",
"type": "module",
"scripts": {
"test": "vitest run"