Compare commits

..

7 Commits

Author SHA1 Message Date
Alex Yang a3694dd65b fix: fail CI waku test 2024-06-15 02:02:52 +08:00
Marcus Schiesser 071cfd4d7d refactor: unify Tokenizer usage 2024-06-13 15:32:57 +02:00
Marcus Schiesser e6a26b911e fix: use js-tiktoken for edge and WASM tiktoken otherwise 2024-06-13 11:38:14 +02:00
Marcus Schiesser 72594e2a46 fix: type-check 2024-06-13 11:38:14 +02:00
Marcus Schiesser f755f59bfc refactor: move truncateMaxTokens to base embedding 2024-06-13 11:38:14 +02:00
Marcus Schiesser 9005a95315 fix: use tiktoken and finish truncation 2024-06-13 11:38:14 +02:00
Marcus Schiesser 6a99634d2b feat: truncate embedding tokens 2024-06-13 11:38:14 +02:00
387 changed files with 2043 additions and 2785 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"llamaindex": patch
---
Truncate text to embed for OpenAI if it exceeds maxTokens
+5
View File
@@ -0,0 +1,5 @@
---
"llamaindex": patch
---
feat: add support for managed identity for Azure OpenAI
+1 -1
View File
@@ -31,6 +31,6 @@ jobs:
- name: Publish @llamaindex/core
run: npx jsr publish --allow-slow-types
working-directory: packages/llamaindex
working-directory: packages/core
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+3 -3
View File
@@ -26,12 +26,12 @@ jobs:
- name: Build tarball
run: |
pnpm pack
working-directory: packages/llamaindex
working-directory: packages/core
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "packages/llamaindex/llamaindex-*.tgz"
artifacts: "packages/core/llamaindex-*.tgz"
name: Release ${{ github.ref }}
bodyFile: "packages/llamaindex/CHANGELOG.md"
bodyFile: "packages/core/CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}
+6 -6
View File
@@ -71,7 +71,7 @@ jobs:
- name: Build
run: pnpm run build
- name: Use Build For Examples
run: pnpm link ../packages/llamaindex/
run: pnpm link ../packages/core/
working-directory: ./examples
- name: Run Type Check
run: pnpm run type-check
@@ -81,9 +81,9 @@ jobs:
if: failure()
with:
name: typecheck-build-dist
path: ./packages/llamaindex/dist
path: ./packages/core/dist
if-no-files-found: error
e2e-llamaindex-examples:
e2e-core-examples:
strategy:
fail-fast: false
matrix:
@@ -93,7 +93,7 @@ jobs:
- nextjs-edge-runtime
# - waku-query-engine
runs-on: ubuntu-latest
name: Build LlamaIndex Example (${{ matrix.packages }})
name: Build Core Example (${{ matrix.packages }})
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
@@ -108,7 +108,7 @@ jobs:
run: pnpm run build
- name: Build ${{ matrix.packages }}
run: pnpm run build
working-directory: packages/llamaindex/e2e/examples/${{ matrix.packages }}
working-directory: packages/core/e2e/examples/${{ matrix.packages }}
typecheck-examples:
runs-on: ubuntu-latest
@@ -132,7 +132,7 @@ jobs:
working-directory: packages/env
- name: Pack llamaindex
run: pnpm pack --pack-destination ${{ runner.temp }}
working-directory: packages/llamaindex
working-directory: packages/core
- name: Install
run: npm add ${{ runner.temp }}/*.tgz
working-directory: ${{ runner.temp }}/examples
+1 -1
View File
@@ -41,7 +41,7 @@ To run them, run
pnpm run test
```
To write new test cases write them in [packages/core/src/tests](/packages/llamaindex/src/tests)
To write new test cases write them in [packages/core/src/tests](/packages/core/src/tests)
We use Jest https://jestjs.io/ to write our test cases. Jest comes with a bunch of built in assertions using the expect function: https://jestjs.io/docs/expect
+7 -7
View File
@@ -194,19 +194,19 @@ Check out our NextJS playground at https://llama-playground.vercel.app/. The sou
## Core concepts for getting started:
- [Document](/packages/llamaindex/src/Node.ts): A document represents a text file, PDF file or other contiguous piece of data.
- [Document](/packages/core/src/Node.ts): A document represents a text file, PDF file or other contiguous piece of data.
- [Node](/packages/llamaindex/src/Node.ts): The basic data building block. Most commonly, these are parts of the document split into manageable pieces that are small enough to be fed into an embedding model and LLM.
- [Node](/packages/core/src/Node.ts): The basic data building block. Most commonly, these are parts of the document split into manageable pieces that are small enough to be fed into an embedding model and LLM.
- [Embedding](/packages/llamaindex/src/embeddings/OpenAIEmbedding.ts): Embeddings are sets of floating point numbers which represent the data in a Node. By comparing the similarity of embeddings, we can derive an understanding of the similarity of two pieces of data. One use case is to compare the embedding of a question with the embeddings of our Nodes to see which Nodes may contain the data needed to answer that quesiton. Because the default service context is OpenAI, the default embedding is `OpenAIEmbedding`. If using different models, say through Ollama, use this [Embedding](/packages/llamaindex/src/embeddings/OllamaEmbedding.ts) (see all [here](/packages/llamaindex/src/embeddings)).
- [Embedding](/packages/core/src/embeddings/OpenAIEmbedding.ts): Embeddings are sets of floating point numbers which represent the data in a Node. By comparing the similarity of embeddings, we can derive an understanding of the similarity of two pieces of data. One use case is to compare the embedding of a question with the embeddings of our Nodes to see which Nodes may contain the data needed to answer that quesiton. Because the default service context is OpenAI, the default embedding is `OpenAIEmbedding`. If using different models, say through Ollama, use this [Embedding](/packages/core/src/embeddings/OllamaEmbedding.ts) (see all [here](/packages/core/src/embeddings)).
- [Indices](/packages/llamaindex/src/indices/): Indices store the Nodes and the embeddings of those nodes. QueryEngines retrieve Nodes from these Indices using embedding similarity.
- [Indices](/packages/core/src/indices/): Indices store the Nodes and the embeddings of those nodes. QueryEngines retrieve Nodes from these Indices using embedding similarity.
- [QueryEngine](/packages/llamaindex/src/engines/query/RetrieverQueryEngine.ts): Query engines are what generate the query you put in and give you back the result. Query engines generally combine a pre-built prompt with selected Nodes from your Index to give the LLM the context it needs to answer your query. To build a query engine from your Index (recommended), use the [`asQueryEngine`](/packages/llamaindex/src/indices/BaseIndex.ts) method on your Index. See all query engines [here](/packages/llamaindex/src/engines/query).
- [QueryEngine](/packages/core/src/engines/query/RetrieverQueryEngine.ts): Query engines are what generate the query you put in and give you back the result. Query engines generally combine a pre-built prompt with selected Nodes from your Index to give the LLM the context it needs to answer your query. To build a query engine from your Index (recommended), use the [`asQueryEngine`](/packages/core/src/indices/BaseIndex.ts) method on your Index. See all query engines [here](/packages/core/src/engines/query).
- [ChatEngine](/packages/llamaindex/src/engines/chat/SimpleChatEngine.ts): A ChatEngine helps you build a chatbot that will interact with your Indices. See all chat engines [here](/packages/llamaindex/src/engines/chat).
- [ChatEngine](/packages/core/src/engines/chat/SimpleChatEngine.ts): A ChatEngine helps you build a chatbot that will interact with your Indices. See all chat engines [here](/packages/core/src/engines/chat).
- [SimplePrompt](/packages/llamaindex/src/Prompt.ts): A simple standardized function call definition that takes in inputs and formats them in a template literal. SimplePrompts can be specialized using currying and combined using other SimplePrompt functions.
- [SimplePrompt](/packages/core/src/Prompt.ts): A simple standardized function call definition that takes in inputs and formats them in a template literal. SimplePrompts can be specialized using currying and combined using other SimplePrompt functions.
## Tips when using in non-Node.js environments
-21
View File
@@ -1,26 +1,5 @@
# docs
## 0.0.27
### Patch Changes
- Updated dependencies [3c47910]
- Updated dependencies [ed467a9]
- Updated dependencies [cba5406]
- llamaindex@0.4.1
## 0.0.26
### Patch Changes
- b1a4a74: docs: updated Bedrock Opus region and added a basic README
- Updated dependencies [436bc41]
- Updated dependencies [a44e54f]
- Updated dependencies [a51ed8d]
- Updated dependencies [d3b635b]
- llamaindex@0.4.0
- @llamaindex/examples@0.0.5
## 0.0.25
### Patch Changes
+1 -1
View File
@@ -35,7 +35,7 @@ For more complex applications, our lower-level APIs allow advanced users to cust
`npm install llamaindex`
Our documentation includes [Installation Instructions](./getting_started/installation.mdx) and a [Starter Tutorial](./getting_started/starter_tutorial/retrieval_augmented_generation.mdx) to build your first application.
Our documentation includes [Installation Instructions](./getting_started/installation.mdx) and a [Starter Tutorial](./getting_started/starter.mdx) to build your first application.
Once you're up and running, [High-Level Concepts](./getting_started/concepts.md) has an overview of LlamaIndex's modular architecture. For more hands-on practical examples, look through our Examples section on the sidebar.
@@ -23,8 +23,7 @@ ANTHROPIC_CLAUDE_2 = "anthropic.claude-v2";
ANTHROPIC_CLAUDE_2_1 = "anthropic.claude-v2:1";
ANTHROPIC_CLAUDE_3_SONNET = "anthropic.claude-3-sonnet-20240229-v1:0";
ANTHROPIC_CLAUDE_3_HAIKU = "anthropic.claude-3-haiku-20240307-v1:0";
ANTHROPIC_CLAUDE_3_OPUS = "anthropic.claude-3-opus-20240229-v1:0"; // available on us-west-2
ANTHROPIC_CLAUDE_3_5_SONNET = "anthropic.claude-3-5-sonnet-20240620-v1:0";
ANTHROPIC_CLAUDE_3_OPUS = "anthropic.claude-3-opus-20240229-v1:0"; // Not currently on Bedrock
```
Sonnet, Haiku and Opus are multimodal, image_url only supports base64 data url format, e.g. `data:image/jpeg;base64,SGVsbG8sIFdvcmxkIQ==`
+1 -1
View File
@@ -167,7 +167,7 @@ const config = {
[
"docusaurus-plugin-typedoc",
{
entryPoints: ["../../packages/llamaindex/src/index.ts"],
entryPoints: ["../../packages/core/src/index.ts"],
tsconfig: "../../tsconfig.json",
readme: "none",
sourceLinkTemplate:
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "0.0.27",
"version": "0.0.25",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
@@ -37,7 +37,7 @@
"docusaurus-plugin-typedoc": "^1.0.1",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^4.0.1",
"typescript": "^5.5.2"
"typescript": "^5.4.5"
},
"browserslist": {
"production": [
-10
View File
@@ -1,15 +1,5 @@
# examples
## 0.0.5
### Patch Changes
- Updated dependencies [436bc41]
- Updated dependencies [a44e54f]
- Updated dependencies [a51ed8d]
- Updated dependencies [d3b635b]
- llamaindex@0.4.0
## 0.0.4
### Patch Changes
+1 -1
View File
@@ -53,7 +53,7 @@ async function main() {
message: "How much is 5 + 5? then divide by 2",
});
console.log(response.message);
console.log(response.response.message);
}
void main().then(() => {
+1 -1
View File
@@ -68,7 +68,7 @@ async function main() {
});
// Chat with the agent
const response = await agent.chat({
const { response } = await agent.chat({
message: "Divide 16 by 2 then add 20",
});
+1 -1
View File
@@ -31,7 +31,7 @@ async function main() {
tools: [queryEngineTool],
});
const response = await agent.chat({
const { response } = await agent.chat({
message: "What was his salary?",
});
+3 -1
View File
@@ -68,7 +68,9 @@ async function main() {
console.log("Response:");
for await (const { delta } of stream) {
for await (const {
response: { delta },
} of stream) {
process.stdout.write(delta);
}
}
+3 -1
View File
@@ -16,7 +16,9 @@ async function main() {
stream: true,
});
for await (const { delta } of response) {
for await (const {
response: { delta },
} of response) {
process.stdout.write(delta);
}
}
+1 -1
View File
@@ -35,4 +35,4 @@ async function main() {
console.log(response.response);
}
main().catch(console.error);
await main();
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/examples",
"private": true,
"version": "0.0.5",
"version": "0.0.4",
"dependencies": {
"@aws-crypto/sha256-js": "^5.2.0",
"@datastax/astra-db-ts": "^1.2.1",
@@ -12,15 +12,15 @@
"commander": "^12.1.0",
"dotenv": "^16.4.5",
"js-tiktoken": "^1.0.12",
"llamaindex": "^0.4.0",
"llamaindex": "^0.3.14",
"mongodb": "^6.7.0",
"pathe": "^1.1.2"
},
"devDependencies": {
"@types/node": "^20.14.1",
"ts-node": "^10.9.2",
"tsx": "^4.15.6",
"typescript": "^5.5.2"
"tsx": "^4.11.2",
"typescript": "^5.4.5"
},
"scripts": {
"lint": "eslint ."
+2 -2
View File
@@ -19,7 +19,7 @@
},
"devDependencies": {
"@types/node": "^20.12.11",
"tsx": "^4.15.6",
"typescript": "^5.5.2"
"tsx": "^4.9.3",
"typescript": "^5.4.5"
}
}
+9 -9
View File
@@ -14,25 +14,25 @@
"type-check": "tsc -b --diagnostics",
"release": "pnpm run check-minor-version && pnpm run build:release && changeset publish",
"release-snapshot": "pnpm run check-minor-version && pnpm run build:release && changeset publish --tag snapshot",
"check-minor-version": "node ./scripts/check-minor-version.mjs",
"new-version": "changeset version && pnpm run check-minor-version && pnpm format:write && pnpm install && pnpm run build:release",
"check-minor-version": "node ./scripts/check-minor-version",
"new-version": "changeset version && pnpm run check-minor-version && pnpm format:write && pnpm run build:release",
"new-snapshot": "pnpm run build:release && changeset version --snapshot"
},
"devDependencies": {
"@changesets/cli": "^2.27.5",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.4",
"eslint-config-next": "^14.2.3",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^1.13.4",
"eslint-config-turbo": "^1.13.3",
"eslint-plugin-react": "7.34.1",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"lint-staged": "^15.2.5",
"madge": "^7.0.0",
"prettier": "^3.3.2",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"turbo": "^1.13.4",
"typescript": "^5.5.2"
"turbo": "^1.13.3",
"typescript": "^5.4.5"
},
"packageManager": "pnpm@9.0.5",
"pnpm": {
-11
View File
@@ -1,11 +0,0 @@
# @llamaindex/autotool
## 1.0.0
### Patch Changes
- Updated dependencies [436bc41]
- Updated dependencies [a44e54f]
- Updated dependencies [a51ed8d]
- Updated dependencies [d3b635b]
- llamaindex@0.4.0
@@ -5,10 +5,10 @@
"dependencies": {
"@llamaindex/autotool": "workspace:*",
"llamaindex": "workspace:*",
"openai": "^4.52.0"
"openai": "^4.43.0"
},
"devDependencies": {
"tsx": "^4.15.6"
"tsx": "^4.9.3"
},
"scripts": {
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
@@ -1,26 +1,5 @@
# @llamaindex/autotool-02-next-example
## 0.1.11
### Patch Changes
- Updated dependencies [3c47910]
- Updated dependencies [ed467a9]
- Updated dependencies [cba5406]
- llamaindex@0.4.1
- @llamaindex/autotool@1.0.0
## 0.1.10
### Patch Changes
- Updated dependencies [436bc41]
- Updated dependencies [a44e54f]
- Updated dependencies [a51ed8d]
- Updated dependencies [d3b635b]
- llamaindex@0.4.0
- @llamaindex/autotool@1.0.0
## 0.1.9
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/autotool-02-next-example",
"private": true,
"version": "0.1.11",
"version": "0.1.9",
"scripts": {
"dev": "next dev",
"build": "next build",
@@ -9,8 +9,8 @@
},
"dependencies": {
"@llamaindex/autotool": "workspace:*",
"@radix-ui/react-slot": "^1.1.0",
"ai": "^3.2.1",
"@radix-ui/react-slot": "^1.0.2",
"ai": "^3.1.3",
"class-variance-authority": "^0.7.0",
"dotenv": "^16.3.1",
"llamaindex": "workspace:*",
@@ -20,18 +20,18 @@
"react-dom": "^18.3.1",
"react-markdown": "^9.0.1",
"react-syntax-highlighter": "^15.5.0",
"sonner": "^1.5.0",
"sonner": "^1.4.41",
"tailwind-merge": "^2.1.0"
},
"devDependencies": {
"@types/node": "^20.12.11",
"@types/react": "^18.3.3",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@types/react-syntax-highlighter": "^15.5.11",
"autoprefixer": "^10.4.16",
"cross-env": "^7.0.3",
"postcss": "^8.4.32",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.2"
"tailwindcss": "^3.3.6",
"typescript": "^5.4.5"
}
}
+10 -10
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/autotool",
"type": "module",
"version": "1.0.0",
"version": "0.0.1",
"description": "auto transpile your JS function to LLM Agent compatible",
"files": [
"dist",
@@ -45,13 +45,13 @@
"dev": "bunchee --watch"
},
"dependencies": {
"@swc/core": "^1.6.3",
"jotai": "^2.8.3",
"@swc/core": "^1.5.5",
"jotai": "^2.8.0",
"typedoc": "^0.25.13",
"unplugin": "^1.10.1"
},
"peerDependencies": {
"llamaindex": "^0.4.1",
"llamaindex": "^0.3.17",
"openai": "^4",
"typescript": "^4"
},
@@ -67,16 +67,16 @@
}
},
"devDependencies": {
"@swc/types": "^0.1.8",
"@swc/types": "^0.1.6",
"@types/json-schema": "^7.0.15",
"@types/node": "^20.12.11",
"bunchee": "^5.2.1",
"bunchee": "^5.1.5",
"llamaindex": "workspace:*",
"next": "14.2.3",
"rollup": "^4.18.0",
"tsx": "^4.15.6",
"typescript": "^5.5.2",
"rollup": "^4.17.2",
"tsx": "^4.9.3",
"typescript": "^5.4.5",
"vitest": "^1.6.0",
"webpack": "^5.92.1"
"webpack": "^5.91.0"
}
}
+1 -1
View File
@@ -10,7 +10,7 @@
"include": ["./src"],
"references": [
{
"path": "../llamaindex/tsconfig.json"
"path": "../core/tsconfig.json"
},
{
"path": "../env/tsconfig.json"
-21
View File
@@ -1,26 +1,5 @@
# @llamaindex/community
## 0.0.5
### Patch Changes
- ed467a9: Add model ids for Anthropic Claude 3.5 Sonnet model on Anthropic and Bedrock
- Updated dependencies [3c47910]
- Updated dependencies [ed467a9]
- Updated dependencies [cba5406]
- llamaindex@0.4.1
## 0.0.4
### Patch Changes
- b1a4a74: docs: updated Bedrock Opus region and added a basic README
- Updated dependencies [436bc41]
- Updated dependencies [a44e54f]
- Updated dependencies [a51ed8d]
- Updated dependencies [d3b635b]
- llamaindex@0.4.0
## 0.0.3
### Patch Changes
-11
View File
@@ -1,11 +0,0 @@
# @llamaindex/community
> Tools written by the community for llamaindex
## Current Features:
- Bedrock support for the Anthropic Claude Models [usage](https://ts.llamaindex.ai/modules/llms/available_llms/bedrock)
## LICENSE
MIT
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/community",
"description": "Community package for LlamaIndexTS",
"version": "0.0.5",
"version": "0.0.3",
"type": "module",
"types": "dist/type/index.d.ts",
"main": "dist/cjs/index.js",
@@ -45,12 +45,12 @@
},
"devDependencies": {
"@swc/cli": "^0.3.12",
"@swc/core": "^1.6.3",
"@swc/core": "^1.5.5",
"concurrently": "^8.2.2",
"tsup": "^8.1.0"
},
"dependencies": {
"@aws-sdk/client-bedrock-runtime": "^3.600.0",
"@aws-sdk/client-bedrock-runtime": "^3.582.0",
"@types/node": "^20.14.2",
"llamaindex": "workspace:*"
}
@@ -67,7 +67,6 @@ export enum BEDROCK_MODELS {
ANTHROPIC_CLAUDE_3_SONNET = "anthropic.claude-3-sonnet-20240229-v1:0",
ANTHROPIC_CLAUDE_3_HAIKU = "anthropic.claude-3-haiku-20240307-v1:0",
ANTHROPIC_CLAUDE_3_OPUS = "anthropic.claude-3-opus-20240229-v1:0",
ANTHROPIC_CLAUDE_3_5_SONNET = "anthropic.claude-3-5-sonnet-20240620-v1:0",
META_LLAMA2_13B_CHAT = "meta.llama2-13b-chat-v1",
META_LLAMA2_70B_CHAT = "meta.llama2-70b-chat-v1",
META_LLAMA3_8B_INSTRUCT = "meta.llama3-8b-instruct-v1:0",
@@ -101,7 +100,6 @@ const CHAT_ONLY_MODELS = {
[BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_SONNET]: 200000,
[BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_HAIKU]: 200000,
[BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_OPUS]: 200000,
[BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_5_SONNET]: 200000,
[BEDROCK_MODELS.META_LLAMA2_13B_CHAT]: 2048,
[BEDROCK_MODELS.META_LLAMA2_70B_CHAT]: 4096,
[BEDROCK_MODELS.META_LLAMA3_8B_INSTRUCT]: 8192,
@@ -128,7 +126,6 @@ export const STREAMING_MODELS = new Set([
BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_SONNET,
BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_HAIKU,
BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_OPUS,
BEDROCK_MODELS.ANTHROPIC_CLAUDE_3_5_SONNET,
BEDROCK_MODELS.META_LLAMA2_13B_CHAT,
BEDROCK_MODELS.META_LLAMA2_70B_CHAT,
BEDROCK_MODELS.META_LLAMA3_8B_INSTRUCT,
+1 -1
View File
@@ -13,7 +13,7 @@
"exclude": ["node_modules"],
"references": [
{
"path": "../llamaindex/tsconfig.json"
"path": "../core/tsconfig.json"
}
]
}
@@ -1,27 +1,5 @@
# llamaindex
## 0.4.1
### Patch Changes
- 3c47910: fix: groq llm
- ed467a9: Add model ids for Anthropic Claude 3.5 Sonnet model on Anthropic and Bedrock
- cba5406: fix: every Llama Parse job being called "blob"
- Updated dependencies [56fabbb]
- @llamaindex/env@0.1.4
## 0.4.0
### Minor Changes
- 436bc41: Unify chat engine response and agent response
### Patch Changes
- a44e54f: Truncate text to embed for OpenAI if it exceeds maxTokens
- a51ed8d: feat: add support for managed identity for Azure OpenAI
- d3b635b: fix: agents to use chat history
## 0.3.17
### Patch Changes
@@ -41,7 +41,7 @@ To run them, run
pnpm run test
```
To write new test cases write them in [packages/core/src/tests](/packages/llamaindex/src/tests)
To write new test cases write them in [packages/core/src/tests](/packages/core/src/tests)
We use Jest https://jestjs.io/ to write our test cases. Jest comes with a bunch of built in assertions using the expect function: https://jestjs.io/docs/expect
@@ -1,24 +1,5 @@
# @llamaindex/cloudflare-worker-agent-test
## 0.0.20
### Patch Changes
- Updated dependencies [3c47910]
- Updated dependencies [ed467a9]
- Updated dependencies [cba5406]
- llamaindex@0.4.1
## 0.0.19
### Patch Changes
- Updated dependencies [436bc41]
- Updated dependencies [a44e54f]
- Updated dependencies [a51ed8d]
- Updated dependencies [d3b635b]
- llamaindex@0.4.0
## 0.0.18
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloudflare-worker-agent-test",
"version": "0.0.20",
"version": "0.0.18",
"type": "module",
"private": true,
"scripts": {
@@ -16,7 +16,7 @@
"@cloudflare/workers-types": "^4.20240605.0",
"@vitest/runner": "1.3.0",
"@vitest/snapshot": "1.3.0",
"typescript": "^5.5.2",
"typescript": "^5.4.5",
"vitest": "1.3.0",
"wrangler": "^3.60.1"
},
@@ -21,7 +21,7 @@ export default {
// @ts-expect-error: see https://github.com/cloudflare/workerd/issues/2067
new TransformStream({
transform: (chunk, controller) => {
controller.enqueue(textEncoder.encode(chunk.delta));
controller.enqueue(textEncoder.encode(chunk.response.delta));
},
}),
);
@@ -1,24 +1,5 @@
# @llamaindex/next-agent-test
## 0.1.20
### Patch Changes
- Updated dependencies [3c47910]
- Updated dependencies [ed467a9]
- Updated dependencies [cba5406]
- llamaindex@0.4.1
## 0.1.19
### Patch Changes
- Updated dependencies [436bc41]
- Updated dependencies [a44e54f]
- Updated dependencies [a51ed8d]
- Updated dependencies [d3b635b]
- llamaindex@0.4.0
## 0.1.18
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-agent-test",
"version": "0.1.20",
"version": "0.1.18",
"private": true,
"scripts": {
"dev": "next dev",
@@ -9,20 +9,20 @@
"lint": "next lint"
},
"dependencies": {
"ai": "^3.2.1",
"ai": "^3.1.3",
"llamaindex": "workspace:*",
"next": "14.2.4",
"next": "14.2.3",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/node": "^20.12.11",
"@types/react": "^18.3.3",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"eslint": "^8.57.0",
"eslint-config-next": "14.2.3",
"postcss": "^8",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.2"
"tailwindcss": "^3.4.1",
"typescript": "^5.4.5"
}
}

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 629 B

After

Width:  |  Height:  |  Size: 629 B

@@ -23,7 +23,7 @@ export async function chatWithAgent(
uiStream.update("response:");
},
write: async (message) => {
uiStream.append(message.delta);
uiStream.append(message.response.delta);
},
}),
)

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

@@ -1,12 +1,12 @@
"use client";
import { chatWithAgent } from "@/actions";
import type { ReactNode } from "react";
import type { JSX } from "react";
import { useFormState } from "react-dom";
export const runtime = "edge";
export default function Home() {
const [state, action] = useFormState<ReactNode>(async () => {
const [state, action] = useFormState<JSX.Element | null>(async () => {
return chatWithAgent("hello!", []);
}, null);
return (
@@ -1,24 +1,5 @@
# test-edge-runtime
## 0.1.19
### Patch Changes
- Updated dependencies [3c47910]
- Updated dependencies [ed467a9]
- Updated dependencies [cba5406]
- llamaindex@0.4.1
## 0.1.18
### Patch Changes
- Updated dependencies [436bc41]
- Updated dependencies [a44e54f]
- Updated dependencies [a51ed8d]
- Updated dependencies [d3b635b]
- llamaindex@0.4.0
## 0.1.17
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/nextjs-edge-runtime-test",
"version": "0.1.19",
"version": "0.1.17",
"private": true,
"scripts": {
"dev": "next dev",
@@ -9,14 +9,14 @@
},
"dependencies": {
"llamaindex": "workspace:*",
"next": "14.2.4",
"next": "14.2.3",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/node": "^20.12.11",
"@types/react": "^18.3.3",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"typescript": "^5.5.2"
"typescript": "^5.4.5"
}
}

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 629 B

After

Width:  |  Height:  |  Size: 629 B

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

@@ -1,24 +1,5 @@
# @llamaindex/waku-query-engine-test
## 0.0.20
### Patch Changes
- Updated dependencies [3c47910]
- Updated dependencies [ed467a9]
- Updated dependencies [cba5406]
- llamaindex@0.4.1
## 0.0.19
### Patch Changes
- Updated dependencies [436bc41]
- Updated dependencies [a44e54f]
- Updated dependencies [a51ed8d]
- Updated dependencies [d3b635b]
- llamaindex@0.4.0
## 0.0.18
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/waku-query-engine-test",
"version": "0.0.20",
"version": "0.0.18",
"type": "module",
"private": true,
"scripts": {

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

@@ -2,7 +2,7 @@ import { consola } from "consola";
import { Anthropic, FunctionTool, Settings, type LLM } from "llamaindex";
import { AnthropicAgent } from "llamaindex/agent/anthropic";
import { extractText } from "llamaindex/llm/utils";
import { ok } from "node:assert";
import { ok, strictEqual } from "node:assert";
import { beforeEach, test } from "node:test";
import { getWeatherTool, sumNumbersTool } from "./fixtures/tools.js";
import { mockLLMEvent } from "./utils.js";
@@ -71,11 +71,12 @@ await test("anthropic agent", async (t) => {
},
],
});
const response = await agent.chat({
const { response, sources } = await agent.chat({
message: "What is the weather in San Francisco?",
});
consola.debug("response:", response.message.content);
strictEqual(sources.length, 1);
ok(extractText(response.message.content).includes("35"));
});
@@ -109,7 +110,7 @@ await test("anthropic agent", async (t) => {
const agent = new AnthropicAgent({
tools: [showUniqueId],
});
const response = await agent.chat({
const { response } = await agent.chat({
message: "My name is Alex Yang. What is my unique id?",
});
consola.debug("response:", response.message.content);
@@ -121,7 +122,7 @@ await test("anthropic agent", async (t) => {
tools: [sumNumbersTool],
});
const response = await anthropicAgent.chat({
const { response } = await anthropicAgent.chat({
message: "how much is 1 + 1?",
});
@@ -136,35 +137,35 @@ await test("anthropic agent with multiple chat", async (t) => {
tools: [getWeatherTool],
});
{
const response = await agent.chat({
const { response } = await agent.chat({
message: 'Hello? Response to me "Yes"',
});
consola.debug("response:", response.message.content);
ok(extractText(response.message.content).includes("Yes"));
}
{
const response = await agent.chat({
const { response } = await agent.chat({
message: 'Hello? Response to me "No"',
});
consola.debug("response:", response.message.content);
ok(extractText(response.message.content).includes("No"));
}
{
const response = await agent.chat({
const { response } = await agent.chat({
message: 'Hello? Response to me "Maybe"',
});
consola.debug("response:", response.message.content);
ok(extractText(response.message.content).includes("Maybe"));
}
{
const response = await agent.chat({
const { response } = await agent.chat({
message: "What is the weather in San Francisco?",
});
consola.debug("response:", response.message.content);
ok(extractText(response.message.content).includes("72"));
}
{
const response = await agent.chat({
const { response } = await agent.chat({
message: "What is the weather in Shanghai?",
});
consola.debug("response:", response.message.content);

Some files were not shown because too many files have changed in this diff Show More