Compare commits

..

5 Commits

Author SHA1 Message Date
Alex Yang ca50443f7b Update .changeset/hip-windows-tease.md 2024-12-09 21:00:29 -08:00
Marcus Schiesser 1b60005018 Merge branch 'main' into ms/add-vercel-adapter 2024-12-10 11:19:47 +07:00
Marcus Schiesser bc3e840b85 docs: changeset 2024-12-09 15:45:29 +07:00
Marcus Schiesser f73d4c335d add model to llamaindex tool adapter 2024-12-09 15:44:20 +07:00
Marcus Schiesser 24774b0477 feat: add vercelllm adapter 2024-12-09 15:22:55 +07:00
81 changed files with 155 additions and 1312 deletions
+6
View File
@@ -0,0 +1,6 @@
---
"llamaindex": patch
"@llamaindex/env": patch
---
Allow Node 18 again (throw run-time error if not possible) to make Stackblitz work
+5
View File
@@ -0,0 +1,5 @@
---
"@llamaindex/vercel": patch
---
Add VercelLLM (adapter to use any model provider from Vercel AI in LlamaIndex)
+5
View File
@@ -0,0 +1,5 @@
---
"@llamaindex/core": patch
---
The compact and refine response synthesizer (retrieved by using `getResponseSynthesizer('compact')`) has been fixed to return the original source nodes that were provided to it in its response. Previous to this it was returning the compacted text chunk documents.
+5
View File
@@ -0,0 +1,5 @@
---
"llamaindex": patch
---
withLlamaIndex now passes through webpack options to the passed in customized NextJS webpack config. Before it was only passing through the config.
-10
View File
@@ -1,15 +1,5 @@
# docs
## 0.0.133
### Patch Changes
- c1850ee: feat: Amazon Nova support via Bedrock
- Updated dependencies [b504303]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
- @llamaindex/examples@0.0.20
## 0.0.132
### Patch Changes
@@ -37,9 +37,6 @@ META_LLAMA3_2_1B_INSTRUCT = "meta.llama3-2-1b-instruct-v1:0"; // only available
META_LLAMA3_2_3B_INSTRUCT = "meta.llama3-2-3b-instruct-v1:0"; // only available via inference endpoints (see below)
META_LLAMA3_2_11B_INSTRUCT = "meta.llama3-2-11b-instruct-v1:0"; // only available via inference endpoints (see below), multimodal and function call supported
META_LLAMA3_2_90B_INSTRUCT = "meta.llama3-2-90b-instruct-v1:0"; // only available via inference endpoints (see below), multimodal and function call supported
AMAZON_NOVA_PRO_1 = "amazon.nova-pro-v1:0";
AMAZON_NOVA_LITE_1 = "amazon.nova-lite-v1:0";
AMAZON_NOVA_MICRO_1 = "amazon.nova-micro-v1:0";
```
You can also use Bedrock's Inference endpoints by using the model names:
@@ -56,9 +53,6 @@ US_META_LLAMA_3_2_1B_INSTRUCT = "us.meta.llama3-2-1b-instruct-v1:0";
US_META_LLAMA_3_2_3B_INSTRUCT = "us.meta.llama3-2-3b-instruct-v1:0";
US_META_LLAMA_3_2_11B_INSTRUCT = "us.meta.llama3-2-11b-instruct-v1:0";
US_META_LLAMA_3_2_90B_INSTRUCT = "us.meta.llama3-2-90b-instruct-v1:0";
US_AMAZON_NOVA_PRO_1 = "us.amazon.nova-pro-v1:0";
US_AMAZON_NOVA_LITE_1 = "us.amazon.nova-lite-v1:0";
US_AMAZON_NOVA_MICRO_1 = "us.amazon.nova-micro-v1:0";
// EU
EU_ANTHROPIC_CLAUDE_3_HAIKU = "eu.anthropic.claude-3-haiku-20240307-v1:0";
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "0.0.133",
"version": "0.0.132",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
-15
View File
@@ -1,20 +1,5 @@
# @llamaindex/doc
## 0.0.31
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
- @llamaindex/core@0.4.18
- @llamaindex/cloud@2.0.18
- @llamaindex/node-parser@0.0.19
- @llamaindex/openai@0.1.43
- @llamaindex/readers@1.0.20
- @llamaindex/workflow@0.0.8
## 0.0.30
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/doc",
"version": "0.0.31",
"version": "0.0.30",
"private": true,
"scripts": {
"build": "pnpm run build:docs && next build",
@@ -1,13 +1,5 @@
# @llamaindex/cloudflare-worker-agent-test
## 0.0.123
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
## 0.0.122
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloudflare-worker-agent-test",
"version": "0.0.123",
"version": "0.0.122",
"type": "module",
"private": true,
"scripts": {
@@ -1,11 +1,5 @@
# @llamaindex/llama-parse-browser-test
## 0.0.38
### Patch Changes
- @llamaindex/cloud@2.0.18
## 0.0.37
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/llama-parse-browser-test",
"private": true,
"version": "0.0.38",
"version": "0.0.37",
"type": "module",
"scripts": {
"dev": "vite",
-8
View File
@@ -1,13 +1,5 @@
# @llamaindex/next-agent-test
## 0.1.123
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
## 0.1.122
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-agent-test",
"version": "0.1.123",
"version": "0.1.122",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,13 +1,5 @@
# test-edge-runtime
## 0.1.122
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
## 0.1.121
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/nextjs-edge-runtime-test",
"version": "0.1.122",
"version": "0.1.121",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,13 +1,5 @@
# @llamaindex/next-node-runtime
## 0.0.104
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
## 0.0.103
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-node-runtime-test",
"version": "0.0.104",
"version": "0.0.103",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,13 +1,5 @@
# @llamaindex/waku-query-engine-test
## 0.0.123
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
## 0.0.122
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/waku-query-engine-test",
"version": "0.0.123",
"version": "0.0.122",
"type": "module",
"private": true,
"scripts": {
-14
View File
@@ -1,19 +1,5 @@
# examples
## 0.0.20
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [086a651]
- Updated dependencies [e0f6cc3]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
- @llamaindex/vercel@0.0.5
- @llamaindex/core@0.4.18
- @llamaindex/readers@1.0.20
- @llamaindex/workflow@0.0.8
## 0.0.19
### Patch Changes
+6 -6
View File
@@ -1,17 +1,17 @@
{
"name": "@llamaindex/examples",
"private": true,
"version": "0.0.20",
"version": "0.0.19",
"dependencies": {
"@ai-sdk/openai": "^1.0.5",
"@aws-crypto/sha256-js": "^5.2.0",
"@azure/cosmos": "^4.1.1",
"@azure/identity": "^4.4.1",
"@datastax/astra-db-ts": "^1.4.1",
"@llamaindex/core": "^0.4.18",
"@llamaindex/readers": "^1.0.20",
"@llamaindex/workflow": "^0.0.8",
"@llamaindex/vercel": "^0.0.5",
"@llamaindex/core": "^0.4.17",
"@llamaindex/readers": "^1.0.19",
"@llamaindex/workflow": "^0.0.7",
"@llamaindex/vercel": "^0.0.4",
"@notionhq/client": "^2.2.15",
"@pinecone-database/pinecone": "^4.0.0",
"@vercel/postgres": "^0.10.0",
@@ -21,7 +21,7 @@
"commander": "^12.1.0",
"dotenv": "^16.4.5",
"js-tiktoken": "^1.0.14",
"llamaindex": "^0.8.27",
"llamaindex": "^0.8.26",
"mongodb": "^6.7.0",
"pathe": "^1.1.2",
"postgres": "^3.4.4"
-8
View File
@@ -1,13 +1,5 @@
# @llamaindex/autotool
## 5.0.27
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
## 5.0.26
### Patch Changes
@@ -1,14 +1,5 @@
# @llamaindex/autotool-01-node-example
## 0.0.70
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
- @llamaindex/autotool@5.0.27
## 0.0.69
### Patch Changes
@@ -13,5 +13,5 @@
"scripts": {
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
},
"version": "0.0.70"
"version": "0.0.69"
}
@@ -1,14 +1,5 @@
# @llamaindex/autotool-02-next-example
## 0.1.114
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
- @llamaindex/autotool@5.0.27
## 0.1.113
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/autotool-02-next-example",
"private": true,
"version": "0.1.114",
"version": "0.1.113",
"scripts": {
"dev": "next dev",
"build": "next build",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/autotool",
"type": "module",
"version": "5.0.27",
"version": "5.0.26",
"description": "auto transpile your JS function to LLM Agent compatible",
"files": [
"dist",
-9
View File
@@ -1,14 +1,5 @@
# @llamaindex/cloud
## 2.0.18
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
## 2.0.17
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloud",
"version": "2.0.18",
"version": "2.0.17",
"type": "module",
"license": "MIT",
"scripts": {
-10
View File
@@ -1,15 +1,5 @@
# @llamaindex/community
## 0.0.76
### Patch Changes
- c1850ee: feat: Amazon Nova support via Bedrock
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
## 0.0.75
### Patch Changes
-1
View File
@@ -4,7 +4,6 @@
## Current Features:
- Bedrock support for Amazon Nova models Pro, Lite and Micro
- Bedrock support for the Anthropic Claude Models [usage](https://ts.llamaindex.ai/modules/llms/available_llms/bedrock) including the latest Sonnet 3.5 v2 and Haiku 3.5
- Bedrock support for the Meta LLama 2, 3, 3.1 and 3.2 Models [usage](https://ts.llamaindex.ai/modules/llms/available_llms/bedrock)
- Meta LLama3.1 405b and Llama3.2 tool call support
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/community",
"description": "Community package for LlamaIndexTS",
"version": "0.0.76",
"version": "0.0.75",
"type": "module",
"types": "dist/type/index.d.ts",
"main": "dist/cjs/index.js",
@@ -46,8 +46,8 @@
"bunchee": "5.6.1"
},
"dependencies": {
"@aws-sdk/client-bedrock-agent-runtime": "^3.706.0",
"@aws-sdk/client-bedrock-runtime": "^3.706.0",
"@aws-sdk/client-bedrock-agent-runtime": "^3.693.0",
"@aws-sdk/client-bedrock-runtime": "^3.693.0",
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*"
}
@@ -1,133 +0,0 @@
import type {
ContentBlockDelta,
ConverseOutput,
ConverseRequest,
ConverseResponse,
ConverseStreamOutput,
InvokeModelCommandInput,
InvokeModelWithResponseStreamCommandInput,
ResponseStream,
} from "@aws-sdk/client-bedrock-runtime";
import type {
BaseTool,
ChatMessage,
LLMMetadata,
ToolCall,
ToolCallLLMMessageOptions,
} from "@llamaindex/core/llms";
import { toUtf8 } from "../utils";
import { Provider, type BedrockChatStreamResponse } from "../provider";
import {
mapBaseToolsToAmazonTools,
mapChatMessagesToAmazonMessages,
} from "./utils";
export class AmazonProvider extends Provider<ConverseStreamOutput> {
getResultFromResponse(response: Record<string, any>): ConverseResponse {
return JSON.parse(toUtf8(response.body));
}
getToolsFromResponse<ToolContent>(response: ConverseOutput): ToolContent[] {
return (
response.message?.content
?.filter((item) => item.toolUse)
.map(
(item) =>
({
id: item.toolUse!.toolUseId,
name: item.toolUse!.name,
input: item.toolUse!.input
? JSON.parse(item.toolUse!.input as string)
: "",
}) as ToolContent,
) ?? []
);
}
getTextFromResponse(response: ConverseResponse): string {
const result = this.getResultFromResponse(response);
const content = result.output?.message?.content ?? [];
return content.map((item) => item.text).join(" ");
}
getTextFromStreamResponse(response: ResponseStream): string {
let event: ConverseStreamOutput | undefined =
this.getStreamingEventResponse(response);
if (!event || !event.contentBlockDelta) return "";
const delta: ContentBlockDelta | undefined = event.contentBlockDelta.delta;
return delta?.text || "";
}
async *reduceStream(
stream: AsyncIterable<ResponseStream>,
): BedrockChatStreamResponse {
let toolId: string | undefined = undefined;
let toolName: string | undefined = undefined;
for await (const response of stream) {
const event = this.getStreamingEventResponse(response);
const delta = this.getTextFromStreamResponse(response);
let options: undefined | ToolCallLLMMessageOptions = undefined;
if (event?.contentBlockStart && event.contentBlockStart.start?.toolUse) {
toolId = event.contentBlockStart.start?.toolUse.toolUseId;
toolName = event.contentBlockStart.start?.toolUse.name;
continue;
}
if (
toolId &&
toolName &&
event?.contentBlockDelta?.delta?.toolUse?.input
) {
options = {
toolCall: [
{
id: toolId,
name: toolName,
input: JSON.parse(event?.contentBlockDelta?.delta?.toolUse.input),
} as ToolCall,
],
};
toolId = undefined;
toolName = undefined;
}
if (!delta && !options) continue;
yield {
delta: options ? "" : delta,
options,
raw: response,
};
}
}
getRequestBody<T extends ChatMessage>(
metadata: LLMMetadata,
messages: T[],
tools: BaseTool[] = [],
options: Omit<ConverseRequest, "modelId" | "messages" | "inferenceConfig">,
): InvokeModelCommandInput | InvokeModelWithResponseStreamCommandInput {
const request: Omit<ConverseRequest, "modelId"> = {
...options,
messages: mapChatMessagesToAmazonMessages(messages),
inferenceConfig: {
maxTokens: metadata.maxTokens,
temperature: metadata.temperature,
topP: metadata.topP,
},
};
if (tools.length) {
request.toolConfig = {
tools: mapBaseToolsToAmazonTools(tools),
};
}
return {
modelId: metadata.model,
contentType: "application/json",
accept: "application/json",
body: JSON.stringify(request),
};
}
}
@@ -1,5 +0,0 @@
import type { ConverseRequest, Message } from "@aws-sdk/client-bedrock-runtime";
export type AmazonMessages = ConverseRequest["messages"];
export type AmazonMessage = Message;
@@ -1,141 +0,0 @@
import type {
ImageBlock,
ImageFormat,
Message,
Tool,
} from "@aws-sdk/client-bedrock-runtime";
import type {
BaseTool,
ChatMessage,
MessageContentDetail,
ToolCallLLMMessageOptions,
} from "@llamaindex/core/llms";
import {
extractDataUrlComponents,
mapMessageContentToMessageContentDetails,
} from "../utils";
import type { JSONObject } from "@llamaindex/core/global";
import type { AmazonMessage, AmazonMessages } from "./types";
const ACCEPTED_IMAGE_MIME_TYPES = [
"image/jpeg",
"image/png",
"image/webp",
"image/gif",
] as const;
const ACCEPTED_IMAGE_MIME_TYPE_FORMAT_MAP: Record<
(typeof ACCEPTED_IMAGE_MIME_TYPES)[number],
ImageFormat
> = {
"image/jpeg": "jpeg",
"image/png": "png",
"image/webp": "webp",
"image/gif": "gif",
};
export const mapImageContent = (imageUrl: string): ImageBlock => {
if (!imageUrl.startsWith("data:"))
throw new Error(
"For Amazon please only use base64 data url, e.g.: data:image/jpeg;base64,SGVsbG8sIFdvcmxkIQ==",
);
const { mimeType, base64: data } = extractDataUrlComponents(imageUrl);
if (
!ACCEPTED_IMAGE_MIME_TYPES.includes(
mimeType as keyof typeof ACCEPTED_IMAGE_MIME_TYPE_FORMAT_MAP,
)
)
throw new Error(
`Amazon only accepts the following mimeTypes: ${ACCEPTED_IMAGE_MIME_TYPES.join("\n")}`,
);
return {
format:
ACCEPTED_IMAGE_MIME_TYPE_FORMAT_MAP[
mimeType as keyof typeof ACCEPTED_IMAGE_MIME_TYPE_FORMAT_MAP
],
// @ts-ignore: there's a mistake in the "@aws-sdk/client-bedrock-runtime" compared to the actual api
source: { bytes: data },
};
};
export const mapMessageContentDetailToAmazonContent = <
T extends MessageContentDetail,
>(
detail: T,
): Message["content"] => {
let content: Message["content"] = [];
if (detail.type === "text") {
content = [{ text: detail.text }];
} else if (detail.type === "image_url") {
content = [{ image: mapImageContent(detail.image_url.url) }];
} else {
throw new Error("Unsupported content detail type");
}
return content;
};
export const mapChatMessagesToAmazonMessages = <
T extends ChatMessage<ToolCallLLMMessageOptions>,
>(
messages: T[],
): AmazonMessages => {
return messages.flatMap((msg: T): AmazonMessage[] => {
return mapMessageContentToMessageContentDetails(msg.content).map(
(detail: MessageContentDetail): AmazonMessage => {
if (msg.options && "toolCall" in msg.options) {
return {
role: "assistant",
content: msg.options.toolCall.map((call) => ({
toolUse: {
toolUseId: call.id,
name: call.name,
input: call.input as JSONObject,
},
})),
};
}
if (msg.options && "toolResult" in msg.options) {
return {
role: "user",
content: [
{
toolResult: {
toolUseId: msg.options.toolResult.id,
content: [
{
text: msg.options.toolResult.result,
},
],
},
},
],
};
}
return {
role: msg.role === "assistant" ? "assistant" : "user",
content: mapMessageContentDetailToAmazonContent(detail),
};
},
);
});
};
export const mapBaseToolsToAmazonTools = (tools?: BaseTool[]): Tool[] => {
if (!tools) return [];
return tools.map((tool: BaseTool) => {
const {
metadata: { parameters, ...options },
} = tool;
return {
toolSpec: {
...options,
inputSchema: parameters,
},
} as Tool;
});
};
@@ -11,10 +11,13 @@ import type {
ToolCall,
ToolCallLLMMessageOptions,
} from "@llamaindex/core/llms";
import { type BedrockChatStreamResponse, Provider } from "../provider";
import {
type BedrockAdditionalChatOptions,
type BedrockChatStreamResponse,
Provider,
} from "../provider";
import { toUtf8 } from "../utils";
import type {
AnthropicAdditionalChatOptions,
AnthropicNoneStreamingResponse,
AnthropicStreamEvent,
AnthropicTextContent,
@@ -131,7 +134,7 @@ export class AnthropicProvider extends Provider<AnthropicStreamEvent> {
metadata: LLMMetadata,
messages: T[],
tools?: BaseTool[],
options?: AnthropicAdditionalChatOptions,
options?: BedrockAdditionalChatOptions,
): InvokeModelCommandInput | InvokeModelWithResponseStreamCommandInput {
const extra: Record<string, unknown> = {};
if (options?.toolChoice) {
@@ -1,13 +1,6 @@
import type { ToolMetadata } from "@llamaindex/core/llms";
import type { InvocationMetrics } from "../types";
export type ToolChoice =
| { type: "any" }
| { type: "auto" }
| { type: "tool"; name: string };
export type AnthropicAdditionalChatOptions = { toolChoice: ToolChoice };
type Usage = {
input_tokens: number;
output_tokens: number;
+5 -25
View File
@@ -25,7 +25,6 @@ import {
import { mapMessageContentToMessageContentDetails } from "./utils";
import { wrapLLMEvent } from "@llamaindex/core/decorator";
import { AmazonProvider } from "./amazon/provider";
import { AnthropicProvider } from "./anthropic/provider";
import { MetaProvider } from "./meta/provider";
@@ -33,7 +32,6 @@ import { MetaProvider } from "./meta/provider";
export const PROVIDERS: { [key: string]: Provider } = {
anthropic: new AnthropicProvider(),
meta: new MetaProvider(),
amazon: new AmazonProvider(),
};
export type BedrockChatParamsStreaming = LLMChatParamsStreaming<
@@ -83,11 +81,7 @@ export const BEDROCK_MODELS = {
MISTRAL_7B_INSTRUCT: "mistral.mistral-7b-instruct-v0:2",
MISTRAL_MIXTRAL_7B_INSTRUCT: "mistral.mixtral-8x7b-instruct-v0:1",
MISTRAL_MIXTRAL_LARGE_2402: "mistral.mistral-large-2402-v1:0",
AMAZON_NOVA_PRO_1: "amazon.nova-pro-v1:0",
AMAZON_NOVA_LITE_1: "amazon.nova-lite-v1:0",
AMAZON_NOVA_MICRO_1: "amazon.nova-micro-v1:0",
};
export type BEDROCK_MODELS =
(typeof BEDROCK_MODELS)[keyof typeof BEDROCK_MODELS];
@@ -104,9 +98,6 @@ export const INFERENCE_BEDROCK_MODELS = {
US_META_LLAMA_3_2_3B_INSTRUCT: "us.meta.llama3-2-3b-instruct-v1:0",
US_META_LLAMA_3_2_11B_INSTRUCT: "us.meta.llama3-2-11b-instruct-v1:0",
US_META_LLAMA_3_2_90B_INSTRUCT: "us.meta.llama3-2-90b-instruct-v1:0",
US_AMAZON_NOVA_PRO_1: "us.amazon.nova-pro-v1:0",
US_AMAZON_NOVA_LITE_1: "us.amazon.nova-lite-v1:0",
US_AMAZON_NOVA_MICRO_1: "us.amazon.nova-micro-v1:0",
EU_ANTHROPIC_CLAUDE_3_HAIKU: "eu.anthropic.claude-3-haiku-20240307-v1:0",
EU_ANTHROPIC_CLAUDE_3_5_HAIKU: "eu.anthropic.claude-3-5-haiku-20240307-v1:0",
@@ -198,9 +189,6 @@ const CHAT_ONLY_MODELS = {
[BEDROCK_MODELS.MISTRAL_7B_INSTRUCT]: 32000,
[BEDROCK_MODELS.MISTRAL_MIXTRAL_7B_INSTRUCT]: 32000,
[BEDROCK_MODELS.MISTRAL_MIXTRAL_LARGE_2402]: 32000,
[BEDROCK_MODELS.AMAZON_NOVA_PRO_1]: 300000,
[BEDROCK_MODELS.AMAZON_NOVA_LITE_1]: 300000,
[BEDROCK_MODELS.AMAZON_NOVA_MICRO_1]: 130000,
};
const BEDROCK_FOUNDATION_LLMS = { ...COMPLETION_MODELS, ...CHAT_ONLY_MODELS };
@@ -237,9 +225,6 @@ export const STREAMING_MODELS = new Set([
BEDROCK_MODELS.MISTRAL_7B_INSTRUCT,
BEDROCK_MODELS.MISTRAL_MIXTRAL_7B_INSTRUCT,
BEDROCK_MODELS.MISTRAL_MIXTRAL_LARGE_2402,
BEDROCK_MODELS.AMAZON_NOVA_PRO_1,
BEDROCK_MODELS.AMAZON_NOVA_LITE_1,
BEDROCK_MODELS.AMAZON_NOVA_MICRO_1,
]);
export const TOOL_CALL_MODELS: BEDROCK_MODELS[] = [
@@ -254,9 +239,6 @@ export const TOOL_CALL_MODELS: BEDROCK_MODELS[] = [
BEDROCK_MODELS.META_LLAMA3_2_3B_INSTRUCT,
BEDROCK_MODELS.META_LLAMA3_2_11B_INSTRUCT,
BEDROCK_MODELS.META_LLAMA3_2_90B_INSTRUCT,
BEDROCK_MODELS.AMAZON_NOVA_PRO_1,
BEDROCK_MODELS.AMAZON_NOVA_LITE_1,
BEDROCK_MODELS.AMAZON_NOVA_MICRO_1,
];
const getProvider = (model: string): Provider => {
@@ -338,6 +320,10 @@ export class Bedrock extends ToolCallLLM<BedrockAdditionalChatOptions> {
this.temperature = temperature ?? DEFAULT_BEDROCK_PARAMS.temperature;
this.topP = topP ?? DEFAULT_BEDROCK_PARAMS.topP;
this.client = new BedrockRuntimeClient(params);
if (!this.supportToolCall) {
console.warn(`The model "${this.model}" doesn't support ToolCall`);
}
}
get supportToolCall(): boolean {
@@ -359,9 +345,6 @@ export class Bedrock extends ToolCallLLM<BedrockAdditionalChatOptions> {
protected async nonStreamChat(
params: BedrockChatParamsNonStreaming,
): Promise<BedrockChatNonStreamResponse> {
if (!this.supportToolCall && params.tools?.length) {
console.warn(`The model "${this.model}" doesn't support ToolCall`);
}
const input = this.provider.getRequestBody(
this.metadata,
params.messages,
@@ -395,10 +378,6 @@ export class Bedrock extends ToolCallLLM<BedrockAdditionalChatOptions> {
if (!STREAMING_MODELS.has(this.model))
throw new Error(`The model: ${this.model} does not support streaming`);
if (!this.supportToolCall && params.tools?.length) {
console.warn(`The model "${this.model}" doesn't support ToolCall`);
}
const input = this.provider.getRequestBody(
this.metadata,
params.messages,
@@ -409,6 +388,7 @@ export class Bedrock extends ToolCallLLM<BedrockAdditionalChatOptions> {
command.input.modelId = this.actualModel;
const response = await this.client.send(command);
if (response.body) yield* this.provider.reduceStream(response.body);
}
@@ -11,9 +11,10 @@ import {
type ToolCallLLMMessageOptions,
} from "@llamaindex/core/llms";
import { streamConverter } from "@llamaindex/core/utils";
import type { ToolChoice } from "./types";
import { toUtf8 } from "./utils";
export type BedrockAdditionalChatOptions = Record<string, unknown>;
export type BedrockAdditionalChatOptions = { toolChoice: ToolChoice };
export type BedrockChatStreamResponse = AsyncIterable<
ChatResponseChunk<ToolCallLLMMessageOptions>
@@ -4,3 +4,8 @@ export type InvocationMetrics = {
invocationLatency: number;
firstByteLatency: number;
};
export type ToolChoice =
| { type: "any" }
| { type: "auto" }
| { type: "tool"; name: string };
-8
View File
@@ -1,13 +1,5 @@
# @llamaindex/core
## 0.4.18
### Patch Changes
- e0f6cc3: The compact and refine response synthesizer (retrieved by using `getResponseSynthesizer('compact')`) has been fixed to return the original source nodes that were provided to it in its response. Previous to this it was returning the compacted text chunk documents.
- Updated dependencies [b504303]
- @llamaindex/env@0.1.25
## 0.4.17
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/core",
"type": "module",
"version": "0.4.18",
"version": "0.4.17",
"description": "LlamaIndex Core Module",
"exports": {
"./agent": {
-6
View File
@@ -1,11 +1,5 @@
# @llamaindex/env
## 0.1.25
### Patch Changes
- b504303: Allow Node 18 again (throw run-time error if not possible) to make Stackblitz work
## 0.1.24
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/env",
"description": "environment wrapper, supports all JS environment including node, deno, bun, edge runtime, and cloudflare worker",
"version": "0.1.25",
"version": "0.1.24",
"type": "module",
"types": "dist/index.d.ts",
"module": "dist/index.js",
-8
View File
@@ -1,13 +1,5 @@
# @llamaindex/experimental
## 0.0.139
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
## 0.0.138
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/experimental",
"description": "Experimental package for LlamaIndexTS",
"version": "0.0.139",
"version": "0.0.138",
"type": "module",
"types": "dist/type/index.d.ts",
"main": "dist/cjs/index.js",
-24
View File
@@ -1,29 +1,5 @@
# llamaindex
## 0.8.27
### Patch Changes
- b504303: Allow Node 18 again (throw run-time error if not possible) to make Stackblitz work
- a0e6f57: withLlamaIndex now passes through webpack options to the passed in customized NextJS webpack config. Before it was only passing through the config.
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
- @llamaindex/cloud@2.0.18
- @llamaindex/node-parser@0.0.19
- @llamaindex/anthropic@0.0.27
- @llamaindex/clip@0.0.27
- @llamaindex/deepinfra@0.0.27
- @llamaindex/groq@0.0.42
- @llamaindex/huggingface@0.0.27
- @llamaindex/ollama@0.0.34
- @llamaindex/openai@0.1.43
- @llamaindex/portkey-ai@0.0.27
- @llamaindex/replicate@0.0.27
- @llamaindex/readers@1.0.20
- @llamaindex/vllm@0.0.13
## 0.8.26
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "llamaindex",
"version": "0.8.27",
"version": "0.8.26",
"license": "MIT",
"type": "module",
"keywords": [
-9
View File
@@ -1,14 +1,5 @@
# @llamaindex/node-parser
## 0.0.19
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
## 0.0.18
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/node-parser",
"version": "0.0.19",
"version": "0.0.18",
"description": "Node parser for LlamaIndex",
"type": "module",
"exports": {
@@ -1,14 +1,5 @@
# @llamaindex/anthropic
## 0.0.27
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
## 0.0.26
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/anthropic",
"description": "Anthropic Adapter for LlamaIndex",
"version": "0.0.27",
"version": "0.0.26",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
-10
View File
@@ -1,15 +1,5 @@
# @llamaindex/clip
## 0.0.27
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
- @llamaindex/openai@0.1.43
## 0.0.26
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/clip",
"description": "Clip Embedding Adapter for LlamaIndex",
"version": "0.0.27",
"version": "0.0.26",
"type": "module",
"types": "dist/index.d.ts",
"main": "dist/index.cjs",
-10
View File
@@ -1,15 +1,5 @@
# @llamaindex/deepinfra
## 0.0.27
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
- @llamaindex/openai@0.1.43
## 0.0.26
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/deepinfra",
"description": "Deepinfra Adapter for LlamaIndex",
"version": "0.0.27",
"version": "0.0.26",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
-8
View File
@@ -1,13 +1,5 @@
# @llamaindex/groq
## 0.0.42
### Patch Changes
- Updated dependencies [b504303]
- @llamaindex/env@0.1.25
- @llamaindex/openai@0.1.43
## 0.0.41
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/groq",
"description": "Groq Adapter for LlamaIndex",
"version": "0.0.42",
"version": "0.0.41",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,15 +1,5 @@
# @llamaindex/huggingface
## 0.0.27
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
- @llamaindex/openai@0.1.43
## 0.0.26
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/huggingface",
"description": "Huggingface Adapter for LlamaIndex",
"version": "0.0.27",
"version": "0.0.26",
"type": "module",
"types": "dist/index.d.ts",
"main": "dist/index.cjs",
-9
View File
@@ -1,14 +1,5 @@
# @llamaindex/ollama
## 0.0.34
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
## 0.0.33
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/ollama",
"description": "Ollama Adapter for LlamaIndex",
"version": "0.0.34",
"version": "0.0.33",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
-9
View File
@@ -1,14 +1,5 @@
# @llamaindex/openai
## 0.1.43
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
## 0.1.42
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/openai",
"description": "OpenAI Adapter for LlamaIndex",
"version": "0.1.43",
"version": "0.1.42",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,14 +1,5 @@
# @llamaindex/portkey-ai
## 0.0.27
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
## 0.0.26
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/portkey-ai",
"description": "Portkey Adapter for LlamaIndex",
"version": "0.0.27",
"version": "0.0.26",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,14 +1,5 @@
# @llamaindex/replicate
## 0.0.27
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
## 0.0.26
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/replicate",
"description": "Replicate Adapter for LlamaIndex",
"version": "0.0.27",
"version": "0.0.26",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
-8
View File
@@ -1,13 +1,5 @@
# @llamaindex/vercel
## 0.0.5
### Patch Changes
- 086a651: Add VercelLLM (adapter to use any model provider from Vercel AI in LlamaIndex)
- Updated dependencies [e0f6cc3]
- @llamaindex/core@0.4.18
## 0.0.4
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/vercel",
"description": "Vercel Adapter for LlamaIndex",
"version": "0.0.5",
"version": "0.0.4",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
-6
View File
@@ -1,11 +1,5 @@
# @llamaindex/vllm
## 0.0.13
### Patch Changes
- @llamaindex/openai@0.1.43
## 0.0.12
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/vllm",
"description": "vLLM Adapter for LlamaIndex",
"version": "0.0.13",
"version": "0.0.12",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
-9
View File
@@ -1,14 +1,5 @@
# @llamaindex/readers
## 1.0.20
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- @llamaindex/env@0.1.25
- @llamaindex/core@0.4.18
## 1.0.19
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/readers",
"description": "LlamaIndex Readers",
"version": "1.0.20",
"version": "1.0.19",
"type": "module",
"exports": {
"./node/hook": "./node/dist/hook.js",
-7
View File
@@ -1,12 +1,5 @@
# @llamaindex/workflow
## 0.0.8
### Patch Changes
- Updated dependencies [b504303]
- @llamaindex/env@0.1.25
## 0.0.7
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/workflow",
"description": "Workflow API",
"version": "0.0.8",
"version": "0.0.7",
"type": "module",
"types": "dist/index.d.ts",
"module": "dist/index.js",
+76 -637
View File
File diff suppressed because it is too large Load Diff
-15
View File
@@ -1,20 +1,5 @@
# @llamaindex/unit-test
## 0.0.37
### Patch Changes
- Updated dependencies [b504303]
- Updated dependencies [e0f6cc3]
- Updated dependencies [a0e6f57]
- llamaindex@0.8.27
- @llamaindex/core@0.4.18
- @llamaindex/cloud@2.0.18
- @llamaindex/node-parser@0.0.19
- @llamaindex/openai@0.1.43
- @llamaindex/readers@1.0.20
- @llamaindex/workflow@0.0.8
## 0.0.36
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/unit-test",
"private": true,
"version": "0.0.37",
"version": "0.0.36",
"type": "module",
"scripts": {
"test": "vitest run"