mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-03 19:19:08 -04:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| acd9b66de4 | |||
| fed32ab83d | |||
| 3af5617931 | |||
| 724d0ef9ff | |||
| 020928c080 | |||
| 91627dc936 | |||
| 09ba5aa43a | |||
| 5583d92260 | |||
| 76709c2100 |
@@ -0,0 +1,123 @@
|
||||
---
|
||||
title: OVHcloud AI Endpoints
|
||||
---
|
||||
|
||||
OVHcloud AI Endpoints provide OpenAI-compatible embedding models. The service can be used for free with rate limits, or with an API key for higher limits.
|
||||
|
||||
OVHcloud is a global player and the leading European cloud provider operating over 450,000 servers within 40 data centers across 4 continents to reach 1.6 million customers in over 140 countries. Our product AI Endpoints offers access to various models with sovereignty, data privacy and GDPR compliance.
|
||||
|
||||
You can find the full list of models in the [OVHcloud AI Endpoints catalog](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/catalog/).
|
||||
|
||||
## Installation
|
||||
|
||||
```package-install
|
||||
npm i llamaindex @llamaindex/ovhcloud
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
OVHcloud AI Endpoints can be used in two ways:
|
||||
|
||||
1. **Free tier (with rate limits)**: No API key required. You can omit the `apiKey` parameter or set it to an empty string.
|
||||
2. **With API key**: For higher rate limits, generate an API key from the [OVHcloud Manager](https://ovh.com/manager) → Public Cloud → AI & Machine Learning → AI Endpoints → API keys.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
```ts
|
||||
import { Document, Settings, VectorStoreIndex } from "llamaindex";
|
||||
import { OVHcloudEmbedding } from "@llamaindex/ovhcloud";
|
||||
|
||||
// Update Embed Model (using free tier)
|
||||
Settings.embedModel = new OVHcloudEmbedding();
|
||||
|
||||
// Or with API key from environment variable
|
||||
import { config } from "dotenv";
|
||||
config();
|
||||
Settings.embedModel = new OVHcloudEmbedding({
|
||||
apiKey: process.env.OVHCLOUD_API_KEY || "",
|
||||
});
|
||||
|
||||
const document = new Document({ text: essay, id_: "essay" });
|
||||
|
||||
const index = await VectorStoreIndex.fromDocuments([document]);
|
||||
|
||||
const queryEngine = index.asQueryEngine();
|
||||
|
||||
const query = "What is the meaning of life?";
|
||||
|
||||
const results = await queryEngine.query({
|
||||
query,
|
||||
});
|
||||
```
|
||||
|
||||
By default, `OVHcloudEmbedding` uses the `BGE-M3` model. You can change the model by passing the model parameter to the constructor:
|
||||
|
||||
```ts
|
||||
import { OVHcloudEmbedding } from "@llamaindex/ovhcloud";
|
||||
|
||||
const model = "text-embedding-3-small";
|
||||
Settings.embedModel = new OVHcloudEmbedding({
|
||||
model,
|
||||
});
|
||||
```
|
||||
|
||||
You can also set the `maxRetries` and `timeout` parameters when initializing `OVHcloudEmbedding` for better control over the request behavior:
|
||||
|
||||
```ts
|
||||
import { Settings } from "llamaindex";
|
||||
import { OVHcloudEmbedding } from "@llamaindex/ovhcloud";
|
||||
|
||||
const model = "text-embedding-3-small";
|
||||
const maxRetries = 5;
|
||||
const timeout = 5000; // 5 seconds
|
||||
|
||||
Settings.embedModel = new OVHcloudEmbedding({
|
||||
model,
|
||||
maxRetries,
|
||||
timeout,
|
||||
});
|
||||
```
|
||||
|
||||
## Standalone Usage
|
||||
|
||||
```ts
|
||||
import { OVHcloudEmbedding } from "@llamaindex/ovhcloud";
|
||||
import { config } from "dotenv";
|
||||
// For standalone usage, you can optionally configure OVHCLOUD_API_KEY in .env file
|
||||
config();
|
||||
|
||||
const main = async () => {
|
||||
const model = "BGE-M3";
|
||||
// Using without API key (free tier)
|
||||
const embeddings = new OVHcloudEmbedding({ model });
|
||||
const text = "What is the meaning of life?";
|
||||
const response = await embeddings.embed([text]);
|
||||
console.log(response);
|
||||
};
|
||||
|
||||
main();
|
||||
```
|
||||
|
||||
## Base URL
|
||||
|
||||
The default base URL is `https://oai.endpoints.kepler.ai.cloud.ovh.net/v1`. You can override it if needed:
|
||||
|
||||
```ts
|
||||
const embedding = new OVHcloudEmbedding({
|
||||
model: "BGE-M3",
|
||||
additionalSessionOptions: {
|
||||
baseURL: "https://custom.endpoint.com/v1",
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [OVHcloud AI Endpoints Catalog](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/catalog/)
|
||||
- [OVHcloud Manager](https://ovh.com/manager)
|
||||
- [OVHcloud AI Endpoints Documentation](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/)
|
||||
|
||||
## API Reference
|
||||
|
||||
- [OVHcloudEmbedding](/typescript/framework-api-reference/classes/ovhcloudembedding/)
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
---
|
||||
title: OVHcloud AI Endpoints
|
||||
---
|
||||
|
||||
OVHcloud AI Endpoints provide serverless access to a variety of pre-trained AI models. The service is OpenAI-compatible and can be used for free with rate limits, or with an API key for higher limits.
|
||||
|
||||
OVHcloud is a global player and the leading European cloud provider operating over 450,000 servers within 40 data centers across 4 continents to reach 1.6 million customers in over 140 countries. Our product AI Endpoints offers access to various models with sovereignty, data privacy and GDPR compliance.
|
||||
|
||||
You can find the full list of models in the [OVHcloud AI Endpoints catalog](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/catalog/).
|
||||
|
||||
## Installation
|
||||
|
||||
```package-install
|
||||
npm i llamaindex @llamaindex/ovhcloud
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
OVHcloud AI Endpoints can be used in two ways:
|
||||
|
||||
1. **Free tier (with rate limits)**: No API key required. You can omit the `apiKey` parameter or set it to an empty string.
|
||||
2. **With API key**: For higher rate limits, generate an API key from the [OVHcloud Manager](https://ovh.com/manager) → Public Cloud → AI & Machine Learning → AI Endpoints → API keys.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
```ts
|
||||
import { OVHcloudLLM } from "@llamaindex/ovhcloud";
|
||||
import { Settings } from "llamaindex";
|
||||
|
||||
// Using without API key (free tier with rate limits)
|
||||
Settings.llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
});
|
||||
|
||||
// Or with API key from environment variable
|
||||
import { config } from "dotenv";
|
||||
config();
|
||||
Settings.llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
apiKey: process.env.OVHCLOUD_API_KEY || "",
|
||||
});
|
||||
|
||||
// Or with explicit API key
|
||||
Settings.llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
apiKey: "YOUR_API_KEY",
|
||||
});
|
||||
```
|
||||
|
||||
You can set the API key via environment variable:
|
||||
|
||||
```bash
|
||||
export OVHCLOUD_API_KEY="<YOUR_API_KEY>"
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
```ts
|
||||
import { Document, VectorStoreIndex } from "llamaindex";
|
||||
|
||||
const document = new Document({ text: essay, id_: "essay" });
|
||||
|
||||
const index = await VectorStoreIndex.fromDocuments([document]);
|
||||
```
|
||||
|
||||
## Query
|
||||
|
||||
```ts
|
||||
const queryEngine = index.asQueryEngine();
|
||||
|
||||
const query = "What is the meaning of life?";
|
||||
|
||||
const results = await queryEngine.query({
|
||||
query,
|
||||
});
|
||||
```
|
||||
|
||||
## Full Example
|
||||
|
||||
```ts
|
||||
import { OVHcloudLLM } from "@llamaindex/ovhcloud";
|
||||
import { Document, VectorStoreIndex, Settings } from "llamaindex";
|
||||
|
||||
// Use custom LLM
|
||||
const model = "gpt-oss-120b";
|
||||
Settings.llm = new OVHcloudLLM({ model, temperature: 0 });
|
||||
|
||||
async function main() {
|
||||
const document = new Document({ text: essay, id_: "essay" });
|
||||
|
||||
// Load and index documents
|
||||
const index = await VectorStoreIndex.fromDocuments([document]);
|
||||
|
||||
// get retriever
|
||||
const retriever = index.asRetriever();
|
||||
|
||||
// Create a query engine
|
||||
const queryEngine = index.asQueryEngine({
|
||||
retriever,
|
||||
});
|
||||
|
||||
const query = "What is the meaning of life?";
|
||||
|
||||
// Query
|
||||
const response = await queryEngine.query({
|
||||
query,
|
||||
});
|
||||
|
||||
// Log the response
|
||||
console.log(response.response);
|
||||
}
|
||||
```
|
||||
|
||||
## Streaming
|
||||
|
||||
OVHcloud AI Endpoints supports streaming responses:
|
||||
|
||||
```ts
|
||||
import { OVHcloudLLM } from "@llamaindex/ovhcloud";
|
||||
|
||||
const llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
});
|
||||
|
||||
const generator = await llm.chat({
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: "Tell me about OVHcloud AI Endpoints",
|
||||
},
|
||||
],
|
||||
stream: true,
|
||||
});
|
||||
|
||||
for await (const message of generator) {
|
||||
process.stdout.write(message.delta);
|
||||
}
|
||||
```
|
||||
|
||||
## Base URL
|
||||
|
||||
The default base URL is `https://oai.endpoints.kepler.ai.cloud.ovh.net/v1`. You can override it if needed:
|
||||
|
||||
```ts
|
||||
const llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
additionalSessionOptions: {
|
||||
baseURL: "https://custom.endpoint.com/v1",
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [OVHcloud AI Endpoints Catalog](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/catalog/)
|
||||
- [OVHcloud Manager](https://ovh.com/manager)
|
||||
- [OVHcloud AI Endpoints Documentation](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/)
|
||||
|
||||
## API Reference
|
||||
|
||||
- [OVHcloudLLM](/typescript/framework-api-reference/classes/ovhcloudllm/)
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/cloudflare-worker-agent-test
|
||||
|
||||
## 0.0.192
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3af5617]
|
||||
- llamaindex@0.12.1
|
||||
|
||||
## 0.0.191
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/cloudflare-worker-agent-test",
|
||||
"version": "0.0.191",
|
||||
"version": "0.0.192",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/next-agent-test
|
||||
|
||||
## 0.1.192
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3af5617]
|
||||
- llamaindex@0.12.1
|
||||
|
||||
## 0.1.191
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/next-agent-test",
|
||||
"version": "0.1.191",
|
||||
"version": "0.1.192",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# test-edge-runtime
|
||||
|
||||
## 0.1.191
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3af5617]
|
||||
- llamaindex@0.12.1
|
||||
|
||||
## 0.1.190
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/nextjs-edge-runtime-test",
|
||||
"version": "0.1.190",
|
||||
"version": "0.1.191",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @llamaindex/next-node-runtime
|
||||
|
||||
## 0.1.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3af5617]
|
||||
- llamaindex@0.12.1
|
||||
- @llamaindex/huggingface@0.1.32
|
||||
|
||||
## 0.1.63
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/next-node-runtime-test",
|
||||
"version": "0.1.63",
|
||||
"version": "0.1.64",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# vite-import-llamaindex
|
||||
|
||||
## 0.0.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3af5617]
|
||||
- llamaindex@0.12.1
|
||||
|
||||
## 0.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vite-import-llamaindex",
|
||||
"private": true,
|
||||
"version": "0.0.57",
|
||||
"version": "0.0.58",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/waku-query-engine-test
|
||||
|
||||
## 0.0.192
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3af5617]
|
||||
- llamaindex@0.12.1
|
||||
|
||||
## 0.0.191
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@llamaindex/waku-query-engine-test",
|
||||
"version": "0.0.191",
|
||||
"version": "0.0.192",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,43 @@
|
||||
# examples
|
||||
|
||||
## 0.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 09ba5aa: Add OVHcloud AI Endpoints provider
|
||||
- 91627dc: Update storage providers to append MongoDB client metadata
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- fed32ab: Update vercel/ai
|
||||
- 020928c: respect Gemini's requests-per-minute rate limit with waits
|
||||
- 3af5617: fix undefined values in querytool
|
||||
- Updated dependencies [fed32ab]
|
||||
- Updated dependencies [09ba5aa]
|
||||
- Updated dependencies [020928c]
|
||||
- Updated dependencies [3af5617]
|
||||
- Updated dependencies [76709c2]
|
||||
- Updated dependencies [91627dc]
|
||||
- @llamaindex/vercel@0.1.23
|
||||
- @llamaindex/ovhcloud@1.0.0
|
||||
- @llamaindex/google@0.4.0
|
||||
- llamaindex@0.12.1
|
||||
- @llamaindex/openai@0.4.22
|
||||
- @llamaindex/mongodb@0.1.0
|
||||
- @llamaindex/azure@0.2.0
|
||||
- @llamaindex/tools@0.2.0
|
||||
- @llamaindex/clip@0.0.78
|
||||
- @llamaindex/deepinfra@0.0.78
|
||||
- @llamaindex/deepseek@0.0.40
|
||||
- @llamaindex/fireworks@0.0.38
|
||||
- @llamaindex/groq@0.0.94
|
||||
- @llamaindex/huggingface@0.1.32
|
||||
- @llamaindex/jinaai@0.0.38
|
||||
- @llamaindex/perplexity@0.0.35
|
||||
- @llamaindex/together@0.0.38
|
||||
- @llamaindex/vllm@0.0.64
|
||||
- @llamaindex/xai@0.0.25
|
||||
|
||||
## 0.3.43
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { openai } from "@llamaindex/openai";
|
||||
import { OpenAIEmbedding, openai } from "@llamaindex/openai";
|
||||
import {
|
||||
agent,
|
||||
agentStreamEvent,
|
||||
agentToolCallResultEvent,
|
||||
} from "@llamaindex/workflow";
|
||||
import { Document, VectorStoreIndex } from "llamaindex";
|
||||
import { Document, Settings, VectorStoreIndex } from "llamaindex";
|
||||
|
||||
async function main() {
|
||||
Settings.embedModel = new OpenAIEmbedding();
|
||||
Settings.llm = openai({ model: "gpt-4o" });
|
||||
|
||||
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.",
|
||||
@@ -20,7 +23,6 @@ async function main() {
|
||||
]);
|
||||
|
||||
const myAgent = agent({
|
||||
llm: openai({ model: "gpt-4o" }),
|
||||
tools: [
|
||||
index.queryTool({
|
||||
options: { similarityTopK: 2 },
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@llamaindex/openai": "^0.4.20",
|
||||
"express": "^5.1.0",
|
||||
"express": "^5.2.0",
|
||||
"llamaindex": "^0.12.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { GEMINI_EMBEDDING_MODEL, GeminiEmbedding } from "@llamaindex/google";
|
||||
|
||||
const requests_per_minute_limit = 3000; // cf. https://ai.google.dev/gemini-api/docs/rate-limits
|
||||
|
||||
async function main() {
|
||||
if (!process.env.GOOGLE_API_KEY) {
|
||||
throw new Error("Please set the GOOGLE_API_KEY environment variable.");
|
||||
}
|
||||
const embedModel = new GeminiEmbedding({
|
||||
model: GEMINI_EMBEDDING_MODEL.EMBEDDING_001,
|
||||
});
|
||||
const texts = Array.from(
|
||||
{ length: requests_per_minute_limit + 1000 },
|
||||
(_, i) => `text ${i}`,
|
||||
);
|
||||
const embeddings = await embedModel.getTextEmbeddingsBatch(texts);
|
||||
console.log(`\nWe have ${embeddings.length} embeddings`);
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
@@ -0,0 +1,50 @@
|
||||
import { OVHcloudEmbedding, OVHcloudLLM } from "@llamaindex/ovhcloud";
|
||||
|
||||
// OVHcloud AI Endpoints can be used for free with rate limits without an API key
|
||||
// To use with an API key, set OVHCLOUD_API_KEY environment variable
|
||||
// or pass it directly in the constructor
|
||||
// To generate an API key, go to https://ovh.com/manager > Public Cloud > AI & Machine Learning > AI Endpoints > API keys
|
||||
// Visit our catalog for the list of all available models: https://www.ovhcloud.com/en/public-cloud/ai-endpoints/catalog/
|
||||
|
||||
// Example 1: Using without API key (free tier with rate limits)
|
||||
const ovhcloudFree = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
// apiKey is optional - can be omitted or set to empty string for free tier
|
||||
});
|
||||
|
||||
// Example 2: Using with API key
|
||||
const ovhcloud = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
apiKey: process.env.OVHCLOUD_API_KEY || "",
|
||||
});
|
||||
|
||||
(async () => {
|
||||
console.log("Chatting with OVHcloud AI Endpoints...");
|
||||
const generator = await ovhcloud.chat({
|
||||
messages: [
|
||||
{
|
||||
role: "system",
|
||||
content: "You are a helpful AI assistant.",
|
||||
},
|
||||
{
|
||||
role: "user",
|
||||
content: "Tell me about OVHcloud AI Endpoints",
|
||||
},
|
||||
],
|
||||
stream: true,
|
||||
});
|
||||
|
||||
for await (const message of generator) {
|
||||
process.stdout.write(message.delta);
|
||||
}
|
||||
console.log("\n");
|
||||
|
||||
// Example with embeddings
|
||||
console.log("Getting embeddings...");
|
||||
const embedding = new OVHcloudEmbedding({
|
||||
model: "BGE-M3",
|
||||
});
|
||||
const vector = await embedding.getTextEmbedding("Hello world!");
|
||||
console.log("Vector dimensions:", vector.length);
|
||||
console.log("First 5 values:", vector.slice(0, 5));
|
||||
})();
|
||||
@@ -1,11 +1,13 @@
|
||||
import { openai } from "@ai-sdk/openai";
|
||||
import { OpenAIEmbedding } from "@llamaindex/openai";
|
||||
import { llamaindex } from "@llamaindex/vercel";
|
||||
import { stepCountIs, streamText } from "ai";
|
||||
import { Document, VectorStoreIndex } from "llamaindex";
|
||||
|
||||
import { Document, Settings, VectorStoreIndex } from "llamaindex";
|
||||
import fs from "node:fs/promises";
|
||||
|
||||
async function main() {
|
||||
Settings.embedModel = new OpenAIEmbedding();
|
||||
|
||||
const path = "node_modules/llamaindex/examples/abramov.txt";
|
||||
const essay = await fs.readFile(path, "utf-8");
|
||||
const document = new Document({ text: essay, id_: path });
|
||||
|
||||
+24
-23
@@ -1,46 +1,46 @@
|
||||
{
|
||||
"name": "@llamaindex/examples",
|
||||
"version": "0.3.43",
|
||||
"version": "0.4.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"start": "echo 'To get started, run `npx tsx <path to example>`'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/openai": "^2.0.27",
|
||||
"@ai-sdk/openai": "^2.0.76",
|
||||
"@azure/cosmos": "^4.1.1",
|
||||
"@azure/identity": "^4.4.1",
|
||||
"@azure/search-documents": "^12.1.0",
|
||||
"@llamaindex/anthropic": "^0.3.25",
|
||||
"@llamaindex/assemblyai": "^0.1.21",
|
||||
"@llamaindex/astra": "^0.0.36",
|
||||
"@llamaindex/azure": "^0.1.38",
|
||||
"@llamaindex/azure": "^0.2.0",
|
||||
"@llamaindex/bm25-retriever": "^0.0.11",
|
||||
"@llamaindex/chroma": "^0.0.36",
|
||||
"@llamaindex/clip": "^0.0.77",
|
||||
"llama-cloud-services": "^0.3.5",
|
||||
"@llamaindex/clip": "^0.0.78",
|
||||
"@llamaindex/cohere": "^0.0.36",
|
||||
"@llamaindex/core": "^0.6.22",
|
||||
"@llamaindex/deepinfra": "^0.0.77",
|
||||
"@llamaindex/deepseek": "^0.0.39",
|
||||
"@llamaindex/deepinfra": "^0.0.78",
|
||||
"@llamaindex/deepseek": "^0.0.40",
|
||||
"@llamaindex/discord": "^0.1.21",
|
||||
"@llamaindex/elastic-search": "^0.1.22",
|
||||
"@llamaindex/env": "^0.1.30",
|
||||
"@llamaindex/firestore": "^1.0.29",
|
||||
"@llamaindex/fireworks": "^0.0.37",
|
||||
"@llamaindex/google": "^0.3.22",
|
||||
"@llamaindex/groq": "^0.0.93",
|
||||
"@llamaindex/huggingface": "^0.1.31",
|
||||
"@llamaindex/jinaai": "^0.0.37",
|
||||
"@llamaindex/fireworks": "^0.0.38",
|
||||
"@llamaindex/google": "^0.4.0",
|
||||
"@llamaindex/groq": "^0.0.94",
|
||||
"@llamaindex/huggingface": "^0.1.32",
|
||||
"@llamaindex/jinaai": "^0.0.38",
|
||||
"@llamaindex/milvus": "^0.1.31",
|
||||
"@llamaindex/mistral": "^0.1.22",
|
||||
"@llamaindex/mixedbread": "^0.0.36",
|
||||
"@llamaindex/mongodb": "^0.0.37",
|
||||
"@llamaindex/mongodb": "^0.1.0",
|
||||
"@llamaindex/node-parser": "^2.0.22",
|
||||
"@llamaindex/notion": "^0.1.21",
|
||||
"@llamaindex/ollama": "^0.1.23",
|
||||
"@llamaindex/openai": "^0.4.21",
|
||||
"@llamaindex/perplexity": "^0.0.34",
|
||||
"@llamaindex/openai": "^0.4.22",
|
||||
"@llamaindex/ovhcloud": "^1.0.0",
|
||||
"@llamaindex/perplexity": "^0.0.35",
|
||||
"@llamaindex/pinecone": "^0.1.22",
|
||||
"@llamaindex/portkey-ai": "^0.0.64",
|
||||
"@llamaindex/postgres": "^0.0.65",
|
||||
@@ -48,25 +48,26 @@
|
||||
"@llamaindex/readers": "^3.1.21",
|
||||
"@llamaindex/replicate": "^0.0.64",
|
||||
"@llamaindex/supabase": "^0.1.23",
|
||||
"@llamaindex/together": "^0.0.37",
|
||||
"@llamaindex/tools": "^0.1.12",
|
||||
"@llamaindex/together": "^0.0.38",
|
||||
"@llamaindex/tools": "^0.2.0",
|
||||
"@llamaindex/upstash": "^0.0.36",
|
||||
"@llamaindex/vercel": "^0.1.22",
|
||||
"@llamaindex/vllm": "^0.0.63",
|
||||
"@llamaindex/vercel": "^0.1.23",
|
||||
"@llamaindex/vllm": "^0.0.64",
|
||||
"@llamaindex/voyage-ai": "^1.0.28",
|
||||
"@llamaindex/weaviate": "^0.0.37",
|
||||
"@llamaindex/workflow": "^1.1.24",
|
||||
"@llamaindex/xai": "^0.0.24",
|
||||
"@llamaindex/xai": "^0.0.25",
|
||||
"@notionhq/client": "^4.0.0",
|
||||
"@pinecone-database/pinecone": "^4.0.0",
|
||||
"@vercel/postgres": "^0.10.0",
|
||||
"ai": "^5.0.39",
|
||||
"ai": "^5.0.106",
|
||||
"ajv": "^8.17.1",
|
||||
"commander": "^12.1.0",
|
||||
"dotenv": "^17.2.0",
|
||||
"js-tiktoken": "^1.0.14",
|
||||
"llamaindex": "^0.12.0",
|
||||
"mongodb": "6.7.0",
|
||||
"llama-cloud-services": "^0.3.5",
|
||||
"llamaindex": "^0.12.1",
|
||||
"mongodb": "6.21.0",
|
||||
"postgres": "^3.4.4",
|
||||
"wikipedia": "^2.1.2",
|
||||
"zod": "^4.1.5"
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
packages:
|
||||
- "**"
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/autotool
|
||||
|
||||
## 9.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3af5617]
|
||||
- llamaindex@0.12.1
|
||||
|
||||
## 9.0.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @llamaindex/autotool-01-node-example
|
||||
|
||||
## 0.0.139
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3af5617]
|
||||
- llamaindex@0.12.1
|
||||
- @llamaindex/autotool@9.0.1
|
||||
|
||||
## 0.0.138
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
"scripts": {
|
||||
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
|
||||
},
|
||||
"version": "0.0.138"
|
||||
"version": "0.0.139"
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"url": "git+https://github.com/run-llama/LlamaIndexTS.git",
|
||||
"directory": "packages/autotool"
|
||||
},
|
||||
"version": "9.0.0",
|
||||
"version": "9.0.1",
|
||||
"description": "auto transpile your JS function to LLM Agent compatible",
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/experimental
|
||||
|
||||
## 0.0.208
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3af5617]
|
||||
- llamaindex@0.12.1
|
||||
|
||||
## 0.0.207
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/experimental",
|
||||
"description": "Experimental package for LlamaIndexTS",
|
||||
"version": "0.0.207",
|
||||
"version": "0.0.208",
|
||||
"type": "module",
|
||||
"types": "dist/type/index.d.ts",
|
||||
"main": "dist/cjs/index.js",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# llamaindex
|
||||
|
||||
## 0.12.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 3af5617: fix undefined values in querytool
|
||||
|
||||
## 0.12.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "llamaindex",
|
||||
"version": "0.12.0",
|
||||
"version": "0.12.1",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"keywords": [
|
||||
|
||||
@@ -54,9 +54,11 @@ export class QueryEngineTool implements BaseTool<QueryEngineParam> {
|
||||
return { content: response.message.content } as unknown as JSONValue;
|
||||
}
|
||||
|
||||
// Use JSON.parse(JSON.stringify()) to remove undefined values from sourceNodes
|
||||
// since undefined is not a valid JSONValue
|
||||
return {
|
||||
content: response.message.content,
|
||||
sourceNodes: response.sourceNodes,
|
||||
sourceNodes: JSON.parse(JSON.stringify(response.sourceNodes ?? [])),
|
||||
} as unknown as JSONValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/core-test
|
||||
|
||||
## 0.1.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.1.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/llamaindex-test",
|
||||
"private": true,
|
||||
"version": "0.1.22",
|
||||
"version": "0.1.23",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "vitest run"
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/clip
|
||||
|
||||
## 0.0.78
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.77
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/clip",
|
||||
"description": "Clip Embedding Adapter for LlamaIndex",
|
||||
"version": "0.0.77",
|
||||
"version": "0.0.78",
|
||||
"type": "module",
|
||||
"types": "dist/index.d.ts",
|
||||
"main": "dist/index.cjs",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/deepinfra
|
||||
|
||||
## 0.0.78
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.77
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/deepinfra",
|
||||
"description": "Deepinfra Adapter for LlamaIndex",
|
||||
"version": "0.0.77",
|
||||
"version": "0.0.78",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/deepseek
|
||||
|
||||
## 0.0.40
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/deepseek",
|
||||
"description": "DeepSeek Adapter for LlamaIndex",
|
||||
"version": "0.0.39",
|
||||
"version": "0.0.40",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/fireworks
|
||||
|
||||
## 0.0.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.37
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/fireworks",
|
||||
"description": "Fireworks Adapter for LlamaIndex",
|
||||
"version": "0.0.37",
|
||||
"version": "0.0.38",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @llamaindex/google
|
||||
|
||||
## 0.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 020928c: respect Gemini's requests-per-minute rate limit with waits
|
||||
|
||||
## 0.3.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/google",
|
||||
"description": "Google Adapter for LlamaIndex",
|
||||
"version": "0.3.22",
|
||||
"version": "0.4.0",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -43,12 +43,59 @@ export class GeminiEmbedding extends BaseEmbedding {
|
||||
this.embedBatchSize = opts?.embedBatchSize ?? DEFAULT_EMBED_BATCH_SIZE;
|
||||
}
|
||||
|
||||
// Add a retry wrapper for embedContent to handle rate limits (5s wait, up to 20 tries)
|
||||
private async embedWithRetry(args: {
|
||||
model: string;
|
||||
contents: string | string[];
|
||||
}) {
|
||||
const MAX_TRIES = 20;
|
||||
const DELAY_MS = 5000;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const isRateLimitError = (err: any) => {
|
||||
if (!err) return false;
|
||||
return (
|
||||
err.status === 429 ||
|
||||
err.message.indexOf('"status":"RESOURCE_EXHAUSTED"') !== -1
|
||||
);
|
||||
};
|
||||
/* error looks like this
|
||||
{"error":{"code":429,"message":"You exceeded your current quota, please check your plan and billing details. For more information on this error, head to: https://ai.google.dev/gemini-api/docs/rate-limits. To monitor your current usage, head to: https://ai.dev/usage?tab=rate-limit. \n* Quota exceeded for metric: generativelanguage.googleapis.com/embed_content_paid_tier_requests, limit: 0","status":"RESOURCE_EXHAUSTED","details":[{"@type":"type.googleapis.com/google.rpc.Help","links":[{"description":"Learn more about Gemini API quotas","url":"https://ai.google.dev/gemini-api/docs/rate-limits"}]},{"@type":"type.googleapis.com/google.rpc.QuotaFailure","violations":[{"quotaMetric":"generativelanguage.googleapis.com/embed_content_paid_tier_requests","quotaId":"EmbedContentPerMinutePerProjectPerUserPerModel-PaidTier"}]}]}}
|
||||
*/
|
||||
|
||||
const sleep = (ms: number) => new Promise((res) => setTimeout(res, ms));
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let lastErr: any = null;
|
||||
for (let attempt = 1; attempt <= MAX_TRIES; attempt++) {
|
||||
try {
|
||||
return await this.ai.models.embedContent(args);
|
||||
} catch (err) {
|
||||
lastErr = err;
|
||||
if (isRateLimitError(err) && attempt < MAX_TRIES) {
|
||||
await sleep(DELAY_MS);
|
||||
console.debug(
|
||||
`Gemini Embeddings rate limit error encountered. Retrying attempt ${attempt}...`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
// If we exit loop unexpectedly, throw the last error.
|
||||
throw lastErr;
|
||||
}
|
||||
|
||||
getTextEmbeddings = async (texts: string[]) => {
|
||||
const result = await this.ai.models.embedContent({
|
||||
const result = await this.embedWithRetry({
|
||||
model: this.model,
|
||||
contents: texts,
|
||||
});
|
||||
return result.embeddings?.map((embedding) => embedding.values ?? []) ?? [];
|
||||
|
||||
return (
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
result.embeddings?.map((embedding: any) => embedding.values ?? []) ?? []
|
||||
);
|
||||
};
|
||||
|
||||
async getTextEmbeddingsBatch(
|
||||
@@ -64,7 +111,7 @@ export class GeminiEmbedding extends BaseEmbedding {
|
||||
}
|
||||
|
||||
async getTextEmbedding(text: string): Promise<number[]> {
|
||||
const result = await this.ai.models.embedContent({
|
||||
const result = await this.embedWithRetry({
|
||||
model: this.model,
|
||||
contents: text,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/groq
|
||||
|
||||
## 0.0.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/groq",
|
||||
"description": "Groq Adapter for LlamaIndex",
|
||||
"version": "0.0.93",
|
||||
"version": "0.0.94",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/huggingface
|
||||
|
||||
## 0.1.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.1.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/huggingface",
|
||||
"description": "Huggingface Adapter for LlamaIndex",
|
||||
"version": "0.1.31",
|
||||
"version": "0.1.32",
|
||||
"type": "module",
|
||||
"types": "dist/index.d.ts",
|
||||
"main": "dist/index.cjs",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/jinaai
|
||||
|
||||
## 0.0.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.37
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/jinaai",
|
||||
"description": "JinaAI Adapter for LlamaIndex",
|
||||
"version": "0.0.37",
|
||||
"version": "0.0.38",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @llamaindex/openai
|
||||
|
||||
## 0.4.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 76709c2: fix: first tool call chunk without arguments
|
||||
|
||||
## 0.4.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/openai",
|
||||
"description": "OpenAI Adapter for LlamaIndex",
|
||||
"version": "0.4.21",
|
||||
"version": "0.4.22",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -415,12 +415,16 @@ export class OpenAI extends ToolCallLLM<OpenAIAdditionalChatOptions> {
|
||||
toolCallMap.set(choice.delta.tool_calls[0].id, currentToolCall);
|
||||
} else {
|
||||
if (choice.delta.tool_calls?.[0]!.function?.arguments) {
|
||||
if (typeof currentToolCall!.input !== "string") {
|
||||
currentToolCall!.input = "";
|
||||
}
|
||||
currentToolCall!.input +=
|
||||
choice.delta.tool_calls[0].function.arguments;
|
||||
}
|
||||
}
|
||||
|
||||
const isDone: boolean = choice.finish_reason !== null;
|
||||
const isDone: boolean =
|
||||
choice.finish_reason !== null && choice.finish_reason !== undefined;
|
||||
|
||||
if (isDone && currentToolCall) {
|
||||
// for the last one, we need to emit the tool call
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# @llamaindex/ovhcloud
|
||||
|
||||
## 1.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- 09ba5aa: Add OVHcloud AI Endpoints provider
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Initial release of OVHcloud AI Endpoints provider
|
||||
@@ -0,0 +1,130 @@
|
||||
# CLAUDE.md - OVHcloud AI Endpoints Provider Package
|
||||
|
||||
This package provides LLM and embedding integrations for OVHcloud AI Endpoints in LlamaIndex.TS.
|
||||
|
||||
## Package Overview
|
||||
|
||||
The `@llamaindex/ovhcloud` package offers two main components:
|
||||
|
||||
1. **OVHcloudLLM** - OpenAI-compatible chat model interface using OVHcloud's hosted models
|
||||
2. **OVHcloudEmbedding** - OpenAI-compatible embedding API integration for text embeddings
|
||||
|
||||
## Architecture
|
||||
|
||||
### LLM Integration (src/llm.ts)
|
||||
|
||||
The `OVHcloudLLM` class extends the OpenAI class from `@llamaindex/openai`, leveraging OVHcloud's OpenAI-compatible API:
|
||||
|
||||
- **Base URL**: `https://oai.endpoints.kepler.ai.cloud.ovh.net/v1`
|
||||
- **Default Model**: `gpt-oss-120b`
|
||||
- **Authentication**: Optional - can use free tier with rate limits (empty API key) or with `OVHCLOUD_API_KEY` environment variable
|
||||
- **Implementation**: Wrapper around OpenAI class with OVHcloud-specific defaults
|
||||
|
||||
### Embedding Integration (src/embedding.ts)
|
||||
|
||||
The `OVHcloudEmbedding` class extends the `OpenAIEmbedding` class:
|
||||
|
||||
- **Base URL**: `https://oai.endpoints.kepler.ai.cloud.ovh.net/v1`
|
||||
- **Default Model**: `BGE-M3`
|
||||
- **Authentication**: Optional - can use free tier with rate limits (empty API key) or with `OVHCLOUD_API_KEY` environment variable
|
||||
- **Implementation**: Wrapper around OpenAIEmbedding class with OVHcloud-specific defaults
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
- `OVHCLOUD_API_KEY` - Optional API key. If not provided or empty, uses free tier with rate limits
|
||||
|
||||
### LLM Configuration
|
||||
|
||||
```typescript
|
||||
import { OVHcloudLLM } from "@llamaindex/ovhcloud";
|
||||
|
||||
// Free tier (no API key required)
|
||||
const llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b", // optional
|
||||
// apiKey omitted or empty string for free tier
|
||||
});
|
||||
|
||||
// With API key
|
||||
const llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b", // optional
|
||||
apiKey: "your-api-key", // optional if OVHCLOUD_API_KEY is set
|
||||
// ... other OpenAI-compatible options
|
||||
});
|
||||
```
|
||||
|
||||
### Embedding Configuration
|
||||
|
||||
```typescript
|
||||
import { OVHcloudEmbedding } from "@llamaindex/ovhcloud";
|
||||
|
||||
// Free tier (no API key required)
|
||||
const embedding = new OVHcloudEmbedding({
|
||||
model: "BGE-M3", // optional
|
||||
// apiKey omitted or empty string for free tier
|
||||
});
|
||||
|
||||
// With API key
|
||||
const embedding = new OVHcloudEmbedding({
|
||||
model: "BGE-M3", // optional
|
||||
apiKey: "your-api-key", // optional if OVHCLOUD_API_KEY is set
|
||||
// ... other OpenAI-compatible options
|
||||
});
|
||||
```
|
||||
|
||||
## Key Features
|
||||
|
||||
### LLM Features
|
||||
|
||||
- Full OpenAI API compatibility through inheritance
|
||||
- Optional API key management (supports free tier with rate limits)
|
||||
- Support for all OVHcloud hosted models
|
||||
- Default base URL configured for OVHcloud endpoints
|
||||
|
||||
### Embedding Features
|
||||
|
||||
- Full OpenAI API compatibility through inheritance
|
||||
- Optional API key management (supports free tier with rate limits)
|
||||
- Support for OpenAI-compatible embedding models
|
||||
- Default base URL configured for OVHcloud endpoints
|
||||
|
||||
## Free Tier Support
|
||||
|
||||
OVHcloud AI Endpoints can be used for free with rate limits by:
|
||||
|
||||
- Omitting the `apiKey` parameter
|
||||
- Setting `apiKey` to an empty string
|
||||
- Not setting the `OVHCLOUD_API_KEY` environment variable
|
||||
|
||||
For higher rate limits, generate an API key from:
|
||||
|
||||
- OVHcloud Manager: https://ovh.com/manager
|
||||
- Navigate to: Public Cloud → AI & Machine Learning → AI Endpoints → API keys
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `@llamaindex/core` - Core interfaces and utilities
|
||||
- `@llamaindex/env` - Environment variable handling
|
||||
- `@llamaindex/openai` - OpenAI implementation (for both LLM and embedding)
|
||||
|
||||
## Development
|
||||
|
||||
- **Build**: `pnpm build` (uses bunchee)
|
||||
- **Watch**: `pnpm dev` (uses bunchee --watch)
|
||||
- **Test**: `pnpm test` (uses vitest)
|
||||
- **Output**: Dual CJS/ESM exports in `dist/`
|
||||
|
||||
## API Endpoints
|
||||
|
||||
- **Base URL**: `https://oai.endpoints.kepler.ai.cloud.ovh.net/v1`
|
||||
- **Catalog**: https://www.ovhcloud.com/en/public-cloud/ai-endpoints/catalog/
|
||||
- **Documentation**: https://www.ovhcloud.com/en/public-cloud/ai-endpoints/
|
||||
|
||||
## Resources
|
||||
|
||||
- [OVHcloud AI Endpoints Catalog](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/catalog/)
|
||||
- [OVHcloud Manager](https://ovh.com/manager)
|
||||
- [OVHcloud AI Endpoints Documentation](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/)
|
||||
|
||||
This package follows the LlamaIndex.TS provider pattern, implementing standard interfaces while providing OVHcloud-specific configuration and free tier support.
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "@llamaindex/ovhcloud",
|
||||
"description": "OVHcloud AI Endpoints Adapter for LlamaIndex",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": {
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/run-llama/LlamaIndexTS.git",
|
||||
"directory": "packages/providers/ovhcloud"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "bunchee",
|
||||
"dev": "bunchee --watch",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@llamaindex/env": "workspace:*",
|
||||
"@llamaindex/openai": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vitest": "^2.1.5",
|
||||
"@llamaindex/core": "workspace:*",
|
||||
"@llamaindex/env": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@llamaindex/core": "workspace:*",
|
||||
"@llamaindex/env": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { getEnv } from "@llamaindex/env";
|
||||
import { OpenAIEmbedding } from "@llamaindex/openai";
|
||||
import { BASE_URL, ENV_VARIABLE_NAME } from "./utils";
|
||||
|
||||
export class OVHcloudEmbedding extends OpenAIEmbedding {
|
||||
constructor(init?: Omit<Partial<OpenAIEmbedding>, "session">) {
|
||||
const {
|
||||
apiKey = getEnv(ENV_VARIABLE_NAME) ?? "",
|
||||
additionalSessionOptions = {},
|
||||
model = "BGE-M3",
|
||||
...rest
|
||||
} = init ?? {};
|
||||
|
||||
// OVHcloud allows empty API key for free tier with rate limits
|
||||
// So we don't throw an error if apiKey is empty or undefined
|
||||
|
||||
additionalSessionOptions.baseURL =
|
||||
additionalSessionOptions.baseURL ?? BASE_URL;
|
||||
|
||||
super({
|
||||
apiKey: apiKey || "", // Use empty string if not provided
|
||||
additionalSessionOptions,
|
||||
model,
|
||||
...rest,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./embedding";
|
||||
export * from "./llm";
|
||||
@@ -0,0 +1,35 @@
|
||||
import { getEnv } from "@llamaindex/env";
|
||||
import { OpenAI } from "@llamaindex/openai";
|
||||
import { BASE_URL, ENV_VARIABLE_NAME } from "./utils";
|
||||
|
||||
export class OVHcloudLLM extends OpenAI {
|
||||
constructor(init?: Omit<Partial<OpenAI>, "session">) {
|
||||
const {
|
||||
apiKey = getEnv(ENV_VARIABLE_NAME) ?? "",
|
||||
additionalSessionOptions = {},
|
||||
model = "gpt-oss-120b",
|
||||
...rest
|
||||
} = init ?? {};
|
||||
|
||||
// OVHcloud allows empty API key for free tier with rate limits
|
||||
// So we don't throw an error if apiKey is empty or undefined
|
||||
|
||||
additionalSessionOptions.baseURL =
|
||||
additionalSessionOptions.baseURL ?? BASE_URL;
|
||||
|
||||
super({
|
||||
apiKey: apiKey || "", // Use empty string if not provided
|
||||
additionalSessionOptions,
|
||||
model,
|
||||
...rest,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function to create a new OVHcloudLLM instance.
|
||||
* @param init - Optional initialization parameters for the OVHcloudLLM instance.
|
||||
* @returns A new OVHcloudLLM instance.
|
||||
*/
|
||||
export const ovhcloud = (init?: ConstructorParameters<typeof OVHcloudLLM>[0]) =>
|
||||
new OVHcloudLLM(init);
|
||||
@@ -0,0 +1,2 @@
|
||||
export const ENV_VARIABLE_NAME = "OVHCLOUD_API_KEY";
|
||||
export const BASE_URL = "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1";
|
||||
@@ -0,0 +1,145 @@
|
||||
import type { ChatMessage } from "@llamaindex/core/llms";
|
||||
import { setEnvs } from "@llamaindex/env";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { OVHcloudEmbedding, OVHcloudLLM } from "../src/index";
|
||||
import { BASE_URL } from "../src/utils";
|
||||
|
||||
describe("OVHcloudLLM", () => {
|
||||
describe("Initialization", () => {
|
||||
test("should initialize without API key (free tier)", () => {
|
||||
const llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
});
|
||||
expect(llm).toBeInstanceOf(OVHcloudLLM);
|
||||
expect(llm.model).toBe("gpt-oss-120b");
|
||||
});
|
||||
|
||||
test("should initialize with empty API key (free tier)", () => {
|
||||
const llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
apiKey: "",
|
||||
});
|
||||
expect(llm).toBeInstanceOf(OVHcloudLLM);
|
||||
});
|
||||
|
||||
test("should initialize with API key from environment", () => {
|
||||
setEnvs({
|
||||
OVHCLOUD_API_KEY: "test-api-key",
|
||||
});
|
||||
const llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
});
|
||||
expect(llm).toBeInstanceOf(OVHcloudLLM);
|
||||
});
|
||||
|
||||
test("should initialize with explicit API key", () => {
|
||||
const llm = new OVHcloudLLM({
|
||||
model: "gpt-oss-120b",
|
||||
apiKey: "explicit-api-key",
|
||||
});
|
||||
expect(llm).toBeInstanceOf(OVHcloudLLM);
|
||||
});
|
||||
|
||||
test("should use default model if not specified", () => {
|
||||
const llm = new OVHcloudLLM();
|
||||
expect(llm.model).toBe("gpt-oss-120b");
|
||||
});
|
||||
|
||||
test("should use custom base URL if provided", () => {
|
||||
const customBaseURL = "https://custom.endpoint.com/v1";
|
||||
const llm = new OVHcloudLLM({
|
||||
additionalSessionOptions: {
|
||||
baseURL: customBaseURL,
|
||||
},
|
||||
});
|
||||
expect(llm.additionalSessionOptions?.baseURL).toBe(customBaseURL);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Base URL Configuration", () => {
|
||||
test("should use default OVHcloud base URL", () => {
|
||||
const llm = new OVHcloudLLM();
|
||||
expect(llm.additionalSessionOptions?.baseURL).toBe(BASE_URL);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Message Formatting", () => {
|
||||
test("should format basic messages correctly", () => {
|
||||
const llm = new OVHcloudLLM();
|
||||
const inputMessages: ChatMessage[] = [
|
||||
{
|
||||
content: "You are a helpful assistant.",
|
||||
role: "system",
|
||||
},
|
||||
{
|
||||
content: "Hello?",
|
||||
role: "user",
|
||||
},
|
||||
];
|
||||
|
||||
// OVHcloudLLM extends OpenAI, so it uses OpenAI's message formatting
|
||||
// We just verify the instance is created correctly
|
||||
expect(llm).toBeInstanceOf(OVHcloudLLM);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("OVHcloudEmbedding", () => {
|
||||
describe("Initialization", () => {
|
||||
test("should initialize without API key (free tier)", () => {
|
||||
const embedding = new OVHcloudEmbedding({
|
||||
model: "BGE-M3",
|
||||
});
|
||||
expect(embedding).toBeInstanceOf(OVHcloudEmbedding);
|
||||
expect(embedding.model).toBe("BGE-M3");
|
||||
});
|
||||
|
||||
test("should initialize with empty API key (free tier)", () => {
|
||||
const embedding = new OVHcloudEmbedding({
|
||||
model: "BGE-M3",
|
||||
apiKey: "",
|
||||
});
|
||||
expect(embedding).toBeInstanceOf(OVHcloudEmbedding);
|
||||
});
|
||||
|
||||
test("should initialize with API key from environment", () => {
|
||||
setEnvs({
|
||||
OVHCLOUD_API_KEY: "test-api-key",
|
||||
});
|
||||
const embedding = new OVHcloudEmbedding({
|
||||
model: "BGE-M3",
|
||||
});
|
||||
expect(embedding).toBeInstanceOf(OVHcloudEmbedding);
|
||||
});
|
||||
|
||||
test("should initialize with explicit API key", () => {
|
||||
const embedding = new OVHcloudEmbedding({
|
||||
model: "BGE-M3",
|
||||
apiKey: "explicit-api-key",
|
||||
});
|
||||
expect(embedding).toBeInstanceOf(OVHcloudEmbedding);
|
||||
});
|
||||
|
||||
test("should use default model if not specified", () => {
|
||||
const embedding = new OVHcloudEmbedding();
|
||||
expect(embedding.model).toBe("BGE-M3");
|
||||
});
|
||||
|
||||
test("should use custom base URL if provided", () => {
|
||||
const customBaseURL = "https://custom.endpoint.com/v1";
|
||||
const embedding = new OVHcloudEmbedding({
|
||||
additionalSessionOptions: {
|
||||
baseURL: customBaseURL,
|
||||
},
|
||||
});
|
||||
expect(embedding.additionalSessionOptions?.baseURL).toBe(customBaseURL);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Base URL Configuration", () => {
|
||||
test("should use default OVHcloud base URL", () => {
|
||||
const embedding = new OVHcloudEmbedding();
|
||||
expect(embedding.additionalSessionOptions?.baseURL).toBe(BASE_URL);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"outDir": "./lib",
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo"
|
||||
},
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../openai/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "../../env/tsconfig.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/perplexity
|
||||
|
||||
## 0.0.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/perplexity",
|
||||
"description": "Perplexity Adapter for LlamaIndex",
|
||||
"version": "0.0.34",
|
||||
"version": "0.0.35",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# @llamaindex/azure
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 91627dc: Update storage providers to append MongoDB client metadata
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.1.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/azure",
|
||||
"description": "Azure Storage for LlamaIndex",
|
||||
"version": "0.1.38",
|
||||
"version": "0.2.0",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
@@ -72,7 +72,7 @@
|
||||
"@azure/identity": "^4.4.1",
|
||||
"@azure/search-documents": "^12.1.0",
|
||||
"@llamaindex/openai": "workspace:*",
|
||||
"mongodb": "^6.7.0",
|
||||
"mongodb": "^6.21.0",
|
||||
"openai": "^4.90.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import type {
|
||||
import { BaseChatStore } from "@llamaindex/core/storage/chat-store";
|
||||
import type { Collection } from "mongodb";
|
||||
import { MongoClient } from "mongodb";
|
||||
import pkg from "../../package.json";
|
||||
|
||||
const DEFAULT_CHAT_DATABASE = "ChatStoreDB";
|
||||
const DEFAULT_CHAT_Collection = "ChatStoreCollection";
|
||||
|
||||
@@ -40,6 +42,10 @@ export class AzureCosmosVCoreChatStore<
|
||||
"MongoClient is required for AzureCosmosVCoreChatStore initialization",
|
||||
);
|
||||
}
|
||||
mongoClient.appendMetadata({
|
||||
name: "LLAMAINDEX_AZURE_COSMOS_VCORE_CHAT_STORE",
|
||||
version: pkg.version,
|
||||
});
|
||||
this.mongoClient = mongoClient;
|
||||
this.dbName = dbName;
|
||||
this.collectionName = collectionName;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { BaseKVStore } from "@llamaindex/core/storage/kv-store";
|
||||
import type { Collection } from "mongodb";
|
||||
import { MongoClient } from "mongodb";
|
||||
import pkg from "../../package.json";
|
||||
const DEFAULT_CHAT_DATABASE = "KVStoreDB";
|
||||
const DEFAULT_CHAT_Collection = "KVStoreCollection";
|
||||
|
||||
@@ -38,6 +39,10 @@ export class AzureCosmosVCoreKVStore extends BaseKVStore {
|
||||
"MongoClient is required for AzureCosmosDBNoSQLVectorStore initialization",
|
||||
);
|
||||
}
|
||||
mongoClient.appendMetadata({
|
||||
name: "LLAMAINDEX_AZURE_COSMOS_VCORE_KV_STORE",
|
||||
version: pkg.version,
|
||||
});
|
||||
this.mongoClient = mongoClient;
|
||||
this.dbName = dbName;
|
||||
this.collectionName = collectionName;
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from "@llamaindex/core/vector-store";
|
||||
import { getEnv } from "@llamaindex/env";
|
||||
import { Collection, Db, MongoClient } from "mongodb";
|
||||
import pkg from "../../package.json";
|
||||
|
||||
/** Azure Cosmos DB for MongoDB vCore Similarity type. */
|
||||
export const AzureCosmosDBMongoDBSimilarityType = {
|
||||
@@ -124,6 +125,10 @@ export class AzureCosmosDBMongoDBVectorStore extends BaseVectorStore {
|
||||
appName: "LLAMAINDEX_JS",
|
||||
});
|
||||
}
|
||||
this.mongodbClient.appendMetadata({
|
||||
name: "LLAMAINDEX_AZURE_COSMOS_VCORE_VECTOR_STORE",
|
||||
version: pkg.version,
|
||||
});
|
||||
|
||||
this.dbName = init.dbName ?? "documentsDB";
|
||||
this.collectionName = init.collectionName ?? "documents";
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @llamaindex/mongodb
|
||||
|
||||
## 0.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 91627dc: Update storage providers to append MongoDB client metadata
|
||||
|
||||
## 0.0.37
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/mongodb",
|
||||
"description": "MongoDB Storage for LlamaIndex",
|
||||
"version": "0.0.37",
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
@@ -49,6 +49,6 @@
|
||||
"@llamaindex/env": "workspace:*"
|
||||
},
|
||||
"dependencies": {
|
||||
"mongodb": "6.7.0"
|
||||
"mongodb": "6.21.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
import { getEnv } from "@llamaindex/env";
|
||||
import type { BulkWriteOptions, Collection } from "mongodb";
|
||||
import { MongoClient } from "mongodb";
|
||||
import pkg from "../package.json";
|
||||
|
||||
// define your Atlas Search index. See detail https://www.mongodb.com/docs/atlas/atlas-search/field-types/knn-vector/
|
||||
const DEFAULT_EMBEDDING_DEFINITION = {
|
||||
@@ -162,6 +163,10 @@ export class MongoDBAtlasVectorSearch extends BaseVectorStore {
|
||||
|
||||
this.dbName = init.dbName ?? "default_db";
|
||||
this.collectionName = init.collectionName ?? "default_collection";
|
||||
this.mongodbClient.appendMetadata({
|
||||
name: "LLAMAINDEX_MONGODB_ATLAS_VECTOR_STORE",
|
||||
version: pkg.version,
|
||||
});
|
||||
this.autoCreateIndex = init.autoCreateIndex ?? true;
|
||||
this.indexedMetadataFields = init.indexedMetadataFields ?? [];
|
||||
this.embeddingDefinition = {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { KVDocumentStore } from "@llamaindex/core/storage/doc-store";
|
||||
import { MongoClient } from "mongodb";
|
||||
import pkg from "../../package.json";
|
||||
import { MongoKVStore } from "../kvStore/MongoKVStore";
|
||||
|
||||
const DEFAULT_DATABASE = "DocumentStoreDB";
|
||||
@@ -36,6 +37,10 @@ export class MongoDocumentStore extends KVDocumentStore {
|
||||
mongoClient,
|
||||
dbName,
|
||||
});
|
||||
mongoClient.appendMetadata({
|
||||
name: "LLAMAINDEX_MONGODB_DOC_STORE",
|
||||
version: pkg.version,
|
||||
});
|
||||
|
||||
return new MongoDocumentStore({
|
||||
mongoKVStore,
|
||||
|
||||
@@ -24,6 +24,9 @@ export class MongoKVStore extends BaseKVStore {
|
||||
|
||||
this.mongoClient = mongoClient;
|
||||
this.dbName = dbName;
|
||||
this.mongoClient.appendMetadata({
|
||||
name: "LLAMAINDEX_MONGODB_KV_STORE",
|
||||
});
|
||||
}
|
||||
|
||||
get client(): MongoClient {
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
import { Document, MetadataMode } from "@llamaindex/core/schema";
|
||||
import { MongoClient } from "mongodb";
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { MongoClient, type DriverInfo } from "mongodb";
|
||||
import {
|
||||
afterAll,
|
||||
beforeAll,
|
||||
beforeEach,
|
||||
describe,
|
||||
expect,
|
||||
it,
|
||||
vi,
|
||||
type MockInstance,
|
||||
} from "vitest";
|
||||
import pkg from "../../package.json";
|
||||
import { MongoDocumentStore } from "../docStore/MongoDBDocumentStore";
|
||||
import { setupTestDb } from "./setuptTestDb";
|
||||
|
||||
@@ -9,11 +19,13 @@ describe("MongoDocumentStore", () => {
|
||||
let mongoClient: MongoClient;
|
||||
let documentStore: MongoDocumentStore;
|
||||
let mongoUri: string;
|
||||
let appendMetadataSpy: MockInstance<(driverInfo: DriverInfo) => void>;
|
||||
|
||||
beforeAll(async () => {
|
||||
const testDb = await setupTestDb();
|
||||
cleanup = testDb.cleanup;
|
||||
mongoClient = testDb.mongoClient;
|
||||
appendMetadataSpy = vi.spyOn(mongoClient, "appendMetadata");
|
||||
mongoUri = testDb.mongoUri;
|
||||
documentStore = MongoDocumentStore.fromMongoClient(mongoClient);
|
||||
}, 120000);
|
||||
@@ -26,6 +38,10 @@ describe("MongoDocumentStore", () => {
|
||||
it("should create instance with mongoClient", () => {
|
||||
const store = MongoDocumentStore.fromMongoClient(mongoClient);
|
||||
expect(store).toBeInstanceOf(MongoDocumentStore);
|
||||
expect(appendMetadataSpy).toHaveBeenCalledWith({
|
||||
name: "LLAMAINDEX_MONGODB_DOC_STORE",
|
||||
version: pkg.version,
|
||||
});
|
||||
});
|
||||
|
||||
it("should create instance with custom namespace", () => {
|
||||
@@ -35,6 +51,10 @@ describe("MongoDocumentStore", () => {
|
||||
"namespace",
|
||||
);
|
||||
expect(store).toBeInstanceOf(MongoDocumentStore);
|
||||
expect(appendMetadataSpy).toHaveBeenCalledWith({
|
||||
name: "LLAMAINDEX_MONGODB_DOC_STORE",
|
||||
version: pkg.version,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -47,6 +67,10 @@ describe("MongoDocumentStore", () => {
|
||||
it("should create instance from MongoClient", () => {
|
||||
const store = MongoDocumentStore.fromMongoClient(mongoClient);
|
||||
expect(store).toBeInstanceOf(MongoDocumentStore);
|
||||
expect(appendMetadataSpy).toHaveBeenCalledWith({
|
||||
name: "LLAMAINDEX_MONGODB_DOC_STORE",
|
||||
version: pkg.version,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
import type { MongoClient } from "mongodb";
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import type { DriverInfo, MongoClient } from "mongodb";
|
||||
import {
|
||||
afterAll,
|
||||
beforeAll,
|
||||
beforeEach,
|
||||
describe,
|
||||
expect,
|
||||
it,
|
||||
vi,
|
||||
type MockInstance,
|
||||
} from "vitest";
|
||||
import { MongoKVStore } from "../kvStore/MongoKVStore";
|
||||
import { setupTestDb } from "./setuptTestDb";
|
||||
|
||||
@@ -8,11 +17,13 @@ describe("MongoKVStore", () => {
|
||||
let mongoClient: MongoClient;
|
||||
let mongoUri: string;
|
||||
let kvStore: MongoKVStore;
|
||||
let appendMetadataSpy: MockInstance<(driverInfo: DriverInfo) => void>;
|
||||
|
||||
beforeAll(async () => {
|
||||
const testDb = await setupTestDb();
|
||||
cleanUp = testDb.cleanup;
|
||||
mongoClient = testDb.mongoClient;
|
||||
appendMetadataSpy = vi.spyOn(mongoClient, "appendMetadata");
|
||||
mongoUri = testDb.mongoUri;
|
||||
kvStore = new MongoKVStore({
|
||||
mongoClient,
|
||||
@@ -32,6 +43,9 @@ describe("MongoKVStore", () => {
|
||||
});
|
||||
|
||||
expect(kvStore).toBeInstanceOf(MongoKVStore);
|
||||
expect(appendMetadataSpy).toHaveBeenCalledWith({
|
||||
name: "LLAMAINDEX_MONGODB_KV_STORE",
|
||||
});
|
||||
});
|
||||
|
||||
it("should create db with custom db and collection name", () => {
|
||||
@@ -41,6 +55,9 @@ describe("MongoKVStore", () => {
|
||||
});
|
||||
|
||||
expect(kvStore).toBeInstanceOf(MongoKVStore);
|
||||
expect(appendMetadataSpy).toHaveBeenCalledWith({
|
||||
name: "LLAMAINDEX_MONGODB_KV_STORE",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"outDir": "./lib",
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo"
|
||||
},
|
||||
"include": ["./src"],
|
||||
"include": ["./src", "package.json"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../core/tsconfig.json"
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/together
|
||||
|
||||
## 0.0.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.37
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/together",
|
||||
"description": "Together Adapter for LlamaIndex",
|
||||
"version": "0.0.37",
|
||||
"version": "0.0.38",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @llamaindex/vercel
|
||||
|
||||
## 0.1.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- fed32ab: Update vercel/ai
|
||||
|
||||
## 0.1.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/vercel",
|
||||
"description": "Vercel Adapter for LlamaIndex",
|
||||
"version": "0.1.22",
|
||||
"version": "0.1.23",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
@@ -40,7 +40,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@llamaindex/core": "workspace:*",
|
||||
"ai": "^5.0.39",
|
||||
"ai": "^5.0.106",
|
||||
"vitest": "^2.1.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/vllm
|
||||
|
||||
## 0.0.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.63
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/vllm",
|
||||
"description": "vLLM Adapter for LlamaIndex",
|
||||
"version": "0.0.63",
|
||||
"version": "0.0.64",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @llamaindex/xai
|
||||
|
||||
## 0.0.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [76709c2]
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.0.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/xai",
|
||||
"description": "XAI Adapter for LlamaIndex",
|
||||
"version": "0.0.24",
|
||||
"version": "0.0.25",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @llamaindex/tools
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 91627dc: Update storage providers to append MongoDB client metadata
|
||||
|
||||
## 0.1.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/tools",
|
||||
"description": "LlamaIndex Tools",
|
||||
"version": "0.1.12",
|
||||
"version": "0.2.0",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { wiki } from "../src/tools/wiki";
|
||||
|
||||
describe("Wikipedia Tool", () => {
|
||||
test("wiki tool returns content for valid query", async () => {
|
||||
const wikipediaTool = wiki();
|
||||
const result = await wikipediaTool.call({
|
||||
query: "Albert Einstein",
|
||||
lang: "en",
|
||||
});
|
||||
|
||||
expect(result).toHaveProperty("title");
|
||||
expect(result).toHaveProperty("content");
|
||||
});
|
||||
});
|
||||
Generated
+776
-705
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,14 @@
|
||||
# @llamaindex/unit-test
|
||||
|
||||
## 0.1.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3af5617]
|
||||
- Updated dependencies [76709c2]
|
||||
- llamaindex@0.12.1
|
||||
- @llamaindex/openai@0.4.22
|
||||
|
||||
## 0.1.63
|
||||
|
||||
### Patch Changes
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@llamaindex/unit-test",
|
||||
"private": true,
|
||||
"version": "0.1.63",
|
||||
"version": "0.1.64",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "vitest run"
|
||||
|
||||
Reference in New Issue
Block a user