mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-02 20:13:52 -04:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b3b7fc5551 |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@llamaindex/readers": patch
|
||||
"@llamaindex/core": patch
|
||||
"@llamaindex/doc": patch
|
||||
---
|
||||
|
||||
Expose more content to fix the issue with unavailable documentation links, and adjust the documentation based on the latest code.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@llamaindex/google": patch
|
||||
---
|
||||
|
||||
Added saftey setting parameter for gemini
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@llamaindex/pinecone": minor
|
||||
---
|
||||
|
||||
Fix deleting of document by id in PineconeVectorStore
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
"@llamaindex/huggingface": minor
|
||||
"@llamaindex/anthropic": minor
|
||||
"@llamaindex/mistral": minor
|
||||
"@llamaindex/google": minor
|
||||
"@llamaindex/ollama": minor
|
||||
"@llamaindex/openai": minor
|
||||
"@llamaindex/core": minor
|
||||
"@llamaindex/examples": minor
|
||||
---
|
||||
|
||||
Added support for structured output in the chat api of openai and ollama
|
||||
Added structured output parameter in the provider
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@llamaindex/cloud": patch
|
||||
---
|
||||
|
||||
chore: bump sdk openapi.json
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@llamaindex/azure": patch
|
||||
---
|
||||
|
||||
Add `fromConnectionString` method to azure storage libs to track the usage vCore.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@llamaindex/tools": patch
|
||||
---
|
||||
|
||||
feat: @llamaindex/tools
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"@llamaindex/mistral": minor
|
||||
"@llamaindex/examples": minor
|
||||
---
|
||||
|
||||
Added support for function calling in mistral provider
|
||||
Update model list for mistral provider
|
||||
Added example for the tool call in mistral
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"@llamaindex/cloud": patch
|
||||
"@llamaindex/community": patch
|
||||
"@llamaindex/core": patch
|
||||
"@llamaindex/readers": patch
|
||||
---
|
||||
|
||||
fix: add retry handling logic to parser reader and fix lint issues
|
||||
@@ -1,75 +1,5 @@
|
||||
# @llamaindex/doc
|
||||
|
||||
## 0.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9c63f3f: Add support for openai responses api
|
||||
- Updated dependencies [9c63f3f]
|
||||
- Updated dependencies [c515a32]
|
||||
- @llamaindex/openai@0.3.0
|
||||
- @llamaindex/core@0.6.2
|
||||
- @llamaindex/workflow@1.0.2
|
||||
- llamaindex@0.9.15
|
||||
- @llamaindex/cloud@4.0.2
|
||||
- @llamaindex/node-parser@2.0.2
|
||||
- @llamaindex/readers@3.0.2
|
||||
|
||||
## 0.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 648cfb5: Add support for supabase vector store
|
||||
Added doc for the supbase vector store
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- Updated dependencies [9d951b2]
|
||||
- @llamaindex/core@0.6.1
|
||||
- llamaindex@0.9.14
|
||||
- @llamaindex/cloud@4.0.1
|
||||
- @llamaindex/node-parser@2.0.1
|
||||
- @llamaindex/openai@0.2.1
|
||||
- @llamaindex/readers@3.0.1
|
||||
- @llamaindex/workflow@1.0.1
|
||||
|
||||
## 0.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- e98033e: docs: correct the number of indexes
|
||||
|
||||
## 0.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75d6e29]
|
||||
- llamaindex@0.9.13
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- f1db9b3: Adding an options parameter to vercel tool to tailor responses
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 21bebfc: Expose more content to fix the issue with unavailable documentation links, and adjust the documentation based on the latest code.
|
||||
- 2b39cef: Added documentation for structured output in openai and ollama
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [bf56fc0]
|
||||
- Updated dependencies [f8a86e4]
|
||||
- Updated dependencies [5189b44]
|
||||
- Updated dependencies [58a9446]
|
||||
- @llamaindex/readers@3.0.0
|
||||
- @llamaindex/core@0.6.0
|
||||
- @llamaindex/openai@0.2.0
|
||||
- @llamaindex/cloud@4.0.0
|
||||
- @llamaindex/workflow@1.0.0
|
||||
- llamaindex@0.9.12
|
||||
- @llamaindex/node-parser@2.0.0
|
||||
|
||||
## 0.1.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -4,8 +4,6 @@ const withMDX = createMDX();
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const config = {
|
||||
// default timeout for static generation is 60s, but we need to increase it to 10 minutes due to the large number of document pages
|
||||
staticPageGenerationTimeout: 600,
|
||||
reactStrictMode: true,
|
||||
eslint: {
|
||||
ignoreDuringBuilds: true,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/doc",
|
||||
"version": "0.2.4",
|
||||
"version": "0.1.11",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"postinstall": "fumadocs-mdx",
|
||||
|
||||
@@ -84,7 +84,6 @@ const queryTool = llamaindex({
|
||||
model: openai("gpt-4"),
|
||||
index,
|
||||
description: "Search through the documents",
|
||||
options: { fields: ["sourceNodes", "messages"]}
|
||||
});
|
||||
|
||||
// Use the tool with Vercel's AI SDK
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Index
|
||||
---
|
||||
|
||||
An index is the basic container and organization for your data. LlamaIndex.TS supports three indexes:
|
||||
An index is the basic container and organization for your data. LlamaIndex.TS supports two indexes:
|
||||
|
||||
- `VectorStoreIndex` - will send the top-k `Node`s to the LLM when generating a response. The default top-k is 2.
|
||||
- `SummaryIndex` - will send every `Node` in the index to the LLM in order to generate a response
|
||||
|
||||
@@ -56,10 +56,10 @@ const vectorStore = new QdrantVectorStore({
|
||||
|
||||
```ts
|
||||
const document = new Document({ text: essay, id_: path });
|
||||
const storageContext = await storageContextFromDefaults({ vectorStore });
|
||||
const index = await VectorStoreIndex.fromDocuments([document], {
|
||||
storageContext,
|
||||
});
|
||||
|
||||
const index = await VectorStoreIndex.fromDocuments([document], {
|
||||
vectorStore,
|
||||
});
|
||||
```
|
||||
|
||||
## Query the index
|
||||
@@ -91,11 +91,11 @@ async function main() {
|
||||
});
|
||||
|
||||
const document = new Document({ text: essay, id_: path });
|
||||
const storageContext = await storageContextFromDefaults({ vectorStore });
|
||||
|
||||
const index = await VectorStoreIndex.fromDocuments([document], {
|
||||
storageContext,
|
||||
vectorStore,
|
||||
});
|
||||
|
||||
|
||||
const queryEngine = index.asQueryEngine();
|
||||
|
||||
const response = await queryEngine.query({
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
---
|
||||
title: Supabase Vector Store
|
||||
---
|
||||
|
||||
[supabase.com](https://supabase.com/)
|
||||
|
||||
To use this vector store, you need a Supabase project. You can create one at [supabase.com](https://supabase.com/).
|
||||
|
||||
## Installation
|
||||
|
||||
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
||||
|
||||
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
|
||||
```shell tab="npm"
|
||||
npm install llamaindex @llamaindex/supabase
|
||||
```
|
||||
|
||||
```shell tab="yarn"
|
||||
yarn add llamaindex @llamaindex/supabase
|
||||
```
|
||||
|
||||
```shell tab="pnpm"
|
||||
pnpm add llamaindex @llamaindex/supabase
|
||||
```
|
||||
</Tabs>
|
||||
|
||||
## Database Setup
|
||||
|
||||
Before using the vector store, you need to:
|
||||
1. Enable the `pgvector` extension
|
||||
2. Create a table for storing vectors
|
||||
3. Create a vector similarity search function
|
||||
|
||||
```sql
|
||||
create table documents (
|
||||
id uuid primary key,
|
||||
content text,
|
||||
metadata jsonb,
|
||||
embedding vector(1536)
|
||||
);
|
||||
```
|
||||
|
||||
-- Create a function for similarity search
|
||||
```sql
|
||||
create function match_documents (
|
||||
query_embedding vector(1536),
|
||||
match_count int
|
||||
) returns table (
|
||||
id uuid,
|
||||
content text,
|
||||
metadata jsonb,
|
||||
embedding vector(1536),
|
||||
similarity float
|
||||
)
|
||||
language plpgsql
|
||||
as $$
|
||||
begin
|
||||
return query
|
||||
select
|
||||
id,
|
||||
content,
|
||||
metadata,
|
||||
embedding,
|
||||
1 - (embedding <=> query_embedding) as similarity
|
||||
from documents
|
||||
order by embedding <=> query_embedding
|
||||
limit match_count;
|
||||
end;
|
||||
$$;
|
||||
```
|
||||
|
||||
## Importing the modules
|
||||
|
||||
```ts
|
||||
import { Document, VectorStoreIndex } from "llamaindex";
|
||||
import { SupabaseVectorStore } from "@llamaindex/supabase";
|
||||
```
|
||||
|
||||
## Setup Supabase
|
||||
|
||||
```ts
|
||||
const vectorStore = new SupabaseVectorStore({
|
||||
supabaseUrl: process.env.SUPABASE_URL,
|
||||
supabaseKey: process.env.SUPABASE_KEY,
|
||||
table: "documents",
|
||||
});
|
||||
```
|
||||
|
||||
## Setup the index
|
||||
|
||||
```ts
|
||||
const documents = [
|
||||
new Document({
|
||||
text: "Sample document text",
|
||||
metadata: { source: "example" }
|
||||
})
|
||||
];
|
||||
|
||||
const storageContext = await storageContextFromDefaults({ vectorStore });
|
||||
const index = await VectorStoreIndex.fromDocuments(documents, {
|
||||
storageContext,
|
||||
});
|
||||
```
|
||||
|
||||
## Query the index
|
||||
|
||||
```ts
|
||||
const queryEngine = index.asQueryEngine();
|
||||
|
||||
const response = await queryEngine.query({
|
||||
query: "What is in the document?",
|
||||
});
|
||||
|
||||
// Output response
|
||||
console.log(response.toString());
|
||||
```
|
||||
|
||||
## Full code
|
||||
|
||||
```ts
|
||||
import { Document, VectorStoreIndex, storageContextFromDefaults } from "llamaindex";
|
||||
import { SupabaseVectorStore } from "@llamaindex/supabase";
|
||||
|
||||
async function main() {
|
||||
// Initialize the vector store
|
||||
const vectorStore = new SupabaseVectorStore({
|
||||
supabaseUrl: process.env.SUPABASE_URL,
|
||||
supabaseKey: process.env.SUPABASE_KEY,
|
||||
table: "documents",
|
||||
});
|
||||
|
||||
// Create sample documents
|
||||
const documents = [
|
||||
new Document({
|
||||
text: "Vector search enables semantic similarity search",
|
||||
metadata: {
|
||||
source: "research_paper",
|
||||
author: "Jane Smith",
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
// Create storage context
|
||||
const storageContext = await storageContextFromDefaults({ vectorStore });
|
||||
|
||||
// Create and store embeddings
|
||||
const index = await VectorStoreIndex.fromDocuments(documents, {
|
||||
storageContext,
|
||||
});
|
||||
|
||||
// Query the index
|
||||
const queryEngine = index.asQueryEngine();
|
||||
const response = await queryEngine.query({
|
||||
query: "What is vector search?",
|
||||
});
|
||||
|
||||
// Output response
|
||||
console.log(response.toString());
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
- [SupabaseVectorStore](/docs/api/classes/SupabaseVectorStore)
|
||||
@@ -55,35 +55,6 @@ const results = await queryEngine.query({
|
||||
});
|
||||
```
|
||||
|
||||
## Using JSON Response Format
|
||||
|
||||
You can configure Ollama to return responses in JSON format:
|
||||
|
||||
```ts
|
||||
import { Ollama } from "@llamaindex/llms/ollama";
|
||||
import { z } from "zod";
|
||||
|
||||
// Simple JSON format
|
||||
const llm = new Ollama({
|
||||
model: "llama2",
|
||||
temperature: 0,
|
||||
responseFormat: { type: "json_object" }
|
||||
});
|
||||
|
||||
// Using Zod schema for validation
|
||||
const responseSchema = z.object({
|
||||
summary: z.string(),
|
||||
topics: z.array(z.string()),
|
||||
sentiment: z.enum(["positive", "negative", "neutral"])
|
||||
});
|
||||
|
||||
const llm = new Ollama({
|
||||
model: "llama2",
|
||||
temperature: 0,
|
||||
responseFormat: responseSchema
|
||||
});
|
||||
```
|
||||
|
||||
## Full Example
|
||||
|
||||
```ts
|
||||
|
||||
@@ -46,289 +46,6 @@ or
|
||||
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0, apiKey: <YOUR_API_KEY>, baseURL: "https://api.scaleway.ai/v1" });
|
||||
```
|
||||
|
||||
## Using OpenAI Responses API
|
||||
|
||||
The OpenAI Responses API provides enhanced functionality for handling complex interactions, including built-in tools, annotations, and streaming responses. Here's how to use it:
|
||||
|
||||
### Basic Setup
|
||||
|
||||
```ts
|
||||
import { openaiResponses } from "@llamaindex/openai";
|
||||
|
||||
const llm = openaiResponses({
|
||||
model: "gpt-4o",
|
||||
temperature: 0.1,
|
||||
maxOutputTokens: 1000
|
||||
});
|
||||
```
|
||||
|
||||
### Message Content Types
|
||||
|
||||
The API supports different types of message content, including text and images:
|
||||
|
||||
```ts
|
||||
const response = await llm.chat({
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: [
|
||||
{
|
||||
type: "input_text",
|
||||
text: "What's in this image?"
|
||||
},
|
||||
{
|
||||
type: "input_image",
|
||||
image_url: "https://example.com/image.jpg",
|
||||
detail: "auto" // Optional: can be "auto", "low", or "high"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
```
|
||||
|
||||
### Advanced Features
|
||||
|
||||
#### Built-in Tools
|
||||
|
||||
```ts
|
||||
const llm = openaiResponses({
|
||||
model: "gpt-4o",
|
||||
builtInTools: [
|
||||
{
|
||||
type: "function",
|
||||
name: "search_files",
|
||||
description: "Search through available files"
|
||||
}
|
||||
],
|
||||
strict: true // Enable strict mode for tool calls
|
||||
});
|
||||
```
|
||||
|
||||
#### Response Tracking and Storage
|
||||
|
||||
```ts
|
||||
const llm = openaiResponses({
|
||||
trackPreviousResponses: true, // Enable response tracking
|
||||
store: true, // Store responses for future reference
|
||||
user: "user-123", // Associate responses with a user
|
||||
callMetadata: { // Add custom metadata
|
||||
sessionId: "session-123",
|
||||
context: "customer-support"
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### Streaming Responses
|
||||
|
||||
```ts
|
||||
const response = await llm.chat({
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: "Generate a long response"
|
||||
}
|
||||
],
|
||||
stream: true // Enable streaming
|
||||
});
|
||||
|
||||
for await (const chunk of response) {
|
||||
console.log(chunk.delta); // Process each chunk of the response
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration Options
|
||||
|
||||
The OpenAI Responses API supports various configuration options:
|
||||
|
||||
```ts
|
||||
const llm = openaiResponses({
|
||||
// Model and basic settings
|
||||
model: "gpt-4o",
|
||||
temperature: 0.1,
|
||||
topP: 1,
|
||||
maxOutputTokens: 1000,
|
||||
|
||||
// API configuration
|
||||
apiKey: "your-api-key",
|
||||
baseURL: "custom-endpoint",
|
||||
maxRetries: 10,
|
||||
timeout: 60000,
|
||||
|
||||
// Response handling
|
||||
trackPreviousResponses: false,
|
||||
store: false,
|
||||
strict: false,
|
||||
|
||||
// Additional options
|
||||
instructions: "Custom instructions for the model",
|
||||
truncation: "auto", // Can be "auto", "disabled", or null
|
||||
include: ["citations", "reasoning"] // Specify what to include in responses
|
||||
});
|
||||
```
|
||||
|
||||
### Response Structure
|
||||
|
||||
The API returns responses with rich metadata and optional annotations:
|
||||
|
||||
```ts
|
||||
interface ResponseStructure {
|
||||
message: {
|
||||
content: string;
|
||||
role: "assistant";
|
||||
options: {
|
||||
built_in_tool_calls: Array<ToolCall>;
|
||||
annotations?: Array<Citation | URLCitation | FilePath>;
|
||||
refusal?: string;
|
||||
reasoning?: ReasoningItem;
|
||||
usage?: ResponseUsage;
|
||||
toolCall?: Array<PartialToolCall>;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Best Practices
|
||||
|
||||
1. Use `trackPreviousResponses` when you need conversation continuity
|
||||
2. Enable `strict` mode when using tools to ensure accurate function calls
|
||||
3. Set appropriate `maxOutputTokens` to control response length
|
||||
4. Use `annotations` to track citations and references in responses
|
||||
5. Implement error handling for potential API failures and retries
|
||||
|
||||
## Using JSON Response Format
|
||||
|
||||
You can configure OpenAI to return responses in JSON format:
|
||||
|
||||
```ts
|
||||
Settings.llm = new OpenAI({
|
||||
model: "gpt-4o",
|
||||
temperature: 0,
|
||||
responseFormat: { type: "json_object" }
|
||||
});
|
||||
|
||||
// You can also use a Zod schema to validate the response structure
|
||||
import { z } from "zod";
|
||||
|
||||
const responseSchema = z.object({
|
||||
summary: z.string(),
|
||||
topics: z.array(z.string()),
|
||||
sentiment: z.enum(["positive", "negative", "neutral"])
|
||||
});
|
||||
|
||||
Settings.llm = new OpenAI({
|
||||
model: "gpt-4o",
|
||||
temperature: 0,
|
||||
responseFormat: responseSchema
|
||||
});
|
||||
```
|
||||
|
||||
## Response Formats
|
||||
|
||||
The OpenAI LLM supports different response formats to structure the output in specific ways. There are two main approaches to formatting responses:
|
||||
|
||||
### 1. JSON Object Format
|
||||
|
||||
The simplest way to get structured JSON responses is using the `json_object` response format:
|
||||
|
||||
```ts
|
||||
Settings.llm = new OpenAI({
|
||||
model: "gpt-4o",
|
||||
temperature: 0,
|
||||
responseFormat: { type: "json_object" }
|
||||
});
|
||||
|
||||
const response = await llm.chat({
|
||||
messages: [
|
||||
{
|
||||
role: "system",
|
||||
content: "You are a helpful assistant that outputs JSON."
|
||||
},
|
||||
{
|
||||
role: "user",
|
||||
content: "Summarize this meeting transcript"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// Response will be valid JSON
|
||||
console.log(response.message.content);
|
||||
```
|
||||
|
||||
### 2. Schema Validation with Zod
|
||||
|
||||
For more robust type safety and validation, you can use Zod schemas to define the expected response structure:
|
||||
|
||||
```ts
|
||||
import { z } from "zod";
|
||||
|
||||
// Define the response schema
|
||||
const meetingSchema = z.object({
|
||||
summary: z.string(),
|
||||
participants: z.array(z.string()),
|
||||
actionItems: z.array(z.string()),
|
||||
nextSteps: z.string()
|
||||
});
|
||||
|
||||
// Configure the LLM with the schema
|
||||
Settings.llm = new OpenAI({
|
||||
model: "gpt-4o",
|
||||
temperature: 0,
|
||||
responseFormat: meetingSchema
|
||||
});
|
||||
|
||||
const response = await llm.chat({
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: "Summarize this meeting transcript"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// Response will be typed and validated according to the schema
|
||||
const result = response.message.content;
|
||||
console.log(result.summary);
|
||||
console.log(result.actionItems);
|
||||
```
|
||||
|
||||
### Response Format Options
|
||||
|
||||
The response format can be configured in two ways:
|
||||
|
||||
1. At LLM initialization:
|
||||
```ts
|
||||
const llm = new OpenAI({
|
||||
model: "gpt-4o",
|
||||
responseFormat: { type: "json_object" } // or a Zod schema
|
||||
});
|
||||
```
|
||||
|
||||
2. Per request:
|
||||
```ts
|
||||
const response = await llm.chat({
|
||||
messages: [...],
|
||||
responseFormat: { type: "json_object" } // or a Zod schema
|
||||
});
|
||||
```
|
||||
|
||||
The response format options are:
|
||||
|
||||
- `{ type: "json_object" }` - Returns responses as JSON objects
|
||||
- `zodSchema` - A Zod schema that defines and validates the response structure
|
||||
|
||||
### Best Practices
|
||||
|
||||
1. Use JSON object format for simple structured responses
|
||||
2. Use Zod schemas when you need:
|
||||
- Type safety
|
||||
- Response validation
|
||||
- Complex nested structures
|
||||
- Specific field constraints
|
||||
3. Set a low temperature (e.g. 0) when using structured outputs for more reliable formatting
|
||||
4. Include clear instructions in system or user messages about the expected response format
|
||||
5. Handle potential parsing errors when working with JSON responses
|
||||
|
||||
## Load and index documents
|
||||
|
||||
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
|
||||
|
||||
@@ -7,59 +7,9 @@ A tool can be called to perform custom actions, or retrieve extra information ba
|
||||
A result from a tool call can be used by subsequent steps in a workflow, or to compute a final answer.
|
||||
For example, a "weather tool" could fetch some live weather information from a geographical location.
|
||||
|
||||
## Tool Function
|
||||
|
||||
The `tool` function is a utility provided to define a tool that can be used by an agent. It takes a function and a configuration object as arguments. The configuration object includes the tool's name, description, and parameters.
|
||||
|
||||
### Parameters with Zod
|
||||
|
||||
The `parameters` field in the tool configuration is defined using `zod`, a TypeScript-first schema declaration and validation library. `zod` allows you to specify the expected structure and types of the input parameters, ensuring that the data passed to the tool is valid.
|
||||
|
||||
Example:
|
||||
```ts
|
||||
import { agent, tool } from "llamaindex";
|
||||
import { z } from "zod";
|
||||
|
||||
// first arg is LLM input, second is bound arg
|
||||
const queryKnowledgeBase = async ({ question }, { userToken }) => {
|
||||
const response = await fetch(`https://knowledge-base.com?token=${userToken}&query=${question}`);
|
||||
// ...
|
||||
};
|
||||
|
||||
// define tool with zod validation
|
||||
const kbTool = tool(queryKnowledgeBase, {
|
||||
name: 'queryKnowledgeBase',
|
||||
description: 'Query knowledge base',
|
||||
parameters: z.object({
|
||||
question: z.string({
|
||||
description: 'The user question',
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
```
|
||||
In this example, `z.object` is used to define a schema for the `parameters` where `question` is expected to be a string. This ensures that any input to the tool adheres to the specified structure, providing a layer of type safety and validation.
|
||||
|
||||
|
||||
## Built-in tools
|
||||
|
||||
You can import built-in tools from the `@llamaindex/tools` package.
|
||||
|
||||
```ts
|
||||
import { agent } from "llamaindex";
|
||||
import { wiki } from "@llamaindex/tools";
|
||||
|
||||
const researchAgent = agent({
|
||||
name: "WikiAgent",
|
||||
description: "Gathering information from the internet",
|
||||
systemPrompt: `You are a research agent. Your role is to gather information from the internet using the provided tools.`,
|
||||
tools: [wiki()],
|
||||
});
|
||||
```
|
||||
|
||||
## Function tool
|
||||
|
||||
You can still use the `FunctionTool` class to define a tool.
|
||||
Function tools are implemented with the `FunctionTool` class.
|
||||
A `FunctionTool` is constructed from a function with signature
|
||||
```ts
|
||||
(input: T, additionalArg?: AdditionalToolArgument) => R
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
# @llamaindex/cloudflare-worker-agent-test
|
||||
|
||||
## 0.0.149
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.15
|
||||
|
||||
## 0.0.148
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9d951b2]
|
||||
- llamaindex@0.9.14
|
||||
|
||||
## 0.0.147
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75d6e29]
|
||||
- llamaindex@0.9.13
|
||||
|
||||
## 0.0.146
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.12
|
||||
|
||||
## 0.0.145
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/cloudflare-worker-agent-test",
|
||||
"version": "0.0.149",
|
||||
"version": "0.0.145",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,25 +1,5 @@
|
||||
# @llamaindex/llama-parse-browser-test
|
||||
|
||||
## 0.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @llamaindex/cloud@4.0.2
|
||||
|
||||
## 0.0.56
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @llamaindex/cloud@4.0.1
|
||||
|
||||
## 0.0.55
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [bf56fc0]
|
||||
- Updated dependencies [5189b44]
|
||||
- @llamaindex/cloud@4.0.0
|
||||
|
||||
## 0.0.54
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/llama-parse-browser-test",
|
||||
"private": true,
|
||||
"version": "0.0.57",
|
||||
"version": "0.0.54",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -10,7 +10,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.7.3",
|
||||
"vite": "^5.4.16",
|
||||
"vite": "^5.4.12",
|
||||
"vite-plugin-wasm": "^3.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
# @llamaindex/next-agent-test
|
||||
|
||||
## 0.1.149
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.15
|
||||
|
||||
## 0.1.148
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9d951b2]
|
||||
- llamaindex@0.9.14
|
||||
|
||||
## 0.1.147
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75d6e29]
|
||||
- llamaindex@0.9.13
|
||||
|
||||
## 0.1.146
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.12
|
||||
|
||||
## 0.1.145
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/next-agent-test",
|
||||
"version": "0.1.149",
|
||||
"version": "0.1.145",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
# test-edge-runtime
|
||||
|
||||
## 0.1.148
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.15
|
||||
|
||||
## 0.1.147
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9d951b2]
|
||||
- llamaindex@0.9.14
|
||||
|
||||
## 0.1.146
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75d6e29]
|
||||
- llamaindex@0.9.13
|
||||
|
||||
## 0.1.145
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.12
|
||||
|
||||
## 0.1.144
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/nextjs-edge-runtime-test",
|
||||
"version": "0.1.148",
|
||||
"version": "0.1.144",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,40 +1,5 @@
|
||||
# @llamaindex/next-node-runtime
|
||||
|
||||
## 0.1.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.15
|
||||
- @llamaindex/huggingface@0.1.2
|
||||
- @llamaindex/readers@3.0.2
|
||||
|
||||
## 0.1.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9d951b2]
|
||||
- llamaindex@0.9.14
|
||||
- @llamaindex/huggingface@0.1.1
|
||||
- @llamaindex/readers@3.0.1
|
||||
|
||||
## 0.1.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75d6e29]
|
||||
- llamaindex@0.9.13
|
||||
|
||||
## 0.1.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [5189b44]
|
||||
- @llamaindex/readers@3.0.0
|
||||
- @llamaindex/huggingface@0.1.0
|
||||
- llamaindex@0.9.12
|
||||
|
||||
## 0.1.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/next-node-runtime-test",
|
||||
"version": "0.1.15",
|
||||
"version": "0.1.11",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
# vite-import-llamaindex
|
||||
|
||||
## 0.0.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.15
|
||||
|
||||
## 0.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9d951b2]
|
||||
- llamaindex@0.9.14
|
||||
|
||||
## 0.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75d6e29]
|
||||
- llamaindex@0.9.13
|
||||
|
||||
## 0.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.12
|
||||
|
||||
## 0.0.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vite-import-llamaindex",
|
||||
"private": true,
|
||||
"version": "0.0.15",
|
||||
"version": "0.0.11",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
@@ -16,7 +16,7 @@
|
||||
"@size-limit/preset-big-lib": "^11.1.6",
|
||||
"size-limit": "^11.1.6",
|
||||
"typescript": "^5.7.3",
|
||||
"vite": "^5.4.16"
|
||||
"vite": "^6.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"llamaindex": "workspace:*"
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
# @llamaindex/waku-query-engine-test
|
||||
|
||||
## 0.0.149
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.15
|
||||
|
||||
## 0.0.148
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9d951b2]
|
||||
- llamaindex@0.9.14
|
||||
|
||||
## 0.0.147
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75d6e29]
|
||||
- llamaindex@0.9.13
|
||||
|
||||
## 0.0.146
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.12
|
||||
|
||||
## 0.0.145
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/waku-query-engine-test",
|
||||
"version": "0.0.149",
|
||||
"version": "0.0.145",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
20
|
||||
@@ -1,178 +1,5 @@
|
||||
# examples
|
||||
|
||||
## 0.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9c63f3f: Add support for openai responses api
|
||||
- Updated dependencies [9c63f3f]
|
||||
- Updated dependencies [c515a32]
|
||||
- @llamaindex/openai@0.3.0
|
||||
- @llamaindex/google@0.2.2
|
||||
- @llamaindex/core@0.6.2
|
||||
- @llamaindex/workflow@1.0.2
|
||||
- llamaindex@0.9.15
|
||||
- @llamaindex/clip@0.0.48
|
||||
- @llamaindex/deepinfra@0.0.48
|
||||
- @llamaindex/deepseek@0.0.8
|
||||
- @llamaindex/fireworks@0.0.8
|
||||
- @llamaindex/groq@0.0.63
|
||||
- @llamaindex/huggingface@0.1.2
|
||||
- @llamaindex/jinaai@0.0.8
|
||||
- @llamaindex/perplexity@0.0.5
|
||||
- @llamaindex/azure@0.1.11
|
||||
- @llamaindex/elastic-search@0.1.2
|
||||
- @llamaindex/milvus@0.1.11
|
||||
- @llamaindex/qdrant@0.1.11
|
||||
- @llamaindex/supabase@0.1.1
|
||||
- @llamaindex/together@0.0.8
|
||||
- @llamaindex/vllm@0.0.34
|
||||
- @llamaindex/cloud@4.0.2
|
||||
- @llamaindex/node-parser@2.0.2
|
||||
- @llamaindex/anthropic@0.3.2
|
||||
- @llamaindex/cohere@0.0.16
|
||||
- @llamaindex/mistral@0.1.2
|
||||
- @llamaindex/mixedbread@0.0.16
|
||||
- @llamaindex/ollama@0.1.2
|
||||
- @llamaindex/portkey-ai@0.0.44
|
||||
- @llamaindex/replicate@0.0.44
|
||||
- @llamaindex/astra@0.0.16
|
||||
- @llamaindex/chroma@0.0.16
|
||||
- @llamaindex/firestore@1.0.9
|
||||
- @llamaindex/mongodb@0.0.16
|
||||
- @llamaindex/pinecone@0.1.2
|
||||
- @llamaindex/postgres@0.0.44
|
||||
- @llamaindex/upstash@0.0.16
|
||||
- @llamaindex/weaviate@0.0.16
|
||||
- @llamaindex/vercel@0.1.2
|
||||
- @llamaindex/voyage-ai@1.0.8
|
||||
- @llamaindex/readers@3.0.2
|
||||
- @llamaindex/tools@0.0.4
|
||||
|
||||
## 0.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 648cfb5: Add support for supabase vector store
|
||||
Added doc for the supbase vector store
|
||||
- Updated dependencies [648cfb5]
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- Updated dependencies [9d951b2]
|
||||
- @llamaindex/supabase@0.1.0
|
||||
- @llamaindex/core@0.6.1
|
||||
- llamaindex@0.9.14
|
||||
- @llamaindex/tools@0.0.3
|
||||
- @llamaindex/cloud@4.0.1
|
||||
- @llamaindex/node-parser@2.0.1
|
||||
- @llamaindex/anthropic@0.3.1
|
||||
- @llamaindex/clip@0.0.47
|
||||
- @llamaindex/cohere@0.0.15
|
||||
- @llamaindex/deepinfra@0.0.47
|
||||
- @llamaindex/google@0.2.1
|
||||
- @llamaindex/huggingface@0.1.1
|
||||
- @llamaindex/jinaai@0.0.7
|
||||
- @llamaindex/mistral@0.1.1
|
||||
- @llamaindex/mixedbread@0.0.15
|
||||
- @llamaindex/ollama@0.1.1
|
||||
- @llamaindex/openai@0.2.1
|
||||
- @llamaindex/perplexity@0.0.4
|
||||
- @llamaindex/portkey-ai@0.0.43
|
||||
- @llamaindex/replicate@0.0.43
|
||||
- @llamaindex/astra@0.0.15
|
||||
- @llamaindex/azure@0.1.10
|
||||
- @llamaindex/chroma@0.0.15
|
||||
- @llamaindex/elastic-search@0.1.1
|
||||
- @llamaindex/firestore@1.0.8
|
||||
- @llamaindex/milvus@0.1.10
|
||||
- @llamaindex/mongodb@0.0.15
|
||||
- @llamaindex/pinecone@0.1.1
|
||||
- @llamaindex/postgres@0.0.43
|
||||
- @llamaindex/qdrant@0.1.10
|
||||
- @llamaindex/upstash@0.0.15
|
||||
- @llamaindex/weaviate@0.0.15
|
||||
- @llamaindex/vercel@0.1.1
|
||||
- @llamaindex/voyage-ai@1.0.7
|
||||
- @llamaindex/readers@3.0.1
|
||||
- @llamaindex/workflow@1.0.1
|
||||
- @llamaindex/deepseek@0.0.7
|
||||
- @llamaindex/fireworks@0.0.7
|
||||
- @llamaindex/groq@0.0.62
|
||||
- @llamaindex/together@0.0.7
|
||||
- @llamaindex/vllm@0.0.33
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 91a18e7: Added support for structured output in the chat api of openai and ollama
|
||||
Added structured output parameter in the provider
|
||||
- d1c1f99: Added support for function calling in mistral provider
|
||||
Update model list for mistral provider
|
||||
Added example for the tool call in mistral
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2509353: Added support for elastic search vector store
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [77e24ce]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [2509353]
|
||||
- Updated dependencies [da06e45]
|
||||
- Updated dependencies [2a0a899]
|
||||
- Updated dependencies [050cd53]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [bf56fc0]
|
||||
- Updated dependencies [f1db9b3]
|
||||
- Updated dependencies [da8068e]
|
||||
- Updated dependencies [c7ff323]
|
||||
- Updated dependencies [f8a86e4]
|
||||
- Updated dependencies [d1c1f99]
|
||||
- Updated dependencies [5189b44]
|
||||
- Updated dependencies [3fd4cc3]
|
||||
- Updated dependencies [04f8c96]
|
||||
- Updated dependencies [58a9446]
|
||||
- @llamaindex/readers@3.0.0
|
||||
- @llamaindex/core@0.6.0
|
||||
- @llamaindex/tools@0.0.2
|
||||
- @llamaindex/elastic-search@0.1.0
|
||||
- @llamaindex/google@0.2.0
|
||||
- @llamaindex/pinecone@0.1.0
|
||||
- @llamaindex/huggingface@0.1.0
|
||||
- @llamaindex/anthropic@0.3.0
|
||||
- @llamaindex/mistral@0.1.0
|
||||
- @llamaindex/ollama@0.1.0
|
||||
- @llamaindex/openai@0.2.0
|
||||
- @llamaindex/cloud@4.0.0
|
||||
- @llamaindex/vercel@0.1.0
|
||||
- @llamaindex/azure@0.1.9
|
||||
- @llamaindex/workflow@1.0.0
|
||||
- @llamaindex/mongodb@0.0.14
|
||||
- llamaindex@0.9.12
|
||||
- @llamaindex/node-parser@2.0.0
|
||||
- @llamaindex/clip@0.0.46
|
||||
- @llamaindex/cohere@0.0.14
|
||||
- @llamaindex/deepinfra@0.0.46
|
||||
- @llamaindex/jinaai@0.0.6
|
||||
- @llamaindex/mixedbread@0.0.14
|
||||
- @llamaindex/perplexity@0.0.3
|
||||
- @llamaindex/portkey-ai@0.0.42
|
||||
- @llamaindex/replicate@0.0.42
|
||||
- @llamaindex/astra@0.0.14
|
||||
- @llamaindex/chroma@0.0.14
|
||||
- @llamaindex/firestore@1.0.7
|
||||
- @llamaindex/milvus@0.1.9
|
||||
- @llamaindex/postgres@0.0.42
|
||||
- @llamaindex/qdrant@0.1.9
|
||||
- @llamaindex/upstash@0.0.14
|
||||
- @llamaindex/weaviate@0.0.14
|
||||
- @llamaindex/voyage-ai@1.0.6
|
||||
- @llamaindex/deepseek@0.0.6
|
||||
- @llamaindex/fireworks@0.0.6
|
||||
- @llamaindex/groq@0.0.61
|
||||
- @llamaindex/together@0.0.6
|
||||
- @llamaindex/vllm@0.0.32
|
||||
|
||||
## 0.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import {
|
||||
AgentStream,
|
||||
AgentToolCallResult,
|
||||
Document,
|
||||
VectorStoreIndex,
|
||||
agent,
|
||||
openai,
|
||||
} from "llamaindex";
|
||||
|
||||
async function main() {
|
||||
const index = await VectorStoreIndex.fromDocuments([
|
||||
new Document({
|
||||
text: "Cats have a specialized collarbone that allows them to always land on their feet when they fall.",
|
||||
}),
|
||||
new Document({
|
||||
text: "Dogs have a sense of smell that is 10,000 to 100,000 times more acute than humans.",
|
||||
}),
|
||||
new Document({
|
||||
text: "Cats are known for their agility and ability to jump high.",
|
||||
}),
|
||||
]);
|
||||
|
||||
const myAgent = agent({
|
||||
llm: openai({ model: "gpt-4o" }),
|
||||
tools: [
|
||||
index.queryTool({
|
||||
options: { similarityTopK: 2 },
|
||||
includeSourceNodes: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const context = myAgent.run("The fact about cats");
|
||||
|
||||
for await (const event of context) {
|
||||
if (event instanceof AgentToolCallResult) {
|
||||
console.log(
|
||||
"Using these retrieved information to answer the question:\n",
|
||||
event.data.toolOutput.result,
|
||||
);
|
||||
} else if (event instanceof AgentStream) {
|
||||
for (const chunk of event.data.delta) {
|
||||
process.stdout.write(chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main().then(() => {
|
||||
console.log("Done");
|
||||
});
|
||||
@@ -1,30 +0,0 @@
|
||||
import { openaiResponses } from "@llamaindex/openai";
|
||||
import { wiki } from "@llamaindex/tools";
|
||||
import { agent, tool } from "llamaindex";
|
||||
import { z } from "zod";
|
||||
|
||||
const workflow = agent({
|
||||
tools: [
|
||||
tool({
|
||||
name: "weather",
|
||||
description: "Get the weather",
|
||||
parameters: z.object({
|
||||
location: z.string().describe("The location to get the weather for"),
|
||||
}),
|
||||
execute: ({ location }) => `The weather in ${location} is sunny`,
|
||||
}),
|
||||
wiki(),
|
||||
],
|
||||
llm: openaiResponses({
|
||||
model: "gpt-4o-mini",
|
||||
}),
|
||||
});
|
||||
|
||||
async function main() {
|
||||
const result = await workflow.run(
|
||||
"What is the weather in New York? What's the history of New York from Wikipedia in 3 sentences?",
|
||||
);
|
||||
console.log(result.data);
|
||||
}
|
||||
|
||||
void main();
|
||||
@@ -1,33 +0,0 @@
|
||||
import { openaiResponses } from "@llamaindex/openai";
|
||||
|
||||
async function main() {
|
||||
const llm = openaiResponses({
|
||||
model: "gpt-4o",
|
||||
maxOutputTokens: 1000,
|
||||
apiKey: process.env.MY_OPENAI_API_KEY,
|
||||
});
|
||||
|
||||
const response = await llm.chat({
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "What's in this image? Describe it in detail.",
|
||||
},
|
||||
{
|
||||
type: "image_url",
|
||||
image_url: {
|
||||
url: "https://storage.googleapis.com/cloud-samples-data/vision/face/faces.jpeg",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
console.log("Single Image Analysis:", response.message.content);
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
@@ -1,22 +0,0 @@
|
||||
import { openaiResponses } from "@llamaindex/openai";
|
||||
|
||||
async function main() {
|
||||
const llm = openaiResponses({
|
||||
model: "gpt-4o-mini",
|
||||
temperature: 0.1,
|
||||
});
|
||||
|
||||
// Basic chat example
|
||||
const response = await llm.chat({
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: "What is the capital of France?",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
console.log(response.message.content);
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
@@ -1,26 +0,0 @@
|
||||
import { openaiResponses } from "@llamaindex/openai";
|
||||
|
||||
async function main() {
|
||||
const llm = openaiResponses({
|
||||
model: "gpt-4o-mini",
|
||||
temperature: 0.1,
|
||||
});
|
||||
|
||||
const stream = await llm.chat({
|
||||
messages: [
|
||||
{ content: "You want to talk in rhymes.", role: "system" },
|
||||
{
|
||||
content:
|
||||
"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
|
||||
role: "user",
|
||||
},
|
||||
],
|
||||
stream: true,
|
||||
});
|
||||
|
||||
for await (const chunk of stream) {
|
||||
process.stdout.write(chunk.delta);
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
@@ -1,37 +0,0 @@
|
||||
import { openaiResponses } from "@llamaindex/openai";
|
||||
import { tool } from "llamaindex";
|
||||
|
||||
import { z } from "zod";
|
||||
async function main() {
|
||||
const weatherTool = tool({
|
||||
name: "weather",
|
||||
description: "Get the weather",
|
||||
parameters: z.object({
|
||||
location: z.string({
|
||||
description: "The location to get the weather for",
|
||||
}),
|
||||
}),
|
||||
execute: ({ location }) => {
|
||||
return `The weather in ${location} is sunny`;
|
||||
},
|
||||
});
|
||||
|
||||
const llm = openaiResponses({
|
||||
model: "gpt-4o-mini",
|
||||
temperature: 0.1,
|
||||
});
|
||||
|
||||
const response = await llm.chat({
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: "What is the weather in New York?",
|
||||
},
|
||||
],
|
||||
tools: [weatherTool],
|
||||
});
|
||||
|
||||
console.log(response.message.options);
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
@@ -1,23 +0,0 @@
|
||||
import { openaiResponses } from "@llamaindex/openai";
|
||||
|
||||
async function main() {
|
||||
const llm = openaiResponses({
|
||||
model: "gpt-4o",
|
||||
temperature: 0.1,
|
||||
builtInTools: [{ type: "web_search_preview" }],
|
||||
});
|
||||
|
||||
// Streaming chat example
|
||||
const response = await llm.chat({
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: "What are the latest developments in AI?",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
console.log(response.message.content);
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
+40
-42
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/examples",
|
||||
"version": "0.3.2",
|
||||
"version": "0.2.10",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
@@ -11,47 +11,45 @@
|
||||
"@azure/cosmos": "^4.1.1",
|
||||
"@azure/identity": "^4.4.1",
|
||||
"@azure/search-documents": "^12.1.0",
|
||||
"@llamaindex/anthropic": "^0.3.2",
|
||||
"@llamaindex/astra": "^0.0.16",
|
||||
"@llamaindex/azure": "^0.1.11",
|
||||
"@llamaindex/chroma": "^0.0.16",
|
||||
"@llamaindex/clip": "^0.0.48",
|
||||
"@llamaindex/cloud": "^4.0.2",
|
||||
"@llamaindex/cohere": "^0.0.16",
|
||||
"@llamaindex/core": "^0.6.2",
|
||||
"@llamaindex/deepinfra": "^0.0.48",
|
||||
"@llamaindex/anthropic": "^0.2.6",
|
||||
"@llamaindex/astra": "^0.0.13",
|
||||
"@llamaindex/azure": "^0.1.8",
|
||||
"@llamaindex/chroma": "^0.0.13",
|
||||
"@llamaindex/clip": "^0.0.45",
|
||||
"@llamaindex/cloud": "^3.0.9",
|
||||
"@llamaindex/cohere": "^0.0.13",
|
||||
"@llamaindex/core": "^0.5.8",
|
||||
"@llamaindex/deepinfra": "^0.0.45",
|
||||
"@llamaindex/env": "^0.1.29",
|
||||
"@llamaindex/firestore": "^1.0.9",
|
||||
"@llamaindex/google": "^0.2.2",
|
||||
"@llamaindex/groq": "^0.0.63",
|
||||
"@llamaindex/huggingface": "^0.1.2",
|
||||
"@llamaindex/milvus": "^0.1.11",
|
||||
"@llamaindex/mistral": "^0.1.2",
|
||||
"@llamaindex/mixedbread": "^0.0.16",
|
||||
"@llamaindex/mongodb": "^0.0.16",
|
||||
"@llamaindex/elastic-search": "^0.1.2",
|
||||
"@llamaindex/node-parser": "^2.0.2",
|
||||
"@llamaindex/ollama": "^0.1.2",
|
||||
"@llamaindex/openai": "^0.3.0",
|
||||
"@llamaindex/pinecone": "^0.1.2",
|
||||
"@llamaindex/portkey-ai": "^0.0.44",
|
||||
"@llamaindex/postgres": "^0.0.44",
|
||||
"@llamaindex/qdrant": "^0.1.11",
|
||||
"@llamaindex/readers": "^3.0.2",
|
||||
"@llamaindex/replicate": "^0.0.44",
|
||||
"@llamaindex/upstash": "^0.0.16",
|
||||
"@llamaindex/vercel": "^0.1.2",
|
||||
"@llamaindex/vllm": "^0.0.34",
|
||||
"@llamaindex/voyage-ai": "^1.0.8",
|
||||
"@llamaindex/weaviate": "^0.0.16",
|
||||
"@llamaindex/workflow": "^1.0.2",
|
||||
"@llamaindex/deepseek": "^0.0.8",
|
||||
"@llamaindex/fireworks": "^0.0.8",
|
||||
"@llamaindex/together": "^0.0.8",
|
||||
"@llamaindex/jinaai": "^0.0.8",
|
||||
"@llamaindex/perplexity": "^0.0.5",
|
||||
"@llamaindex/supabase": "^0.1.1",
|
||||
"@llamaindex/tools": "^0.0.4",
|
||||
"@llamaindex/firestore": "^1.0.6",
|
||||
"@llamaindex/google": "^0.1.2",
|
||||
"@llamaindex/groq": "^0.0.60",
|
||||
"@llamaindex/huggingface": "^0.0.45",
|
||||
"@llamaindex/milvus": "^0.1.8",
|
||||
"@llamaindex/mistral": "^0.0.14",
|
||||
"@llamaindex/mixedbread": "^0.0.13",
|
||||
"@llamaindex/mongodb": "^0.0.13",
|
||||
"@llamaindex/node-parser": "^1.0.8",
|
||||
"@llamaindex/ollama": "^0.0.48",
|
||||
"@llamaindex/openai": "^0.1.61",
|
||||
"@llamaindex/pinecone": "^0.0.13",
|
||||
"@llamaindex/portkey-ai": "^0.0.41",
|
||||
"@llamaindex/postgres": "^0.0.41",
|
||||
"@llamaindex/qdrant": "^0.1.8",
|
||||
"@llamaindex/readers": "^2.0.8",
|
||||
"@llamaindex/replicate": "^0.0.41",
|
||||
"@llamaindex/upstash": "^0.0.13",
|
||||
"@llamaindex/vercel": "^0.0.19",
|
||||
"@llamaindex/vllm": "^0.0.31",
|
||||
"@llamaindex/voyage-ai": "^1.0.5",
|
||||
"@llamaindex/weaviate": "^0.0.13",
|
||||
"@llamaindex/workflow": "^0.0.16",
|
||||
"@llamaindex/deepseek": "^0.0.5",
|
||||
"@llamaindex/fireworks": "^0.0.5",
|
||||
"@llamaindex/together": "^0.0.5",
|
||||
"@llamaindex/jinaai": "^0.0.5",
|
||||
"@llamaindex/perplexity": "^0.0.2",
|
||||
"@llamaindex/tools": "^0.0.1",
|
||||
"@notionhq/client": "^2.2.15",
|
||||
"@pinecone-database/pinecone": "^4.0.0",
|
||||
"@vercel/postgres": "^0.10.0",
|
||||
@@ -60,7 +58,7 @@
|
||||
"commander": "^12.1.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"js-tiktoken": "^1.0.14",
|
||||
"llamaindex": "^0.9.15",
|
||||
"llamaindex": "^0.9.11",
|
||||
"mongodb": "6.7.0",
|
||||
"postgres": "^3.4.4",
|
||||
"wikipedia": "^2.1.2",
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
import { ElasticSearchVectorStore } from "@llamaindex/elastic-search";
|
||||
import {
|
||||
gemini,
|
||||
GEMINI_EMBEDDING_MODEL,
|
||||
GEMINI_MODEL,
|
||||
GeminiEmbedding,
|
||||
} from "@llamaindex/google";
|
||||
import {
|
||||
Document,
|
||||
Settings,
|
||||
storageContextFromDefaults,
|
||||
VectorStoreIndex,
|
||||
} from "llamaindex";
|
||||
async function main() {
|
||||
Settings.embedModel = new GeminiEmbedding({
|
||||
model: GEMINI_EMBEDDING_MODEL.TEXT_EMBEDDING_004,
|
||||
});
|
||||
Settings.llm = gemini({
|
||||
model: GEMINI_MODEL.GEMINI_PRO_1_5_FLASH,
|
||||
});
|
||||
// Create sample documents
|
||||
const documents = [
|
||||
new Document({
|
||||
text: "Elastic search is a powerful search engine",
|
||||
metadata: {
|
||||
source: "tech_docs",
|
||||
author: "John Doe",
|
||||
},
|
||||
}),
|
||||
new Document({
|
||||
text: "Vector search enables semantic similarity search",
|
||||
metadata: {
|
||||
source: "research_paper",
|
||||
author: "Jane Smith",
|
||||
},
|
||||
}),
|
||||
new Document({
|
||||
text: "Elasticsearch supports various distance metrics for vector search",
|
||||
metadata: {
|
||||
source: "tech_docs",
|
||||
author: "Bob Wilson",
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
// Initialize ElasticSearch Vector Store
|
||||
const vectorStore = new ElasticSearchVectorStore({
|
||||
indexName: "llamaindex-demo",
|
||||
esCloudId: process.env.ES_CLOUD_ID,
|
||||
esApiKey: process.env.ES_API_KEY,
|
||||
});
|
||||
|
||||
// Create storage context with the vector store
|
||||
const storageContext = await storageContextFromDefaults({
|
||||
vectorStore,
|
||||
});
|
||||
|
||||
// Create and store embeddings in ElasticSearch
|
||||
const index = await VectorStoreIndex.fromDocuments(documents, {
|
||||
storageContext,
|
||||
});
|
||||
|
||||
// Query the index
|
||||
const queryEngine = index.asQueryEngine();
|
||||
|
||||
// Simple query
|
||||
const response = await queryEngine.query({
|
||||
query: "What is vector search?",
|
||||
});
|
||||
console.log("Basic Query Response:", response.toString());
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "elastic-search-vector-store",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "npx tsx index.ts"
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
import {
|
||||
gemini,
|
||||
GEMINI_EMBEDDING_MODEL,
|
||||
GEMINI_MODEL,
|
||||
GeminiEmbedding,
|
||||
} from "@llamaindex/google";
|
||||
import { SupabaseVectorStore } from "@llamaindex/supabase";
|
||||
import {
|
||||
Document,
|
||||
Settings,
|
||||
storageContextFromDefaults,
|
||||
VectorStoreIndex,
|
||||
} from "llamaindex";
|
||||
async function main() {
|
||||
Settings.embedModel = new GeminiEmbedding({
|
||||
model: GEMINI_EMBEDDING_MODEL.TEXT_EMBEDDING_004,
|
||||
});
|
||||
Settings.llm = gemini({
|
||||
model: GEMINI_MODEL.GEMINI_PRO_1_5_FLASH,
|
||||
});
|
||||
// Create sample documents
|
||||
const documents = [
|
||||
new Document({
|
||||
text: "Supbase is a powerful Database engine",
|
||||
metadata: {
|
||||
source: "tech_docs",
|
||||
author: "John Doe",
|
||||
},
|
||||
}),
|
||||
new Document({
|
||||
text: "Vector search enables semantic similarity search",
|
||||
metadata: {
|
||||
source: "research_paper",
|
||||
author: "Jane Smith",
|
||||
},
|
||||
}),
|
||||
new Document({
|
||||
text: "Supbase vector store supports various distance metrics for vector search",
|
||||
metadata: {
|
||||
source: "tech_docs",
|
||||
author: "Bob Wilson",
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
// Initialize ElasticSearch Vector Store
|
||||
const vectorStore = new SupabaseVectorStore({
|
||||
supabaseUrl: process.env.SUPABASE_URL,
|
||||
supabaseKey: process.env.SUPABASE_KEY,
|
||||
table: "document",
|
||||
});
|
||||
|
||||
// await vectorStore.delete("fc079c38-2af4-4782-96e4-955c28608fcf");
|
||||
|
||||
// Create storage context with the vector store
|
||||
const storageContext = await storageContextFromDefaults({
|
||||
vectorStore,
|
||||
});
|
||||
|
||||
// Create and store embeddings in ElasticSearch
|
||||
const index = await VectorStoreIndex.fromDocuments(documents, {
|
||||
storageContext,
|
||||
});
|
||||
|
||||
// Query the index
|
||||
const queryEngine = index.asQueryEngine();
|
||||
|
||||
// Simple query
|
||||
const response = await queryEngine.query({
|
||||
query: "What is vector search?",
|
||||
});
|
||||
console.log("Basic Query Response:", response.toString());
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "vector-store-supabase",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "npx tsx index.ts"
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -35,8 +35,7 @@
|
||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||
"turbo": "^2.4.4",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript-eslint": "^8.18.0",
|
||||
"vitest": "^3.1.1"
|
||||
"typescript-eslint": "^8.18.0"
|
||||
},
|
||||
"packageManager": "pnpm@9.12.3",
|
||||
"lint-staged": {
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
# @llamaindex/autotool
|
||||
|
||||
## 6.0.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.15
|
||||
|
||||
## 6.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9d951b2]
|
||||
- llamaindex@0.9.14
|
||||
|
||||
## 6.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75d6e29]
|
||||
- llamaindex@0.9.13
|
||||
|
||||
## 6.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.12
|
||||
|
||||
## 6.0.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,35 +1,5 @@
|
||||
# @llamaindex/autotool-01-node-example
|
||||
|
||||
## 0.0.96
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.15
|
||||
- @llamaindex/autotool@6.0.15
|
||||
|
||||
## 0.0.95
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9d951b2]
|
||||
- llamaindex@0.9.14
|
||||
- @llamaindex/autotool@6.0.14
|
||||
|
||||
## 0.0.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75d6e29]
|
||||
- llamaindex@0.9.13
|
||||
- @llamaindex/autotool@6.0.13
|
||||
|
||||
## 0.0.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.12
|
||||
- @llamaindex/autotool@6.0.12
|
||||
|
||||
## 0.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
"scripts": {
|
||||
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
|
||||
},
|
||||
"version": "0.0.96"
|
||||
"version": "0.0.92"
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"url": "git+https://github.com/run-llama/LlamaIndexTS.git",
|
||||
"directory": "packages/autotool"
|
||||
},
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.11",
|
||||
"description": "auto transpile your JS function to LLM Agent compatible",
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -1,32 +1,5 @@
|
||||
# @llamaindex/cloud
|
||||
|
||||
## 4.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/core@0.6.2
|
||||
|
||||
## 4.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- @llamaindex/core@0.6.1
|
||||
|
||||
## 4.0.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- bf56fc0: chore: bump sdk openapi.json
|
||||
- 5189b44: fix: add retry handling logic to parser reader and fix lint issues
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [5189b44]
|
||||
- @llamaindex/core@0.6.0
|
||||
|
||||
## 3.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/cloud",
|
||||
"version": "4.0.2",
|
||||
"version": "3.0.9",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,38 +1,5 @@
|
||||
# @llamaindex/community
|
||||
|
||||
## 0.0.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/core@0.6.2
|
||||
|
||||
## 0.0.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- @llamaindex/core@0.6.1
|
||||
|
||||
## 0.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 1325178: fix: stringify all tool results for anthropic on bedrock
|
||||
|
||||
## 0.0.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 5189b44: fix: add retry handling logic to parser reader and fix lint issues
|
||||
- 3fd4cc3: feat: use google's new gen ai library to support multimodal output
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [5189b44]
|
||||
- @llamaindex/core@0.6.0
|
||||
|
||||
## 0.0.90
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/community",
|
||||
"description": "Community package for LlamaIndexTS",
|
||||
"version": "0.0.94",
|
||||
"version": "0.0.90",
|
||||
"type": "module",
|
||||
"types": "dist/type/index.d.ts",
|
||||
"main": "dist/cjs/index.js",
|
||||
|
||||
@@ -10,10 +10,12 @@ import type {
|
||||
MessageContentDetail,
|
||||
ToolCallLLMMessageOptions,
|
||||
} from "@llamaindex/core/llms";
|
||||
import { extractDataUrlComponents } from "../utils";
|
||||
import {
|
||||
extractDataUrlComponents,
|
||||
mapMessageContentToMessageContentDetails,
|
||||
} from "../utils";
|
||||
|
||||
import type { JSONObject } from "@llamaindex/core/global";
|
||||
import { mapMessageContentToMessageContentDetails } from "../../utils";
|
||||
import type { AmazonMessage, AmazonMessages } from "./types";
|
||||
|
||||
const ACCEPTED_IMAGE_MIME_TYPES = [
|
||||
|
||||
@@ -6,8 +6,10 @@ import type {
|
||||
MessageContentDetail,
|
||||
ToolCallLLMMessageOptions,
|
||||
} from "@llamaindex/core/llms";
|
||||
import { mapMessageContentToMessageContentDetails } from "../../utils";
|
||||
import { extractDataUrlComponents } from "../utils";
|
||||
import {
|
||||
extractDataUrlComponents,
|
||||
mapMessageContentToMessageContentDetails,
|
||||
} from "../utils";
|
||||
import type {
|
||||
AnthropicContent,
|
||||
AnthropicImageContent,
|
||||
@@ -111,7 +113,7 @@ export const mapChatMessagesToAnthropicMessages = <
|
||||
{
|
||||
type: "tool_result",
|
||||
tool_use_id: msg.options.toolResult.id,
|
||||
content: JSON.stringify(msg.options.toolResult.result),
|
||||
content: msg.options.toolResult.result,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -22,9 +22,9 @@ import {
|
||||
type BedrockChatStreamResponse,
|
||||
Provider,
|
||||
} from "./provider";
|
||||
import { mapMessageContentToMessageContentDetails } from "./utils";
|
||||
|
||||
import { wrapLLMEvent } from "@llamaindex/core/decorator";
|
||||
import { mapMessageContentToMessageContentDetails } from "../utils";
|
||||
import { AmazonProvider } from "./amazon/provider";
|
||||
import { AnthropicProvider } from "./anthropic/provider";
|
||||
import { MetaProvider } from "./meta/provider";
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
import type {
|
||||
MessageContent,
|
||||
MessageContentDetail,
|
||||
} from "@llamaindex/core/llms";
|
||||
|
||||
export const mapMessageContentToMessageContentDetails = (
|
||||
content: MessageContent,
|
||||
): MessageContentDetail[] => {
|
||||
return Array.isArray(content) ? content : [{ type: "text", text: content }];
|
||||
};
|
||||
|
||||
export const toUtf8 = (input: Uint8Array): string =>
|
||||
new TextDecoder("utf-8").decode(input);
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import type {
|
||||
MessageContent,
|
||||
MessageContentDetail,
|
||||
} from "@llamaindex/core/llms";
|
||||
|
||||
export const mapMessageContentToMessageContentDetails = (
|
||||
content: MessageContent,
|
||||
): MessageContentDetail[] => {
|
||||
return Array.isArray(content) ? content : [{ type: "text", text: content }];
|
||||
};
|
||||
@@ -1,31 +1,5 @@
|
||||
# @llamaindex/core
|
||||
|
||||
## 0.6.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9c63f3f: Add support for openai responses api
|
||||
|
||||
## 0.6.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 1b6f368: Support loading from URLs for all readers extending FileReader
|
||||
- eaf326e: Fix passing right llm setting from SimpleChatEngine to ChatMemoryBuffer
|
||||
|
||||
## 0.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 91a18e7: Added support for structured output in the chat api of openai and ollama
|
||||
Added structured output parameter in the provider
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 21bebfc: Expose more content to fix the issue with unavailable documentation links, and adjust the documentation based on the latest code.
|
||||
- 93bc0ff: fix: include additional options for context chat engine
|
||||
- 5189b44: fix: add retry handling logic to parser reader and fix lint issues
|
||||
|
||||
## 0.5.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/core",
|
||||
"type": "module",
|
||||
"version": "0.6.2",
|
||||
"version": "0.5.8",
|
||||
"description": "LlamaIndex Core Module",
|
||||
"exports": {
|
||||
"./agent": {
|
||||
|
||||
@@ -102,7 +102,6 @@ export class ContextChatEngine extends PromptMixin implements BaseChatEngine {
|
||||
const stream = await this.chatModel.chat({
|
||||
messages: requestMessages.messages,
|
||||
stream: true,
|
||||
additionalChatOptions: params.chatOptions as object,
|
||||
});
|
||||
return streamConverter(
|
||||
streamReducer({
|
||||
@@ -118,7 +117,6 @@ export class ContextChatEngine extends PromptMixin implements BaseChatEngine {
|
||||
}
|
||||
const response = await this.chatModel.chat({
|
||||
messages: requestMessages.messages,
|
||||
additionalChatOptions: params.chatOptions as object,
|
||||
});
|
||||
chatHistory.put(response.message);
|
||||
return EngineResponse.fromChatResponse(response, requestMessages.nodes);
|
||||
|
||||
@@ -24,12 +24,8 @@ export class SimpleChatEngine implements BaseChatEngine {
|
||||
}
|
||||
|
||||
constructor(init?: Partial<SimpleChatEngine>) {
|
||||
this.memory = init?.memory ?? new ChatMemoryBuffer();
|
||||
this.llm = init?.llm ?? Settings.llm;
|
||||
this.memory =
|
||||
init?.memory ??
|
||||
new ChatMemoryBuffer({
|
||||
llm: this.llm,
|
||||
});
|
||||
}
|
||||
|
||||
chat(params: NonStreamingChatEngineParams): Promise<EngineResponse>;
|
||||
@@ -44,7 +40,6 @@ export class SimpleChatEngine implements BaseChatEngine {
|
||||
|
||||
const chatHistory = params.chatHistory
|
||||
? new ChatMemoryBuffer({
|
||||
llm: this.llm,
|
||||
chatHistory:
|
||||
params.chatHistory instanceof BaseMemory
|
||||
? await params.chatHistory.getMessages()
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { Tokenizers } from "@llamaindex/env/tokenizers";
|
||||
import type { JSONSchemaType } from "ajv";
|
||||
import { z } from "zod";
|
||||
import type { JSONObject, JSONValue } from "../global";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
@@ -54,12 +55,7 @@ export interface LLM<
|
||||
): Promise<CompletionResponse>;
|
||||
}
|
||||
|
||||
export type MessageType =
|
||||
| "user"
|
||||
| "assistant"
|
||||
| "system"
|
||||
| "memory"
|
||||
| "developer";
|
||||
export type MessageType = "user" | "assistant" | "system" | "memory";
|
||||
|
||||
export type TextChatMessage<AdditionalMessageOptions extends object = object> =
|
||||
{
|
||||
@@ -160,7 +156,6 @@ export type MessageContentTextDetail = {
|
||||
export type MessageContentImageDetail = {
|
||||
type: "image_url";
|
||||
image_url: { url: string };
|
||||
detail?: "high" | "low" | "auto";
|
||||
};
|
||||
|
||||
export type MessageContentDetail =
|
||||
|
||||
@@ -63,29 +63,8 @@ export abstract class FileReader<T extends BaseNode = Document>
|
||||
): Promise<T[]>;
|
||||
|
||||
async loadData(filePath: string): Promise<T[]> {
|
||||
let fileContent: Uint8Array;
|
||||
let filename: string;
|
||||
|
||||
// Check if filePath is a URL
|
||||
if (filePath.startsWith("http://") || filePath.startsWith("https://")) {
|
||||
// Handle URL
|
||||
const response = await fetch(filePath);
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
`Failed to fetch URL: ${filePath}, status: ${response.status}`,
|
||||
);
|
||||
}
|
||||
const buffer = await response.arrayBuffer();
|
||||
fileContent = new Uint8Array(buffer);
|
||||
// Extract filename from URL
|
||||
const url = new URL(filePath);
|
||||
filename = path.basename(url.pathname) || "url_document";
|
||||
} else {
|
||||
// Handle local file
|
||||
fileContent = await fs.readFile(filePath);
|
||||
filename = path.basename(filePath);
|
||||
}
|
||||
|
||||
const fileContent = await fs.readFile(filePath);
|
||||
const filename = path.basename(filePath);
|
||||
const docs = await this.loadDataAsContent(fileContent, filename);
|
||||
docs.forEach(FileReader.addMetaData(filePath));
|
||||
return docs;
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Document, FileReader } from "@llamaindex/core/schema";
|
||||
import { fs, path } from "@llamaindex/env";
|
||||
import { TextDecoder, TextEncoder } from "util";
|
||||
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
||||
|
||||
// Mock implementation of FileReader for testing
|
||||
class TestFileReader extends FileReader<Document> {
|
||||
async loadDataAsContent(
|
||||
fileContent: Uint8Array,
|
||||
filename?: string,
|
||||
): Promise<Document[]> {
|
||||
const text = new TextDecoder().decode(fileContent);
|
||||
return [new Document({ text, metadata: { filename } })];
|
||||
}
|
||||
}
|
||||
|
||||
describe("FileReader", () => {
|
||||
let reader: TestFileReader;
|
||||
let mockFetch: any;
|
||||
let mockFsReadFile: any;
|
||||
|
||||
beforeEach(() => {
|
||||
reader = new TestFileReader();
|
||||
|
||||
// Mock fetch for URL tests
|
||||
mockFetch = vi.fn();
|
||||
global.fetch = mockFetch;
|
||||
|
||||
// Mock fs.readFile for local file tests
|
||||
mockFsReadFile = vi.spyOn(fs, "readFile");
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
test("loadData should load content from a local file", async () => {
|
||||
const testFilePath = "/path/to/test.txt";
|
||||
const testContent = "Test file content";
|
||||
const testContentBuffer = new TextEncoder().encode(testContent);
|
||||
|
||||
mockFsReadFile.mockResolvedValue(testContentBuffer);
|
||||
|
||||
const result = await reader.loadData(testFilePath);
|
||||
|
||||
expect(mockFsReadFile).toHaveBeenCalledWith(testFilePath);
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result[0]).toBeInstanceOf(Document);
|
||||
expect(result[0]?.getText()).toBe(testContent);
|
||||
expect(result[0]?.metadata.file_path).toBe(path.resolve(testFilePath));
|
||||
expect(result[0]?.metadata.file_name).toBe("test.txt");
|
||||
});
|
||||
|
||||
test("loadData should load content from a URL", async () => {
|
||||
const testUrl = "https://example.com/test.txt";
|
||||
const testContent = "Test URL content";
|
||||
const testContentBuffer = new TextEncoder().encode(testContent);
|
||||
|
||||
// Mock fetch response
|
||||
mockFetch.mockResolvedValue({
|
||||
ok: true,
|
||||
arrayBuffer: () => Promise.resolve(testContentBuffer.buffer),
|
||||
});
|
||||
|
||||
const result = await reader.loadData(testUrl);
|
||||
|
||||
expect(mockFetch).toHaveBeenCalledWith(testUrl);
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result[0]).toBeInstanceOf(Document);
|
||||
expect(result[0]?.getText()).toBe(testContent);
|
||||
expect(result[0]?.metadata.file_path).toBe(path.resolve(testUrl));
|
||||
expect(result[0]?.metadata.file_name).toBe("test.txt");
|
||||
});
|
||||
|
||||
test("loadData should throw an error for failed URL fetch", async () => {
|
||||
const testUrl = "https://example.com/not-found.txt";
|
||||
|
||||
// Mock failed fetch response
|
||||
mockFetch.mockResolvedValue({
|
||||
ok: false,
|
||||
status: 404,
|
||||
});
|
||||
|
||||
await expect(reader.loadData(testUrl)).rejects.toThrow(
|
||||
`Failed to fetch URL: ${testUrl}, status: 404`,
|
||||
);
|
||||
|
||||
expect(mockFetch).toHaveBeenCalledWith(testUrl);
|
||||
});
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
import { SimpleChatEngine } from "@llamaindex/core/chat-engine";
|
||||
import { ChatMemoryBuffer } from "@llamaindex/core/memory";
|
||||
import { MockLLM } from "@llamaindex/core/utils";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
describe("SimpleChatEngine", () => {
|
||||
test("constructor initializes with provided LLM", () => {
|
||||
const llm = new MockLLM();
|
||||
const engine = new SimpleChatEngine({ llm });
|
||||
expect(engine.llm).toBe(llm);
|
||||
expect(engine.memory).toBeInstanceOf(ChatMemoryBuffer);
|
||||
expect((engine.memory as ChatMemoryBuffer).tokenLimit).toBe(768);
|
||||
});
|
||||
});
|
||||
@@ -1,31 +1,5 @@
|
||||
# @llamaindex/experimental
|
||||
|
||||
## 0.0.165
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.15
|
||||
|
||||
## 0.0.164
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9d951b2]
|
||||
- llamaindex@0.9.14
|
||||
|
||||
## 0.0.163
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75d6e29]
|
||||
- llamaindex@0.9.13
|
||||
|
||||
## 0.0.162
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- llamaindex@0.9.12
|
||||
|
||||
## 0.0.161
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/experimental",
|
||||
"description": "Experimental package for LlamaIndexTS",
|
||||
"version": "0.0.165",
|
||||
"version": "0.0.161",
|
||||
"type": "module",
|
||||
"types": "dist/type/index.d.ts",
|
||||
"main": "dist/cjs/index.js",
|
||||
|
||||
@@ -1,53 +1,5 @@
|
||||
# llamaindex
|
||||
|
||||
## 0.9.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- Updated dependencies [c515a32]
|
||||
- @llamaindex/openai@0.3.0
|
||||
- @llamaindex/core@0.6.2
|
||||
- @llamaindex/workflow@1.0.2
|
||||
- @llamaindex/cloud@4.0.2
|
||||
- @llamaindex/node-parser@2.0.2
|
||||
|
||||
## 0.9.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9d951b2: feat: support llamacloud in @llamaindex/server
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- @llamaindex/core@0.6.1
|
||||
- @llamaindex/cloud@4.0.1
|
||||
- @llamaindex/node-parser@2.0.1
|
||||
- @llamaindex/openai@0.2.1
|
||||
- @llamaindex/workflow@1.0.1
|
||||
|
||||
## 0.9.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 75d6e29: feat: response source nodes in query tool output
|
||||
|
||||
## 0.9.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [bf56fc0]
|
||||
- Updated dependencies [f8a86e4]
|
||||
- Updated dependencies [5189b44]
|
||||
- Updated dependencies [58a9446]
|
||||
- @llamaindex/core@0.6.0
|
||||
- @llamaindex/openai@0.2.0
|
||||
- @llamaindex/cloud@4.0.0
|
||||
- @llamaindex/workflow@1.0.0
|
||||
- @llamaindex/node-parser@2.0.0
|
||||
|
||||
## 0.9.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "llamaindex",
|
||||
"version": "0.9.15",
|
||||
"version": "0.9.11",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"keywords": [
|
||||
|
||||
@@ -25,9 +25,7 @@ import {
|
||||
} from "@llamaindex/cloud/api";
|
||||
import type { BaseRetriever } from "@llamaindex/core/retriever";
|
||||
import { getEnv } from "@llamaindex/env";
|
||||
import type { QueryToolParams } from "../indices/BaseIndex.js";
|
||||
import { Settings } from "../Settings.js";
|
||||
import { QueryEngineTool } from "../tools/QueryEngineTool.js";
|
||||
|
||||
export class LlamaCloudIndex {
|
||||
params: CloudConstructorParams;
|
||||
@@ -274,22 +272,6 @@ export class LlamaCloudIndex {
|
||||
);
|
||||
}
|
||||
|
||||
asQueryTool(params: QueryToolParams): QueryEngineTool {
|
||||
if (params.options) {
|
||||
params.retriever = this.asRetriever(params.options);
|
||||
}
|
||||
|
||||
return new QueryEngineTool({
|
||||
queryEngine: this.asQueryEngine(params),
|
||||
metadata: params?.metadata,
|
||||
includeSourceNodes: params?.includeSourceNodes ?? false,
|
||||
});
|
||||
}
|
||||
|
||||
queryTool(params: QueryToolParams): QueryEngineTool {
|
||||
return this.asQueryTool(params);
|
||||
}
|
||||
|
||||
async insert(document: Document) {
|
||||
const pipelineId = await this.getPipelineId();
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ export type QueryToolParams = (
|
||||
) & {
|
||||
responseSynthesizer?: BaseSynthesizer;
|
||||
metadata?: ToolMetadata<JSONSchemaType<QueryEngineParam>> | undefined;
|
||||
includeSourceNodes?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -99,7 +98,6 @@ export abstract class BaseIndex<T> {
|
||||
return new QueryEngineTool({
|
||||
queryEngine: this.asQueryEngine(params),
|
||||
metadata: params?.metadata,
|
||||
includeSourceNodes: params?.includeSourceNodes ?? false,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { JSONValue } from "@llamaindex/core/global";
|
||||
import type { BaseTool, ToolMetadata } from "@llamaindex/core/llms";
|
||||
import type { BaseQueryEngine } from "@llamaindex/core/query-engine";
|
||||
import type { JSONSchemaType } from "ajv";
|
||||
@@ -21,7 +20,6 @@ const DEFAULT_PARAMETERS: JSONSchemaType<QueryEngineParam> = {
|
||||
export type QueryEngineToolParams = {
|
||||
queryEngine: BaseQueryEngine;
|
||||
metadata?: ToolMetadata<JSONSchemaType<QueryEngineParam>> | undefined;
|
||||
includeSourceNodes?: boolean;
|
||||
};
|
||||
|
||||
export type QueryEngineParam = {
|
||||
@@ -31,32 +29,19 @@ export type QueryEngineParam = {
|
||||
export class QueryEngineTool implements BaseTool<QueryEngineParam> {
|
||||
private queryEngine: BaseQueryEngine;
|
||||
metadata: ToolMetadata<JSONSchemaType<QueryEngineParam>>;
|
||||
includeSourceNodes: boolean;
|
||||
|
||||
constructor({
|
||||
queryEngine,
|
||||
metadata,
|
||||
includeSourceNodes,
|
||||
}: QueryEngineToolParams) {
|
||||
constructor({ queryEngine, metadata }: QueryEngineToolParams) {
|
||||
this.queryEngine = queryEngine;
|
||||
this.metadata = {
|
||||
name: metadata?.name ?? DEFAULT_NAME,
|
||||
description: metadata?.description ?? DEFAULT_DESCRIPTION,
|
||||
parameters: metadata?.parameters ?? DEFAULT_PARAMETERS,
|
||||
};
|
||||
this.includeSourceNodes = includeSourceNodes ?? false;
|
||||
}
|
||||
|
||||
async call({ query }: QueryEngineParam) {
|
||||
const response = await this.queryEngine.query({ query });
|
||||
|
||||
if (!this.includeSourceNodes) {
|
||||
return { content: response.message.content };
|
||||
}
|
||||
|
||||
return {
|
||||
content: response.message.content,
|
||||
sourceNodes: response.sourceNodes,
|
||||
} as unknown as JSONValue;
|
||||
return response.message.content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,5 @@
|
||||
# @llamaindex/node-parser
|
||||
|
||||
## 2.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/core@0.6.2
|
||||
|
||||
## 2.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- @llamaindex/core@0.6.1
|
||||
|
||||
## 2.0.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [5189b44]
|
||||
- @llamaindex/core@0.6.0
|
||||
|
||||
## 1.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/node-parser",
|
||||
"version": "2.0.2",
|
||||
"version": "1.0.8",
|
||||
"description": "Node parser for LlamaIndex",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
|
||||
@@ -1,35 +1,5 @@
|
||||
# @llamaindex/anthropic
|
||||
|
||||
## 0.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/core@0.6.2
|
||||
|
||||
## 0.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- @llamaindex/core@0.6.1
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 91a18e7: Added support for structured output in the chat api of openai and ollama
|
||||
Added structured output parameter in the provider
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [5189b44]
|
||||
- @llamaindex/core@0.6.0
|
||||
|
||||
## 0.2.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/anthropic",
|
||||
"description": "Anthropic Adapter for LlamaIndex",
|
||||
"version": "0.3.2",
|
||||
"version": "0.2.6",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,33 +1,5 @@
|
||||
# @llamaindex/clip
|
||||
|
||||
## 0.0.48
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/openai@0.3.0
|
||||
- @llamaindex/core@0.6.2
|
||||
|
||||
## 0.0.47
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- @llamaindex/core@0.6.1
|
||||
- @llamaindex/openai@0.2.1
|
||||
|
||||
## 0.0.46
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [5189b44]
|
||||
- @llamaindex/core@0.6.0
|
||||
- @llamaindex/openai@0.2.0
|
||||
|
||||
## 0.0.45
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/clip",
|
||||
"description": "Clip Embedding Adapter for LlamaIndex",
|
||||
"version": "0.0.48",
|
||||
"version": "0.0.45",
|
||||
"type": "module",
|
||||
"types": "dist/index.d.ts",
|
||||
"main": "dist/index.cjs",
|
||||
|
||||
@@ -1,30 +1,5 @@
|
||||
# @llamaindex/cohere
|
||||
|
||||
## 0.0.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/core@0.6.2
|
||||
|
||||
## 0.0.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- @llamaindex/core@0.6.1
|
||||
|
||||
## 0.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [5189b44]
|
||||
- @llamaindex/core@0.6.0
|
||||
|
||||
## 0.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/cohere",
|
||||
"description": "Cohere Adapter for LlamaIndex",
|
||||
"version": "0.0.16",
|
||||
"version": "0.0.13",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,33 +1,5 @@
|
||||
# @llamaindex/deepinfra
|
||||
|
||||
## 0.0.48
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/openai@0.3.0
|
||||
- @llamaindex/core@0.6.2
|
||||
|
||||
## 0.0.47
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- @llamaindex/core@0.6.1
|
||||
- @llamaindex/openai@0.2.1
|
||||
|
||||
## 0.0.46
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [5189b44]
|
||||
- @llamaindex/core@0.6.0
|
||||
- @llamaindex/openai@0.2.0
|
||||
|
||||
## 0.0.45
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/deepinfra",
|
||||
"description": "Deepinfra Adapter for LlamaIndex",
|
||||
"version": "0.0.48",
|
||||
"version": "0.0.45",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,25 +1,5 @@
|
||||
# @llamaindex/deepseek
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/openai@0.3.0
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @llamaindex/openai@0.2.1
|
||||
|
||||
## 0.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [91a18e7]
|
||||
- @llamaindex/openai@0.2.0
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/deepseek",
|
||||
"description": "DeepSeek Adapter for LlamaIndex",
|
||||
"version": "0.0.8",
|
||||
"version": "0.0.5",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,25 +1,5 @@
|
||||
# @llamaindex/fireworks
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/openai@0.3.0
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @llamaindex/openai@0.2.1
|
||||
|
||||
## 0.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [91a18e7]
|
||||
- @llamaindex/openai@0.2.0
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/fireworks",
|
||||
"description": "Fireworks Adapter for LlamaIndex",
|
||||
"version": "0.0.8",
|
||||
"version": "0.0.5",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,39 +1,5 @@
|
||||
# @llamaindex/google
|
||||
|
||||
## 0.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9c63f3f: Add support for openai responses api
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/core@0.6.2
|
||||
|
||||
## 0.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1b6f368]
|
||||
- Updated dependencies [eaf326e]
|
||||
- @llamaindex/core@0.6.1
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 91a18e7: Added support for structured output in the chat api of openai and ollama
|
||||
Added structured output parameter in the provider
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- da06e45: fix: don't ignore parts that only have inline data for google studio
|
||||
- 2a0a899: Added saftey setting parameter for gemini
|
||||
- 3fd4cc3: feat: use google's new gen ai library to support multimodal output
|
||||
- Updated dependencies [21bebfc]
|
||||
- Updated dependencies [93bc0ff]
|
||||
- Updated dependencies [91a18e7]
|
||||
- Updated dependencies [5189b44]
|
||||
- @llamaindex/core@0.6.0
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/google",
|
||||
"description": "Google Adapter for LlamaIndex",
|
||||
"version": "0.2.2",
|
||||
"version": "0.1.2",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
@@ -34,7 +34,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@google-cloud/vertexai": "1.9.0",
|
||||
"@google/genai": "^0.4.0",
|
||||
"@google/generative-ai": "0.21.0",
|
||||
"@llamaindex/core": "workspace:*",
|
||||
"@llamaindex/env": "workspace:*"
|
||||
|
||||
@@ -63,7 +63,7 @@ export const GEMINI_MODEL_INFO_MAP: Record<GEMINI_MODEL, GeminiModelInfo> = {
|
||||
[GEMINI_MODEL.GEMINI_2_0_PRO_EXPERIMENTAL]: { contextWindow: 2 * 10 ** 6 },
|
||||
};
|
||||
|
||||
export const SUPPORT_TOOL_CALL_MODELS: GEMINI_MODEL[] = [
|
||||
const SUPPORT_TOOL_CALL_MODELS: GEMINI_MODEL[] = [
|
||||
GEMINI_MODEL.GEMINI_PRO,
|
||||
GEMINI_MODEL.GEMINI_PRO_VISION,
|
||||
GEMINI_MODEL.GEMINI_PRO_1_5_PRO_PREVIEW,
|
||||
@@ -79,7 +79,7 @@ export const SUPPORT_TOOL_CALL_MODELS: GEMINI_MODEL[] = [
|
||||
GEMINI_MODEL.GEMINI_2_0_PRO_EXPERIMENTAL,
|
||||
];
|
||||
|
||||
export const DEFAULT_GEMINI_PARAMS = {
|
||||
const DEFAULT_GEMINI_PARAMS = {
|
||||
model: GEMINI_MODEL.GEMINI_PRO,
|
||||
temperature: 0.1,
|
||||
topP: 1,
|
||||
|
||||
@@ -3,10 +3,4 @@ export * from "./types";
|
||||
export * from "./utils";
|
||||
export * from "./vertex";
|
||||
|
||||
export {
|
||||
GoogleStudio,
|
||||
Modality,
|
||||
getGoogleStudioInlineData,
|
||||
} from "./studio/index.js";
|
||||
|
||||
export * from "./GeminiEmbedding";
|
||||
|
||||
@@ -1,262 +0,0 @@
|
||||
import {
|
||||
GenerateContentResponse,
|
||||
GoogleGenAI,
|
||||
Modality,
|
||||
type Blob,
|
||||
type GenerateContentConfig,
|
||||
type GoogleGenAIOptions,
|
||||
} from "@google/genai";
|
||||
import {
|
||||
ToolCallLLM,
|
||||
type ChatResponse,
|
||||
type ChatResponseChunk,
|
||||
type CompletionResponse,
|
||||
type LLMChatParamsNonStreaming,
|
||||
type LLMChatParamsStreaming,
|
||||
type LLMCompletionParamsNonStreaming,
|
||||
type LLMCompletionParamsStreaming,
|
||||
type LLMMetadata,
|
||||
type ToolCall,
|
||||
type ToolCallLLMMessageOptions,
|
||||
} from "@llamaindex/core/llms";
|
||||
export { Modality };
|
||||
|
||||
import { streamConverter } from "@llamaindex/core/utils";
|
||||
|
||||
import { wrapLLMEvent } from "@llamaindex/core/decorator";
|
||||
import type { JSONObject } from "@llamaindex/core/global";
|
||||
import { DEFAULT_GEMINI_PARAMS, SUPPORT_TOOL_CALL_MODELS } from "../base";
|
||||
import type { GEMINI_MODEL } from "../types";
|
||||
import {
|
||||
mapChatMessagesToGoogleFunctions,
|
||||
mapChatMessagesToGoogleMessages,
|
||||
mapMessageContentDetailToGooglePart,
|
||||
mapMessageContentToMessageContentDetails,
|
||||
} from "./utils";
|
||||
|
||||
export type GoogleAdditionalChatOptions = { config: GenerateContentConfig };
|
||||
|
||||
export type GoogleChatStreamResponse = AsyncIterable<
|
||||
ChatResponseChunk<
|
||||
ToolCallLLMMessageOptions & {
|
||||
data?: Blob[];
|
||||
}
|
||||
>
|
||||
>;
|
||||
|
||||
export type GoogleChatParamsStreaming = LLMChatParamsStreaming<
|
||||
GoogleAdditionalChatOptions,
|
||||
ToolCallLLMMessageOptions
|
||||
>;
|
||||
|
||||
export type GoogleChatParamsNonStreaming = LLMChatParamsNonStreaming<
|
||||
GoogleAdditionalChatOptions,
|
||||
ToolCallLLMMessageOptions
|
||||
>;
|
||||
|
||||
export type GoogleChatNonStreamResponse =
|
||||
ChatResponse<ToolCallLLMMessageOptions>;
|
||||
|
||||
export const getGoogleStudioInlineData = (
|
||||
response: GenerateContentResponse,
|
||||
): Blob[] => {
|
||||
return response.candidates
|
||||
?.flatMap((candidate) => candidate.content?.parts)
|
||||
.map((part) => part?.inlineData)
|
||||
.filter((data) => data) as Blob[];
|
||||
};
|
||||
|
||||
export type GoogleModelParams = {
|
||||
model: GEMINI_MODEL;
|
||||
temperature?: number;
|
||||
topP?: number;
|
||||
maxTokens?: number;
|
||||
};
|
||||
|
||||
export type GoogleParams = GoogleGenAIOptions & GoogleModelParams;
|
||||
|
||||
export class GoogleStudio extends ToolCallLLM<GoogleAdditionalChatOptions> {
|
||||
client: GoogleGenAI;
|
||||
model: GEMINI_MODEL;
|
||||
temperature: number;
|
||||
topP: number;
|
||||
maxTokens?: number | undefined;
|
||||
topK?: number;
|
||||
|
||||
constructor({
|
||||
temperature,
|
||||
topP,
|
||||
maxTokens,
|
||||
model,
|
||||
...params
|
||||
}: GoogleParams) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.maxTokens = maxTokens ?? DEFAULT_GEMINI_PARAMS.maxTokens;
|
||||
this.temperature = temperature ?? DEFAULT_GEMINI_PARAMS.temperature;
|
||||
this.topP = topP ?? DEFAULT_GEMINI_PARAMS.topP;
|
||||
this.client = new GoogleGenAI(params);
|
||||
}
|
||||
|
||||
get supportToolCall(): boolean {
|
||||
return SUPPORT_TOOL_CALL_MODELS.includes(this.model);
|
||||
}
|
||||
|
||||
get metadata(): LLMMetadata {
|
||||
return {
|
||||
model: this.model,
|
||||
temperature: this.temperature,
|
||||
topP: this.topP,
|
||||
maxTokens: this.maxTokens,
|
||||
contextWindow: 128000,
|
||||
tokenizer: undefined,
|
||||
structuredOutput: false,
|
||||
};
|
||||
}
|
||||
|
||||
getToolCallsFromResponse(response: GenerateContentResponse): ToolCall[] {
|
||||
if (!response.functionCalls) return [];
|
||||
return response.functionCalls.map((call) => ({
|
||||
id: call.id ?? "",
|
||||
name: call.name ?? "",
|
||||
input: call.args as JSONObject,
|
||||
}));
|
||||
}
|
||||
|
||||
protected async nonStreamChat(
|
||||
params: GoogleChatParamsNonStreaming,
|
||||
): Promise<GoogleChatNonStreamResponse> {
|
||||
if (!this.supportToolCall && params.tools?.length) {
|
||||
console.warn(`The model "${this.model}" doesn't support ToolCall`);
|
||||
}
|
||||
|
||||
const config: GenerateContentConfig =
|
||||
params.additionalChatOptions?.config ?? {};
|
||||
if (params.tools?.length) {
|
||||
if (config.responseModalities?.includes(Modality.IMAGE)) {
|
||||
console.warn("Tools are currently not supported with Modality.IMAGE");
|
||||
} else {
|
||||
config.tools = mapChatMessagesToGoogleFunctions(params.tools);
|
||||
}
|
||||
}
|
||||
const response = await this.client.models.generateContent({
|
||||
model: this.model,
|
||||
contents: mapChatMessagesToGoogleMessages(params.messages),
|
||||
config,
|
||||
});
|
||||
|
||||
if (this.supportToolCall) {
|
||||
const tools = this.getToolCallsFromResponse(response);
|
||||
if (tools.length) {
|
||||
return {
|
||||
raw: response,
|
||||
message: {
|
||||
role: "assistant",
|
||||
content: "",
|
||||
options: { toolCall: tools },
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
raw: response,
|
||||
message: {
|
||||
role: "assistant",
|
||||
content: response.text ?? "",
|
||||
options: {
|
||||
inlineData: getGoogleStudioInlineData(response),
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected async *streamChat(
|
||||
params: GoogleChatParamsStreaming,
|
||||
): GoogleChatStreamResponse {
|
||||
if (!this.supportToolCall && params.tools?.length) {
|
||||
console.warn(`The model "${this.model}" doesn't support ToolCall`);
|
||||
}
|
||||
const config: GenerateContentConfig =
|
||||
params.additionalChatOptions?.config ?? {};
|
||||
if (params.tools?.length) {
|
||||
if (config.responseModalities?.includes(Modality.IMAGE)) {
|
||||
console.warn("Tools are currently not supported with Modality.IMAGE");
|
||||
} else {
|
||||
config.tools = mapChatMessagesToGoogleFunctions(params.tools);
|
||||
}
|
||||
}
|
||||
const response = await this.client.models.generateContentStream({
|
||||
model: this.model,
|
||||
contents: mapChatMessagesToGoogleMessages(params.messages),
|
||||
config,
|
||||
});
|
||||
yield* streamConverter(response, (response) => {
|
||||
if (response.functionCalls?.length) {
|
||||
return {
|
||||
delta: "",
|
||||
raw: response,
|
||||
options: {
|
||||
toolCall: this.getToolCallsFromResponse(response),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
delta: response.text ?? "",
|
||||
raw: response,
|
||||
options: {
|
||||
inlineData: getGoogleStudioInlineData(response),
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
chat(params: GoogleChatParamsStreaming): Promise<GoogleChatStreamResponse>;
|
||||
chat(
|
||||
params: GoogleChatParamsNonStreaming,
|
||||
): Promise<GoogleChatNonStreamResponse>;
|
||||
@wrapLLMEvent
|
||||
async chat(
|
||||
params: GoogleChatParamsStreaming | GoogleChatParamsNonStreaming,
|
||||
): Promise<GoogleChatStreamResponse | GoogleChatNonStreamResponse> {
|
||||
if (params.stream) {
|
||||
return this.streamChat(params);
|
||||
}
|
||||
return this.nonStreamChat(params);
|
||||
}
|
||||
|
||||
complete(
|
||||
params: LLMCompletionParamsStreaming,
|
||||
): Promise<AsyncIterable<CompletionResponse>>;
|
||||
complete(
|
||||
params: LLMCompletionParamsNonStreaming,
|
||||
): Promise<CompletionResponse>;
|
||||
async complete(
|
||||
params: LLMCompletionParamsStreaming | LLMCompletionParamsNonStreaming,
|
||||
): Promise<CompletionResponse | AsyncIterable<CompletionResponse>> {
|
||||
const contents = mapMessageContentToMessageContentDetails(
|
||||
params.prompt,
|
||||
).map(mapMessageContentDetailToGooglePart);
|
||||
if (params.stream) {
|
||||
const response = await this.client.models.generateContentStream({
|
||||
model: this.model,
|
||||
contents,
|
||||
});
|
||||
return streamConverter(response, (response) => {
|
||||
return {
|
||||
text: response.text ?? "",
|
||||
raw: response,
|
||||
};
|
||||
});
|
||||
}
|
||||
const response = await this.client.models.generateContent({
|
||||
model: this.model,
|
||||
contents,
|
||||
});
|
||||
|
||||
return {
|
||||
text: response.text || "",
|
||||
raw: response,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
import type {
|
||||
ContentListUnion,
|
||||
ContentUnion,
|
||||
Part,
|
||||
Schema,
|
||||
ToolListUnion,
|
||||
} from "@google/genai";
|
||||
import type {
|
||||
BaseTool,
|
||||
ChatMessage,
|
||||
MessageContentDetail,
|
||||
ToolCallLLMMessageOptions,
|
||||
} from "@llamaindex/core/llms";
|
||||
import { extractDataUrlComponents } from "@llamaindex/core/utils";
|
||||
|
||||
import type { MessageContent } from "@llamaindex/core/llms";
|
||||
|
||||
export const mapMessageContentToMessageContentDetails = (
|
||||
content: MessageContent,
|
||||
): MessageContentDetail[] => {
|
||||
return Array.isArray(content) ? content : [{ type: "text", text: content }];
|
||||
};
|
||||
|
||||
const ACCEPTED_IMAGE_MIME_TYPES = ["image/jpeg", "image/png"];
|
||||
|
||||
export const mapTextPart = (text: string): Part => {
|
||||
return { text };
|
||||
};
|
||||
|
||||
export const mapImagePart = (imageUrl: string): Part => {
|
||||
if (!imageUrl.startsWith("data:"))
|
||||
throw new Error(
|
||||
"For Google 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))
|
||||
throw new Error(
|
||||
`Anthropic only accepts the following mimeTypes: ${ACCEPTED_IMAGE_MIME_TYPES.join("\n")}`,
|
||||
);
|
||||
|
||||
return {
|
||||
inlineData: {
|
||||
mimeType,
|
||||
data,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const mapMessageContentDetailToGooglePart = <
|
||||
T extends MessageContentDetail,
|
||||
>(
|
||||
detail: T,
|
||||
): Part => {
|
||||
let part: Part;
|
||||
|
||||
if (detail.type === "text") {
|
||||
part = mapTextPart(detail.text);
|
||||
} else if (detail.type === "image_url") {
|
||||
part = mapImagePart(detail.image_url.url);
|
||||
} else {
|
||||
throw new Error("Unsupported content detail type");
|
||||
}
|
||||
return part;
|
||||
};
|
||||
export const mapChatMessagesToGoogleFunctions = (
|
||||
tools: BaseTool[],
|
||||
): ToolListUnion => {
|
||||
return [
|
||||
{
|
||||
functionDeclarations: tools.map((tool) => ({
|
||||
response: tool.metadata.parameters as Schema,
|
||||
description: tool.metadata.description,
|
||||
name: tool.metadata.name,
|
||||
})),
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
export const mapChatMessagesToGoogleMessages = <
|
||||
T extends ChatMessage<ToolCallLLMMessageOptions>,
|
||||
>(
|
||||
messages: T[],
|
||||
): ContentListUnion => {
|
||||
const functionNames: Record<string, string> = {};
|
||||
messages.forEach((msg: T) => {
|
||||
if (msg.options && "toolCall" in msg.options) {
|
||||
const mapped = msg.options.toolCall.reduce(
|
||||
(result, item) => {
|
||||
result[item.id] = item.name;
|
||||
return result;
|
||||
},
|
||||
{} as Record<string, string>,
|
||||
);
|
||||
|
||||
Object.assign(functionNames, mapped);
|
||||
}
|
||||
});
|
||||
return messages.flatMap((msg: T): ContentListUnion => {
|
||||
if (msg.options && "toolResult" in msg.options) {
|
||||
return {
|
||||
role: "user",
|
||||
parts: [
|
||||
{
|
||||
functionResponse: {
|
||||
name: functionNames[msg.options.toolResult.id] ?? "",
|
||||
response: msg.options.toolResult,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
if (msg.options && "toolCall" in msg.options) {
|
||||
return {
|
||||
role: "model",
|
||||
parts: msg.options.toolCall.map((call) => ({
|
||||
functionCall: {
|
||||
name: call.name,
|
||||
args: call.input as Record<string, unknown>,
|
||||
},
|
||||
})),
|
||||
};
|
||||
}
|
||||
return mapMessageContentToMessageContentDetails(msg.content)
|
||||
.map((detail: MessageContentDetail): ContentUnion | null => {
|
||||
const part = mapMessageContentDetailToGooglePart(detail);
|
||||
if (!part.text && !part.inlineData) return null;
|
||||
|
||||
return {
|
||||
role: msg.role === "assistant" ? "model" : "user",
|
||||
parts: [part],
|
||||
};
|
||||
})
|
||||
.filter((content) => content) as ContentUnion;
|
||||
});
|
||||
};
|
||||
@@ -181,7 +181,7 @@ export const mapBaseToolToGeminiFunctionDeclaration = (
|
||||
export class GeminiHelper {
|
||||
// Gemini only has user and model roles. Put the rest in user role.
|
||||
public static readonly ROLES_TO_GEMINI: Record<
|
||||
Exclude<MessageType, "developer">,
|
||||
MessageType,
|
||||
GeminiMessageRole
|
||||
> = {
|
||||
user: "user",
|
||||
@@ -285,9 +285,7 @@ export class GeminiHelper {
|
||||
if (message.options && "toolResult" in message.options) {
|
||||
return "function";
|
||||
}
|
||||
return GeminiHelper.ROLES_TO_GEMINI[
|
||||
message.role as Exclude<MessageType, "developer">
|
||||
];
|
||||
return GeminiHelper.ROLES_TO_GEMINI[message.role];
|
||||
}
|
||||
|
||||
public static chatMessageToGemini(
|
||||
|
||||
@@ -1,25 +1,5 @@
|
||||
# @llamaindex/groq
|
||||
|
||||
## 0.0.63
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9c63f3f]
|
||||
- @llamaindex/openai@0.3.0
|
||||
|
||||
## 0.0.62
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @llamaindex/openai@0.2.1
|
||||
|
||||
## 0.0.61
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [91a18e7]
|
||||
- @llamaindex/openai@0.2.0
|
||||
|
||||
## 0.0.60
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/groq",
|
||||
"description": "Groq Adapter for LlamaIndex",
|
||||
"version": "0.0.63",
|
||||
"version": "0.0.60",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user