diff --git a/.changeset/serious-hounds-travel.md b/.changeset/serious-hounds-travel.md new file mode 100644 index 0000000000000000000000000000000000000000..7f43201ee09a430b1b16226278de773bf81b9df8 --- /dev/null +++ b/.changeset/serious-hounds-travel.md @@ -0,0 +1,5 @@ +--- +"llamaindex": patch +--- + +Llama 3 support diff --git a/.eslintrc.cjs b/.eslintrc.cjs index c7a09db8f097d5091ac36f0f4d6341fdc7574e68..cf3a05699870b8191cc3fab107474e41085e0515 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -72,5 +72,5 @@ module.exports = { }, }, ], - ignorePatterns: ["dist/", "lib/"], + ignorePatterns: ["dist/", "lib/", "deps/"], }; diff --git a/.npmrc b/.npmrc index 5dc4d03908f43e1ba7168540bf7ca8fbbe0eb45b..b151845bf3bba5af548b9196680a3fa4039ccb19 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,3 @@ auto-install-peers = true enable-pre-post-scripts = true +prefer-workspace-packages: true diff --git a/examples/gptturbollama3.ts b/examples/gptturbollama3.ts new file mode 100644 index 0000000000000000000000000000000000000000..95209cb7c2444941377f8c97427144b806257db6 --- /dev/null +++ b/examples/gptturbollama3.ts @@ -0,0 +1,40 @@ +import { stdin as input, stdout as output } from "node:process"; +import readline from "node:readline/promises"; + +import { ChatMessage, OpenAI, ReplicateLLM } from "llamaindex"; + +(async () => { + const gpt4 = new OpenAI({ model: "gpt-4-turbo", temperature: 0.9 }); + const l3 = new ReplicateLLM({ + model: "llama-3-70b-instruct", + temperature: 0.9, + }); + + const rl = readline.createInterface({ input, output }); + const start = await rl.question("Start: "); + const history: ChatMessage[] = [ + { + content: + "Prefer shorter answers. Keep your response to 100 words or less.", + role: "system", + }, + { content: start, role: "user" }, + ]; + + while (true) { + const next = history.length % 2 === 1 ? gpt4 : l3; + const r = await next.chat({ + messages: history.map(({ content, role }) => ({ + content, + role: next === l3 ? role : role === "user" ? "assistant" : "user", + })), + }); + history.push({ + content: r.message.content, + role: next === l3 ? "assistant" : "user", + }); + await rl.question( + (next === l3 ? "Llama 3: " : "GPT 4 Turbo: ") + r.message.content, + ); + } +})(); diff --git a/examples/llama3.ts b/examples/llama3.ts new file mode 100644 index 0000000000000000000000000000000000000000..f17a6c2d6e7938a99e3259cbeb4c2c5014cba732 --- /dev/null +++ b/examples/llama3.ts @@ -0,0 +1,9 @@ +import { ReplicateLLM } from "llamaindex"; + +(async () => { + const tres = new ReplicateLLM({ model: "llama-3-70b-instruct" }); + const result = await tres.chat({ + messages: [{ content: "Hello, world!", role: "user" }], + }); + console.log(result); +})(); diff --git a/examples/package.json b/examples/package.json index bfaae4752ba52db701308a2010d0d10d16da3731..eb4dd3a1a4edb4a301d91136b9d49a13297b262e 100644 --- a/examples/package.json +++ b/examples/package.json @@ -7,11 +7,11 @@ "@datastax/astra-db-ts": "^1.0.1", "@notionhq/client": "^2.2.15", "@pinecone-database/pinecone": "^1.1.3", - "@zilliz/milvus2-sdk-node": "^2.3.5", + "@zilliz/milvus2-sdk-node": "^2.4.1", "chromadb": "^1.8.1", "commander": "^11.1.0", "dotenv": "^16.4.5", - "js-tiktoken": "^1.0.10", + "js-tiktoken": "^1.0.11", "llamaindex": "latest", "mongodb": "^6.5.0", "pathe": "^1.1.2" diff --git a/packages/core/package.json b/packages/core/package.json index b0172f899501b88a9fa096633d47eb00b588f396..3ec4a479877ed627f39fc7376d3c2ee631f1139c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -5,7 +5,7 @@ "license": "MIT", "type": "module", "dependencies": { - "@anthropic-ai/sdk": "^0.20.4", + "@anthropic-ai/sdk": "^0.20.6", "@aws-crypto/sha256-js": "^5.2.0", "@datastax/astra-db-ts": "^1.0.1", "@grpc/grpc-js": "^1.10.6", @@ -19,20 +19,20 @@ "@types/node": "^20.12.7", "@types/papaparse": "^5.3.14", "@types/pg": "^8.11.5", - "@xenova/transformers": "^2.16.1", - "@zilliz/milvus2-sdk-node": "^2.3.5", + "@xenova/transformers": "^2.17.1", + "@zilliz/milvus2-sdk-node": "^2.4.1", "ajv": "^8.12.0", - "assemblyai": "^4.3.4", + "assemblyai": "^4.4.1", "chromadb": "~1.7.3", - "cohere-ai": "^7.9.3", - "js-tiktoken": "^1.0.10", + "cohere-ai": "^7.9.5", + "js-tiktoken": "^1.0.11", "lodash": "^4.17.21", "magic-bytes.js": "^1.10.0", "mammoth": "^1.7.1", "md-utils-ts": "^2.0.0", "mongodb": "^6.5.0", "notion-md-crawler": "^0.0.2", - "openai": "^4.33.0", + "openai": "^4.38.0", "papaparse": "^5.4.1", "pathe": "^1.1.2", "pdf2json": "^3.0.5", @@ -40,14 +40,13 @@ "pgvector": "^0.1.8", "portkey-ai": "^0.1.16", "rake-modified": "^1.0.8", - "replicate": "^0.25.2", "string-strip-html": "^13.4.8", "wikipedia": "^2.1.2", "wink-nlp": "^1.14.3" }, "devDependencies": { "@swc/cli": "^0.3.12", - "@swc/core": "^1.4.13", + "@swc/core": "^1.4.16", "concurrently": "^8.2.2", "glob": "^10.3.12", "madge": "^6.1.0", diff --git a/packages/core/src/internal/deps/replicate.d.ts b/packages/core/src/internal/deps/replicate.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8015079d0662a191522985257e105a86379e7b07 --- /dev/null +++ b/packages/core/src/internal/deps/replicate.d.ts @@ -0,0 +1,305 @@ +type Status = "starting" | "processing" | "succeeded" | "failed" | "canceled"; +type Visibility = "public" | "private"; +type WebhookEventType = "start" | "output" | "logs" | "completed"; + +export interface ApiError extends Error { + request: Request; + response: Response; +} + +export interface Account { + type: "user" | "organization"; + username: string; + name: string; + github_url?: string; +} + +export interface Collection { + name: string; + slug: string; + description: string; + models?: Model[]; +} + +export interface Deployment { + owner: string; + name: string; + current_release: { + number: number; + model: string; + version: string; + created_at: string; + created_by: Account; + configuration: { + hardware: string; + min_instances: number; + max_instances: number; + }; + }; +} + +export interface Hardware { + sku: string; + name: string; +} + +export interface Model { + url: string; + owner: string; + name: string; + description?: string; + visibility: "public" | "private"; + github_url?: string; + paper_url?: string; + license_url?: string; + run_count: number; + cover_image_url?: string; + default_example?: Prediction; + latest_version?: ModelVersion; +} + +export interface ModelVersion { + id: string; + created_at: string; + cog_version: string; + openapi_schema: object; +} + +export interface Prediction { + id: string; + status: Status; + model: string; + version: string; + input: object; + output?: any; + source: "api" | "web"; + error?: any; + logs?: string; + metrics?: { + predict_time?: number; + }; + webhook?: string; + webhook_events_filter?: WebhookEventType[]; + created_at: string; + started_at?: string; + completed_at?: string; + urls: { + get: string; + cancel: string; + stream?: string; + }; +} + +export type Training = Prediction; + +export interface Page<T> { + previous?: string; + next?: string; + results: T[]; +} + +export interface ServerSentEvent { + event: string; + data: string; + id?: string; + retry?: number; +} + +export interface WebhookSecret { + key: string; +} + +export default class Replicate { + constructor(options?: { + auth?: string; + userAgent?: string; + baseUrl?: string; + fetch?: (input: Request | string, init?: RequestInit) => Promise<Response>; + }); + + auth: string; + userAgent?: string; + baseUrl?: string; + fetch: (input: Request | string, init?: RequestInit) => Promise<Response>; + + run( + identifier: `${string}/${string}` | `${string}/${string}:${string}`, + options: { + input: object; + wait?: { interval?: number }; + webhook?: string; + webhook_events_filter?: WebhookEventType[]; + signal?: AbortSignal; + }, + progress?: (prediction: Prediction) => void, + ): Promise<object>; + + stream( + identifier: `${string}/${string}` | `${string}/${string}:${string}`, + options: { + input: object; + webhook?: string; + webhook_events_filter?: WebhookEventType[]; + signal?: AbortSignal; + }, + ): AsyncGenerator<ServerSentEvent>; + + request( + route: string | URL, + options: { + method?: string; + headers?: object | Headers; + params?: object; + data?: object; + }, + ): Promise<Response>; + + paginate<T>(endpoint: () => Promise<Page<T>>): AsyncGenerator<[T]>; + + wait( + prediction: Prediction, + options?: { + interval?: number; + }, + stop?: (prediction: Prediction) => Promise<boolean>, + ): Promise<Prediction>; + + accounts: { + current(): Promise<Account>; + }; + + collections: { + list(): Promise<Page<Collection>>; + get(collection_slug: string): Promise<Collection>; + }; + + deployments: { + predictions: { + create( + deployment_owner: string, + deployment_name: string, + options: { + input: object; + stream?: boolean; + webhook?: string; + webhook_events_filter?: WebhookEventType[]; + }, + ): Promise<Prediction>; + }; + get(deployment_owner: string, deployment_name: string): Promise<Deployment>; + create(deployment_config: { + name: string; + model: string; + version: string; + hardware: string; + min_instances: number; + max_instances: number; + }): Promise<Deployment>; + update( + deployment_owner: string, + deployment_name: string, + deployment_config: { + version?: string; + hardware?: string; + min_instances?: number; + max_instances?: number; + } & ( + | { version: string } + | { hardware: string } + | { min_instances: number } + | { max_instances: number } + ), + ): Promise<Deployment>; + list(): Promise<Page<Deployment>>; + }; + + hardware: { + list(): Promise<Hardware[]>; + }; + + models: { + get(model_owner: string, model_name: string): Promise<Model>; + list(): Promise<Page<Model>>; + create( + model_owner: string, + model_name: string, + options: { + visibility: Visibility; + hardware: string; + description?: string; + github_url?: string; + paper_url?: string; + license_url?: string; + cover_image_url?: string; + }, + ): Promise<Model>; + versions: { + list(model_owner: string, model_name: string): Promise<ModelVersion[]>; + get( + model_owner: string, + model_name: string, + version_id: string, + ): Promise<ModelVersion>; + }; + }; + + predictions: { + create( + options: { + model?: string; + version?: string; + input: object; + stream?: boolean; + webhook?: string; + webhook_events_filter?: WebhookEventType[]; + } & ({ version: string } | { model: string }), + ): Promise<Prediction>; + get(prediction_id: string): Promise<Prediction>; + cancel(prediction_id: string): Promise<Prediction>; + list(): Promise<Page<Prediction>>; + }; + + trainings: { + create( + model_owner: string, + model_name: string, + version_id: string, + options: { + destination: `${string}/${string}`; + input: object; + webhook?: string; + webhook_events_filter?: WebhookEventType[]; + }, + ): Promise<Training>; + get(training_id: string): Promise<Training>; + cancel(training_id: string): Promise<Training>; + list(): Promise<Page<Training>>; + }; + + webhooks: { + default: { + secret: { + get(): Promise<WebhookSecret>; + }; + }; + }; +} + +export function validateWebhook( + requestData: + | Request + | { + id?: string; + timestamp?: string; + body: string; + secret?: string; + signature?: string; + }, + secret: string, +): Promise<boolean>; + +export function parseProgressFromLogs(logs: Prediction | string): { + percentage: number; + current: number; + total: number; +} | null; diff --git a/packages/core/src/internal/deps/replicate.js b/packages/core/src/internal/deps/replicate.js new file mode 100644 index 0000000000000000000000000000000000000000..1237cca97b81516ee834bd4a9e83ab91b398c945 --- /dev/null +++ b/packages/core/src/internal/deps/replicate.js @@ -0,0 +1,1616 @@ +// generate from "tsup ./index.js --format esm" +var __defProp = Object.defineProperty; +var __defProps = Object.defineProperties; +var __getOwnPropDescs = Object.getOwnPropertyDescriptors; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getOwnPropSymbols = Object.getOwnPropertySymbols; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __propIsEnum = Object.prototype.propertyIsEnumerable; +var __knownSymbol = (name, symbol) => { + return (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name); +}; +var __defNormalProp = (obj, key, value) => + key in obj + ? __defProp(obj, key, { + enumerable: true, + configurable: true, + writable: true, + value, + }) + : (obj[key] = value); +var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b)) { + if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); + } + return a; +}; +var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); +var __require = /* @__PURE__ */ ((x) => + typeof require !== "undefined" + ? require + : typeof Proxy !== "undefined" + ? new Proxy(x, { + get: (a, b) => (typeof require !== "undefined" ? require : a)[b], + }) + : x)(function (x) { + if (typeof require !== "undefined") return require.apply(this, arguments); + throw Error('Dynamic require of "' + x + '" is not supported'); +}); +var __objRest = (source, exclude) => { + var target = {}; + for (var prop in source) + if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) + target[prop] = source[prop]; + if (source != null && __getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(source)) { + if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) + target[prop] = source[prop]; + } + return target; +}; +var __commonJS = (cb, mod) => + function __require2() { + return ( + mod || + (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), + mod.exports + ); + }; +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => + x.done + ? resolve(x.value) + : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; +var __await = function (promise, isYieldStar) { + this[0] = promise; + this[1] = isYieldStar; +}; +var __asyncGenerator = (__this, __arguments, generator) => { + var resume = (k, v, yes, no) => { + try { + var x = generator[k](v), + isAwait = (v = x.value) instanceof __await, + done = x.done; + Promise.resolve(isAwait ? v[0] : v) + .then((y) => + isAwait + ? resume( + k === "return" ? k : "next", + v[1] ? { done: y.done, value: y.value } : y, + yes, + no, + ) + : yes({ value: y, done }), + ) + .catch((e) => resume("throw", e, yes, no)); + } catch (e) { + no(e); + } + }; + var method = (k) => + (it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no))); + var it = {}; + return ( + (generator = generator.apply(__this, __arguments)), + (it[__knownSymbol("asyncIterator")] = () => it), + method("next"), + method("throw"), + method("return"), + it + ); +}; +var __yieldStar = (value) => { + var obj = value[__knownSymbol("asyncIterator")]; + var isAwait = false; + var method; + var it = {}; + if (obj == null) { + obj = value[__knownSymbol("iterator")](); + method = (k) => (it[k] = (x) => obj[k](x)); + } else { + obj = obj.call(value); + method = (k) => + (it[k] = (v) => { + if (isAwait) { + isAwait = false; + if (k === "throw") throw v; + return v; + } + isAwait = true; + return { + done: false, + value: new __await( + new Promise((resolve) => { + var x = obj[k](v); + if (!(x instanceof Object)) throw TypeError("Object expected"); + resolve(x); + }), + 1, + ), + }; + }); + } + return ( + (it[__knownSymbol("iterator")] = () => it), + method("next"), + "throw" in obj + ? method("throw") + : (it.throw = (x) => { + throw x; + }), + "return" in obj && method("return"), + it + ); +}; +var __forAwait = (obj, it, method) => + (it = obj[__knownSymbol("asyncIterator")]) + ? it.call(obj) + : ((obj = obj[__knownSymbol("iterator")]()), + (it = {}), + (method = (key, fn) => + (fn = obj[key]) && + (it[key] = (arg) => + new Promise( + (yes, no, done) => ( + (arg = fn.call(obj, arg)), + (done = arg.done), + Promise.resolve(arg.value).then( + (value) => yes({ value, done }), + no, + ) + ), + ))), + method("next"), + method("return"), + it); + +// lib/error.js +var require_error = __commonJS({ + "lib/error.js"(exports, module) { + "use strict"; + var ApiError = class extends Error { + /** + * Creates a representation of an API error. + * + * @param {string} message - Error message + * @param {Request} request - HTTP request + * @param {Response} response - HTTP response + * @returns {ApiError} - An instance of ApiError + */ + constructor(message, request, response) { + super(message); + this.name = "ApiError"; + this.request = request; + this.response = response; + } + }; + module.exports = ApiError; + }, +}); + +// lib/identifier.js +var require_identifier = __commonJS({ + "lib/identifier.js"(exports, module) { + "use strict"; + var ModelVersionIdentifier = class _ModelVersionIdentifier { + /* + * @param {string} Required. The model owner. + * @param {string} Required. The model name. + * @param {string} The model version. + */ + constructor(owner, name, version = null) { + this.owner = owner; + this.name = name; + this.version = version; + } + /* + * Parse a reference to a model version + * + * @param {string} + * @returns {ModelVersionIdentifier} + * @throws {Error} If the reference is invalid. + */ + static parse(ref) { + const match = ref.match( + new RegExp("^(?<owner>[^/]+)\\/(?<name>[^/:]+)(:(?<version>.+))?$"), + ); + if (!match) { + throw new Error( + `Invalid reference to model version: ${ref}. Expected format: owner/name or owner/name:version`, + ); + } + const { owner, name, version } = match.groups; + return new _ModelVersionIdentifier(owner, name, version); + } + }; + module.exports = ModelVersionIdentifier; + }, +}); + +// lib/util.js +var require_util = __commonJS({ + "lib/util.js"(exports, module) { + "use strict"; + var ApiError = require_error(); + function validateWebhook(requestData, secret) { + return __async(this, null, function* () { + let { id, timestamp, body, signature } = requestData; + const signingSecret = secret || requestData.secret; + if (requestData && requestData.headers && requestData.body) { + id = requestData.headers.get("webhook-id"); + timestamp = requestData.headers.get("webhook-timestamp"); + signature = requestData.headers.get("webhook-signature"); + body = requestData.body; + } + if (body instanceof ReadableStream || body.readable) { + try { + body = yield new Response(body).text(); + } catch (err) { + throw new Error(`Error reading body: ${err.message}`); + } + } else if (isTypedArray(body)) { + body = yield new Blob([body]).text(); + } else if (typeof body !== "string") { + throw new Error("Invalid body type"); + } + if (!id || !timestamp || !signature) { + throw new Error("Missing required webhook headers"); + } + if (!body) { + throw new Error("Missing required body"); + } + if (!signingSecret) { + throw new Error("Missing required secret"); + } + const signedContent = `${id}.${timestamp}.${body}`; + const computedSignature = yield createHMACSHA256( + signingSecret.split("_").pop(), + signedContent, + ); + const expectedSignatures = signature + .split(" ") + .map((sig) => sig.split(",")[1]); + return expectedSignatures.some( + (expectedSignature) => expectedSignature === computedSignature, + ); + }); + } + function createHMACSHA256(secret, data) { + return __async(this, null, function* () { + const encoder = new TextEncoder(); + let crypto = globalThis.crypto; + if (typeof crypto === "undefined" && typeof __require === "function") { + crypto = __require("crypto").webcrypto; + } + const key = yield crypto.subtle.importKey( + "raw", + base64ToBytes(secret), + { name: "HMAC", hash: "SHA-256" }, + false, + ["sign"], + ); + const signature = yield crypto.subtle.sign( + "HMAC", + key, + encoder.encode(data), + ); + return bytesToBase64(signature); + }); + } + function base64ToBytes(base64) { + return Uint8Array.from(atob(base64), (m) => m.codePointAt(0)); + } + function bytesToBase64(bytes) { + return btoa(String.fromCharCode.apply(null, new Uint8Array(bytes))); + } + function withAutomaticRetries(_0) { + return __async(this, arguments, function* (request, options = {}) { + const shouldRetry = options.shouldRetry || (() => false); + const maxRetries = options.maxRetries || 5; + const interval = options.interval || 500; + const jitter = options.jitter || 100; + const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); + let attempts = 0; + do { + let delay = interval * 2 ** attempts + Math.random() * jitter; + try { + const response = yield request(); + if (response.ok || !shouldRetry(response)) { + return response; + } + } catch (error) { + if (error instanceof ApiError) { + const retryAfter = error.response.headers.get("Retry-After"); + if (retryAfter) { + if (!Number.isInteger(retryAfter)) { + const date = new Date(retryAfter); + if (!Number.isNaN(date.getTime())) { + delay = + date.getTime() - /* @__PURE__ */ new Date().getTime(); + } + } else { + delay = retryAfter * 1e3; + } + } + } + } + if (Number.isInteger(maxRetries) && maxRetries > 0) { + if (Number.isInteger(delay) && delay > 0) { + yield sleep(interval * 2 ** (options.maxRetries - maxRetries)); + } + attempts += 1; + } + } while (attempts < maxRetries); + return request(); + }); + } + var MAX_DATA_URI_SIZE = 1e7; + function transformFileInputs(inputs) { + return __async(this, null, function* () { + let totalBytes = 0; + const result = yield transform(inputs, (value) => + __async(this, null, function* () { + let buffer; + let mime; + if (value instanceof Blob) { + buffer = yield value.arrayBuffer(); + mime = value.type; + } else if (isTypedArray(value)) { + buffer = value; + } else { + return value; + } + totalBytes += buffer.byteLength; + if (totalBytes > MAX_DATA_URI_SIZE) { + throw new Error( + `Combined filesize of prediction ${totalBytes} bytes exceeds 10mb limit for inline encoding, please provide URLs instead`, + ); + } + const data = bytesToBase64(buffer); + mime = mime != null ? mime : "application/octet-stream"; + return `data:${mime};base64,${data}`; + }), + ); + return result; + }); + } + function transform(value, mapper) { + return __async(this, null, function* () { + if (Array.isArray(value)) { + let copy = []; + for (const val of value) { + copy = yield transform(val, mapper); + } + return copy; + } + if (isPlainObject(value)) { + const copy = {}; + for (const key of Object.keys(value)) { + copy[key] = yield transform(value[key], mapper); + } + return copy; + } + return yield mapper(value); + }); + } + function isTypedArray(arr) { + return ( + arr instanceof Int8Array || + arr instanceof Int16Array || + arr instanceof Int32Array || + arr instanceof Uint8Array || + arr instanceof Uint8ClampedArray || + arr instanceof Uint16Array || + arr instanceof Uint32Array || + arr instanceof Float32Array || + arr instanceof Float64Array + ); + } + function isPlainObject(value) { + const isObjectLike = typeof value === "object" && value !== null; + if (!isObjectLike || String(value) !== "[object Object]") { + return false; + } + const proto = Object.getPrototypeOf(value); + if (proto === null) { + return true; + } + const Ctor = + Object.prototype.hasOwnProperty.call(proto, "constructor") && + proto.constructor; + return ( + typeof Ctor === "function" && + Ctor instanceof Ctor && + Function.prototype.toString.call(Ctor) === + Function.prototype.toString.call(Object) + ); + } + function parseProgressFromLogs(input) { + const logs = typeof input === "object" && input.logs ? input.logs : input; + if (!logs || typeof logs !== "string") { + return null; + } + const pattern = /^\s*(\d+)%\s*\|.+?\|\s*(\d+)\/(\d+)/; + const lines = logs.split("\n").reverse(); + for (const line of lines) { + const matches = line.match(pattern); + if (matches && matches.length === 4) { + return { + percentage: parseInt(matches[1], 10) / 100, + current: parseInt(matches[2], 10), + total: parseInt(matches[3], 10), + }; + } + } + return null; + } + function streamAsyncIterator(stream) { + return __asyncGenerator(this, null, function* () { + const reader = stream.getReader(); + try { + while (true) { + const { done, value } = yield new __await(reader.read()); + if (done) return; + yield value; + } + } finally { + reader.releaseLock(); + } + }); + } + module.exports = { + transformFileInputs, + validateWebhook, + withAutomaticRetries, + parseProgressFromLogs, + streamAsyncIterator, + }; + }, +}); + +// vendor/eventsource-parser/stream.js +var require_stream = __commonJS({ + "vendor/eventsource-parser/stream.js"(exports, module) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __export = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps = (to, from, except, desc) => { + if ((from && typeof from === "object") || typeof from === "function") { + for (const key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { + get: () => from[key], + enumerable: + !(desc = __getOwnPropDesc(from, key)) || desc.enumerable, + }); + } + return to; + }; + var __toCommonJS = (mod) => + __copyProps(__defProp2({}, "__esModule", { value: true }), mod); + var input_exports = {}; + __export(input_exports, { + EventSourceParserStream: () => EventSourceParserStream, + }); + module.exports = __toCommonJS(input_exports); + function createParser(onParse) { + let isFirstChunk; + let buffer; + let startingPosition; + let startingFieldLength; + let eventId; + let eventName; + let data; + reset(); + return { + feed, + reset, + }; + function reset() { + isFirstChunk = true; + buffer = ""; + startingPosition = 0; + startingFieldLength = -1; + eventId = void 0; + eventName = void 0; + data = ""; + } + function feed(chunk) { + buffer = buffer ? buffer + chunk : chunk; + if (isFirstChunk && hasBom(buffer)) { + buffer = buffer.slice(BOM.length); + } + isFirstChunk = false; + const length = buffer.length; + let position = 0; + let discardTrailingNewline = false; + while (position < length) { + if (discardTrailingNewline) { + if (buffer[position] === "\n") { + ++position; + } + discardTrailingNewline = false; + } + let lineLength = -1; + let fieldLength = startingFieldLength; + let character; + for ( + let index = startingPosition; + lineLength < 0 && index < length; + ++index + ) { + character = buffer[index]; + if (character === ":" && fieldLength < 0) { + fieldLength = index - position; + } else if (character === "\r") { + discardTrailingNewline = true; + lineLength = index - position; + } else if (character === "\n") { + lineLength = index - position; + } + } + if (lineLength < 0) { + startingPosition = length - position; + startingFieldLength = fieldLength; + break; + } else { + startingPosition = 0; + startingFieldLength = -1; + } + parseEventStreamLine(buffer, position, fieldLength, lineLength); + position += lineLength + 1; + } + if (position === length) { + buffer = ""; + } else if (position > 0) { + buffer = buffer.slice(position); + } + } + function parseEventStreamLine( + lineBuffer, + index, + fieldLength, + lineLength, + ) { + if (lineLength === 0) { + if (data.length > 0) { + onParse({ + type: "event", + id: eventId, + event: eventName || void 0, + data: data.slice(0, -1), + // remove trailing newline + }); + data = ""; + eventId = void 0; + } + eventName = void 0; + return; + } + const noValue = fieldLength < 0; + const field = lineBuffer.slice( + index, + index + (noValue ? lineLength : fieldLength), + ); + let step = 0; + if (noValue) { + step = lineLength; + } else if (lineBuffer[index + fieldLength + 1] === " ") { + step = fieldLength + 2; + } else { + step = fieldLength + 1; + } + const position = index + step; + const valueLength = lineLength - step; + const value = lineBuffer + .slice(position, position + valueLength) + .toString(); + if (field === "data") { + data += value ? "".concat(value, "\n") : "\n"; + } else if (field === "event") { + eventName = value; + } else if (field === "id" && !value.includes("\0")) { + eventId = value; + } else if (field === "retry") { + const retry = parseInt(value, 10); + if (!Number.isNaN(retry)) { + onParse({ + type: "reconnect-interval", + value: retry, + }); + } + } + } + } + var BOM = [239, 187, 191]; + function hasBom(buffer) { + return BOM.every( + (charCode, index) => buffer.charCodeAt(index) === charCode, + ); + } + var EventSourceParserStream = class extends TransformStream { + constructor() { + let parser; + super({ + start(controller) { + parser = createParser((event) => { + if (event.type === "event") { + controller.enqueue(event); + } + }); + }, + transform(chunk) { + parser.feed(chunk); + }, + }); + } + }; + }, +}); + +// vendor/streams-text-encoding/text-decoder-stream.js +var require_text_decoder_stream = __commonJS({ + "vendor/streams-text-encoding/text-decoder-stream.js"(exports, module) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __export = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps = (to, from, except, desc) => { + if ((from && typeof from === "object") || typeof from === "function") { + for (const key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { + get: () => from[key], + enumerable: + !(desc = __getOwnPropDesc(from, key)) || desc.enumerable, + }); + } + return to; + }; + var __toCommonJS = (mod) => + __copyProps(__defProp2({}, "__esModule", { value: true }), mod); + var input_exports = {}; + __export(input_exports, { + TextDecoderStream: () => TextDecoderStream, + }); + module.exports = __toCommonJS(input_exports); + var decDecoder = Symbol("decDecoder"); + var decTransform = Symbol("decTransform"); + var TextDecodeTransformer = class { + constructor(decoder) { + this.decoder_ = decoder; + } + transform(chunk, controller) { + if (!(chunk instanceof ArrayBuffer || ArrayBuffer.isView(chunk))) { + throw new TypeError("Input data must be a BufferSource"); + } + const text = this.decoder_.decode(chunk, { stream: true }); + if (text.length !== 0) { + controller.enqueue(text); + } + } + flush(controller) { + const text = this.decoder_.decode(); + if (text.length !== 0) { + controller.enqueue(text); + } + } + }; + var TextDecoderStream = class { + constructor(label, options) { + const decoder = new TextDecoder(label || "utf-8", options || {}); + this[decDecoder] = decoder; + this[decTransform] = new TransformStream( + new TextDecodeTransformer(decoder), + ); + } + get encoding() { + return this[decDecoder].encoding; + } + get fatal() { + return this[decDecoder].fatal; + } + get ignoreBOM() { + return this[decDecoder].ignoreBOM; + } + get readable() { + return this[decTransform].readable; + } + get writable() { + return this[decTransform].writable; + } + }; + var encEncoder = Symbol("encEncoder"); + var encTransform = Symbol("encTransform"); + }, +}); + +// lib/stream.js +var require_stream2 = __commonJS({ + "lib/stream.js"(exports, module) { + "use strict"; + var ApiError = require_error(); + var { streamAsyncIterator } = require_util(); + var { EventSourceParserStream } = require_stream(); + var { TextDecoderStream } = + typeof globalThis.TextDecoderStream === "undefined" + ? require_text_decoder_stream() + : globalThis; + var ServerSentEvent = class { + /** + * Create a new server-sent event. + * + * @param {string} event The event name. + * @param {string} data The event data. + * @param {string} id The event ID. + * @param {number} retry The retry time. + */ + constructor(event, data, id, retry) { + this.event = event; + this.data = data; + this.id = id; + this.retry = retry; + } + /** + * Convert the event to a string. + */ + toString() { + if (this.event === "output") { + return this.data; + } + return ""; + } + }; + function createReadableStream({ url, fetch, options = {} }) { + return new ReadableStream({ + start(controller) { + return __async(this, null, function* () { + const init = __spreadProps(__spreadValues({}, options), { + headers: __spreadProps(__spreadValues({}, options.headers), { + Accept: "text/event-stream", + }), + }); + const response = yield fetch(url, init); + if (!response.ok) { + const text = yield response.text(); + const request = new Request(url, init); + controller.error( + new ApiError( + `Request to ${url} failed with status ${response.status}: ${text}`, + request, + response, + ), + ); + } + const stream = response.body + .pipeThrough(new TextDecoderStream()) + .pipeThrough(new EventSourceParserStream()); + try { + for ( + var iter = __forAwait(streamAsyncIterator(stream)), + more, + temp, + error; + (more = !(temp = yield iter.next()).done); + more = false + ) { + const event = temp.value; + if (event.event === "error") { + controller.error(new Error(event.data)); + break; + } + controller.enqueue( + new ServerSentEvent(event.event, event.data, event.id), + ); + if (event.event === "done") { + break; + } + } + } catch (temp) { + error = [temp]; + } finally { + try { + more && (temp = iter.return) && (yield temp.call(iter)); + } finally { + if (error) throw error[0]; + } + } + controller.close(); + }); + }, + }); + } + module.exports = { + createReadableStream, + ServerSentEvent, + }; + }, +}); + +// lib/accounts.js +var require_accounts = __commonJS({ + "lib/accounts.js"(exports, module) { + "use strict"; + function getCurrentAccount() { + return __async(this, null, function* () { + const response = yield this.request("/account", { + method: "GET", + }); + return response.json(); + }); + } + module.exports = { + current: getCurrentAccount, + }; + }, +}); + +// lib/collections.js +var require_collections = __commonJS({ + "lib/collections.js"(exports, module) { + "use strict"; + function getCollection(collection_slug) { + return __async(this, null, function* () { + const response = yield this.request(`/collections/${collection_slug}`, { + method: "GET", + }); + return response.json(); + }); + } + function listCollections() { + return __async(this, null, function* () { + const response = yield this.request("/collections", { + method: "GET", + }); + return response.json(); + }); + } + module.exports = { get: getCollection, list: listCollections }; + }, +}); + +// lib/deployments.js +var require_deployments = __commonJS({ + "lib/deployments.js"(exports, module) { + "use strict"; + var { transformFileInputs } = require_util(); + function createPrediction(deployment_owner, deployment_name, options) { + return __async(this, null, function* () { + const _a = options, + { stream, input } = _a, + data = __objRest(_a, ["stream", "input"]); + if (data.webhook) { + try { + new URL(data.webhook); + } catch (err) { + throw new Error("Invalid webhook URL"); + } + } + const response = yield this.request( + `/deployments/${deployment_owner}/${deployment_name}/predictions`, + { + method: "POST", + data: __spreadProps(__spreadValues({}, data), { + input: yield transformFileInputs(input), + stream, + }), + }, + ); + return response.json(); + }); + } + function getDeployment(deployment_owner, deployment_name) { + return __async(this, null, function* () { + const response = yield this.request( + `/deployments/${deployment_owner}/${deployment_name}`, + { + method: "GET", + }, + ); + return response.json(); + }); + } + function createDeployment(deployment_config) { + return __async(this, null, function* () { + const response = yield this.request("/deployments", { + method: "POST", + data: deployment_config, + }); + return response.json(); + }); + } + function updateDeployment( + deployment_owner, + deployment_name, + deployment_config, + ) { + return __async(this, null, function* () { + const response = yield this.request( + `/deployments/${deployment_owner}/${deployment_name}`, + { + method: "PATCH", + data: deployment_config, + }, + ); + return response.json(); + }); + } + function listDeployments() { + return __async(this, null, function* () { + const response = yield this.request("/deployments", { + method: "GET", + }); + return response.json(); + }); + } + module.exports = { + predictions: { + create: createPrediction, + }, + get: getDeployment, + create: createDeployment, + update: updateDeployment, + list: listDeployments, + }; + }, +}); + +// lib/hardware.js +var require_hardware = __commonJS({ + "lib/hardware.js"(exports, module) { + "use strict"; + function listHardware() { + return __async(this, null, function* () { + const response = yield this.request("/hardware", { + method: "GET", + }); + return response.json(); + }); + } + module.exports = { + list: listHardware, + }; + }, +}); + +// lib/models.js +var require_models = __commonJS({ + "lib/models.js"(exports, module) { + "use strict"; + function getModel(model_owner, model_name) { + return __async(this, null, function* () { + const response = yield this.request( + `/models/${model_owner}/${model_name}`, + { + method: "GET", + }, + ); + return response.json(); + }); + } + function listModelVersions(model_owner, model_name) { + return __async(this, null, function* () { + const response = yield this.request( + `/models/${model_owner}/${model_name}/versions`, + { + method: "GET", + }, + ); + return response.json(); + }); + } + function getModelVersion(model_owner, model_name, version_id) { + return __async(this, null, function* () { + const response = yield this.request( + `/models/${model_owner}/${model_name}/versions/${version_id}`, + { + method: "GET", + }, + ); + return response.json(); + }); + } + function listModels() { + return __async(this, null, function* () { + const response = yield this.request("/models", { + method: "GET", + }); + return response.json(); + }); + } + function createModel(model_owner, model_name, options) { + return __async(this, null, function* () { + const data = __spreadValues( + { owner: model_owner, name: model_name }, + options, + ); + const response = yield this.request("/models", { + method: "POST", + data, + }); + return response.json(); + }); + } + module.exports = { + get: getModel, + list: listModels, + create: createModel, + versions: { list: listModelVersions, get: getModelVersion }, + }; + }, +}); + +// lib/predictions.js +var require_predictions = __commonJS({ + "lib/predictions.js"(exports, module) { + "use strict"; + var { transformFileInputs } = require_util(); + function createPrediction(options) { + return __async(this, null, function* () { + const _a = options, + { model, version, stream, input } = _a, + data = __objRest(_a, ["model", "version", "stream", "input"]); + if (data.webhook) { + try { + new URL(data.webhook); + } catch (err) { + throw new Error("Invalid webhook URL"); + } + } + let response; + if (version) { + response = yield this.request("/predictions", { + method: "POST", + data: __spreadProps(__spreadValues({}, data), { + input: yield transformFileInputs(input), + version, + stream, + }), + }); + } else if (model) { + response = yield this.request(`/models/${model}/predictions`, { + method: "POST", + data: __spreadProps(__spreadValues({}, data), { + input: yield transformFileInputs(input), + stream, + }), + }); + } else { + throw new Error("Either model or version must be specified"); + } + return response.json(); + }); + } + function getPrediction(prediction_id) { + return __async(this, null, function* () { + const response = yield this.request(`/predictions/${prediction_id}`, { + method: "GET", + }); + return response.json(); + }); + } + function cancelPrediction(prediction_id) { + return __async(this, null, function* () { + const response = yield this.request( + `/predictions/${prediction_id}/cancel`, + { + method: "POST", + }, + ); + return response.json(); + }); + } + function listPredictions() { + return __async(this, null, function* () { + const response = yield this.request("/predictions", { + method: "GET", + }); + return response.json(); + }); + } + module.exports = { + create: createPrediction, + get: getPrediction, + cancel: cancelPrediction, + list: listPredictions, + }; + }, +}); + +// lib/trainings.js +var require_trainings = __commonJS({ + "lib/trainings.js"(exports, module) { + "use strict"; + function createTraining(model_owner, model_name, version_id, options) { + return __async(this, null, function* () { + const data = __objRest(options, []); + if (data.webhook) { + try { + new URL(data.webhook); + } catch (err) { + throw new Error("Invalid webhook URL"); + } + } + const response = yield this.request( + `/models/${model_owner}/${model_name}/versions/${version_id}/trainings`, + { + method: "POST", + data, + }, + ); + return response.json(); + }); + } + function getTraining(training_id) { + return __async(this, null, function* () { + const response = yield this.request(`/trainings/${training_id}`, { + method: "GET", + }); + return response.json(); + }); + } + function cancelTraining(training_id) { + return __async(this, null, function* () { + const response = yield this.request( + `/trainings/${training_id}/cancel`, + { + method: "POST", + }, + ); + return response.json(); + }); + } + function listTrainings() { + return __async(this, null, function* () { + const response = yield this.request("/trainings", { + method: "GET", + }); + return response.json(); + }); + } + module.exports = { + create: createTraining, + get: getTraining, + cancel: cancelTraining, + list: listTrainings, + }; + }, +}); + +// lib/webhooks.js +var require_webhooks = __commonJS({ + "lib/webhooks.js"(exports, module) { + "use strict"; + function getDefaultWebhookSecret() { + return __async(this, null, function* () { + const response = yield this.request("/webhooks/default/secret", { + method: "GET", + }); + return response.json(); + }); + } + module.exports = { + default: { + secret: { + get: getDefaultWebhookSecret, + }, + }, + }; + }, +}); + +// package.json +var require_package = __commonJS({ + "package.json"(exports, module) { + module.exports = { + name: "replicate", + version: "1.0.0", + description: "", + main: "index.js", + scripts: { + build: "tsup ./index.js --format esm", + }, + repository: { + type: "git", + url: "https://github.com/himself65/LlamaIndexTS.git", + }, + private: true, + devDependencies: { + tsup: "^8.0.2", + }, + }; + }, +}); + +// index.js +var require_replicate = __commonJS({ + "index.js"(exports, module) { + var ApiError = require_error(); + var ModelVersionIdentifier = require_identifier(); + var { createReadableStream } = require_stream2(); + var { + withAutomaticRetries, + validateWebhook, + parseProgressFromLogs, + streamAsyncIterator, + } = require_util(); + var accounts = require_accounts(); + var collections = require_collections(); + var deployments = require_deployments(); + var hardware = require_hardware(); + var models = require_models(); + var predictions = require_predictions(); + var trainings = require_trainings(); + var webhooks = require_webhooks(); + var packageJSON = require_package(); + var Replicate = class { + /** + * Create a new Replicate API client instance. + * + * @param {object} options - Configuration options for the client + * @param {string} options.auth - API access token. Defaults to the `REPLICATE_API_TOKEN` environment variable. + * @param {string} options.userAgent - Identifier of your app + * @param {string} [options.baseUrl] - Defaults to https://api.replicate.com/v1 + * @param {Function} [options.fetch] - Fetch function to use. Defaults to `globalThis.fetch` + */ + constructor(options = {}) { + this.auth = + options.auth || + (typeof process !== "undefined" + ? process.env.REPLICATE_API_TOKEN + : null); + this.userAgent = + options.userAgent || `replicate-javascript/${packageJSON.version}`; + this.baseUrl = options.baseUrl || "https://api.replicate.com/v1"; + this.fetch = options.fetch || globalThis.fetch; + this.accounts = { + current: accounts.current.bind(this), + }; + this.collections = { + list: collections.list.bind(this), + get: collections.get.bind(this), + }; + this.deployments = { + get: deployments.get.bind(this), + create: deployments.create.bind(this), + update: deployments.update.bind(this), + list: deployments.list.bind(this), + predictions: { + create: deployments.predictions.create.bind(this), + }, + }; + this.hardware = { + list: hardware.list.bind(this), + }; + this.models = { + get: models.get.bind(this), + list: models.list.bind(this), + create: models.create.bind(this), + versions: { + list: models.versions.list.bind(this), + get: models.versions.get.bind(this), + }, + }; + this.predictions = { + create: predictions.create.bind(this), + get: predictions.get.bind(this), + cancel: predictions.cancel.bind(this), + list: predictions.list.bind(this), + }; + this.trainings = { + create: trainings.create.bind(this), + get: trainings.get.bind(this), + cancel: trainings.cancel.bind(this), + list: trainings.list.bind(this), + }; + this.webhooks = { + default: { + secret: { + get: webhooks.default.secret.get.bind(this), + }, + }, + }; + } + /** + * Run a model and wait for its output. + * + * @param {string} ref - Required. The model version identifier in the format "owner/name" or "owner/name:version" + * @param {object} options + * @param {object} options.input - Required. An object with the model inputs + * @param {object} [options.wait] - Options for waiting for the prediction to finish + * @param {number} [options.wait.interval] - Polling interval in milliseconds. Defaults to 500 + * @param {string} [options.webhook] - An HTTPS URL for receiving a webhook when the prediction has new output + * @param {string[]} [options.webhook_events_filter] - You can change which events trigger webhook requests by specifying webhook events (`start`|`output`|`logs`|`completed`) + * @param {AbortSignal} [options.signal] - AbortSignal to cancel the prediction + * @param {Function} [progress] - Callback function that receives the prediction object as it's updated. The function is called when the prediction is created, each time its updated while polling for completion, and when it's completed. + * @throws {Error} If the reference is invalid + * @throws {Error} If the prediction failed + * @returns {Promise<object>} - Resolves with the output of running the model + */ + run(ref, options, progress) { + return __async(this, null, function* () { + const _a = options, + { wait } = _a, + data = __objRest(_a, ["wait"]); + const identifier = ModelVersionIdentifier.parse(ref); + let prediction; + if (identifier.version) { + prediction = yield this.predictions.create( + __spreadProps(__spreadValues({}, data), { + version: identifier.version, + }), + ); + } else if (identifier.owner && identifier.name) { + prediction = yield this.predictions.create( + __spreadProps(__spreadValues({}, data), { + model: `${identifier.owner}/${identifier.name}`, + }), + ); + } else { + throw new Error("Invalid model version identifier"); + } + if (progress) { + progress(prediction); + } + const { signal } = options; + prediction = yield this.wait( + prediction, + wait || {}, + (updatedPrediction) => + __async(this, null, function* () { + if (progress) { + progress(updatedPrediction); + } + if (signal && signal.aborted) { + yield this.predictions.cancel(updatedPrediction.id); + return true; + } + return false; + }), + ); + if (progress) { + progress(prediction); + } + if (prediction.status === "failed") { + throw new Error(`Prediction failed: ${prediction.error}`); + } + return prediction.output; + }); + } + /** + * Make a request to the Replicate API. + * + * @param {string} route - REST API endpoint path + * @param {object} options - Request parameters + * @param {string} [options.method] - HTTP method. Defaults to GET + * @param {object} [options.params] - Query parameters + * @param {object|Headers} [options.headers] - HTTP headers + * @param {object} [options.data] - Body parameters + * @returns {Promise<Response>} - Resolves with the response object + * @throws {ApiError} If the request failed + */ + request(route, options) { + return __async(this, null, function* () { + const { auth, baseUrl, userAgent } = this; + let url; + if (route instanceof URL) { + url = route; + } else { + url = new URL( + route.startsWith("/") ? route.slice(1) : route, + baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`, + ); + } + const { method = "GET", params = {}, data } = options; + for (const [key, value] of Object.entries(params)) { + url.searchParams.append(key, value); + } + const headers = {}; + if (auth) { + headers["Authorization"] = `Token ${auth}`; + } + headers["Content-Type"] = "application/json"; + headers["User-Agent"] = userAgent; + if (options.headers) { + for (const [key, value] of Object.entries(options.headers)) { + headers[key] = value; + } + } + const init = { + method, + headers, + body: data ? JSON.stringify(data) : void 0, + }; + const shouldRetry = + method === "GET" + ? (response2) => + response2.status === 429 || response2.status >= 500 + : (response2) => response2.status === 429; + const _fetch = this.fetch; + const response = yield withAutomaticRetries( + () => + __async(this, null, function* () { + return _fetch(url, init); + }), + { + shouldRetry, + }, + ); + if (!response.ok) { + const request = new Request(url, init); + const responseText = yield response.text(); + throw new ApiError( + `Request to ${url} failed with status ${response.status} ${response.statusText}: ${responseText}.`, + request, + response, + ); + } + return response; + }); + } + /** + * Stream a model and wait for its output. + * + * @param {string} identifier - Required. The model version identifier in the format "{owner}/{name}:{version}" + * @param {object} options + * @param {object} options.input - Required. An object with the model inputs + * @param {string} [options.webhook] - An HTTPS URL for receiving a webhook when the prediction has new output + * @param {string[]} [options.webhook_events_filter] - You can change which events trigger webhook requests by specifying webhook events (`start`|`output`|`logs`|`completed`) + * @param {AbortSignal} [options.signal] - AbortSignal to cancel the prediction + * @throws {Error} If the prediction failed + * @yields {ServerSentEvent} Each streamed event from the prediction + */ + stream(ref, options) { + return __asyncGenerator(this, null, function* () { + const _a = options, + { wait } = _a, + data = __objRest(_a, ["wait"]); + const identifier = ModelVersionIdentifier.parse(ref); + let prediction; + if (identifier.version) { + prediction = yield new __await( + this.predictions.create( + __spreadProps(__spreadValues({}, data), { + version: identifier.version, + stream: true, + }), + ), + ); + } else if (identifier.owner && identifier.name) { + prediction = yield new __await( + this.predictions.create( + __spreadProps(__spreadValues({}, data), { + model: `${identifier.owner}/${identifier.name}`, + stream: true, + }), + ), + ); + } else { + throw new Error("Invalid model version identifier"); + } + if (prediction.urls && prediction.urls.stream) { + const { signal } = options; + const stream = createReadableStream({ + url: prediction.urls.stream, + fetch: this.fetch, + options: { signal }, + }); + yield* __yieldStar(streamAsyncIterator(stream)); + } else { + throw new Error("Prediction does not support streaming"); + } + }); + } + /** + * Paginate through a list of results. + * + * @generator + * @example + * for await (const page of replicate.paginate(replicate.predictions.list) { + * console.log(page); + * } + * @param {Function} endpoint - Function that returns a promise for the next page of results + * @yields {object[]} Each page of results + */ + paginate(endpoint) { + return __asyncGenerator(this, null, function* () { + const response = yield new __await(endpoint()); + yield response.results; + if (response.next) { + const nextPage = () => + this.request(response.next, { method: "GET" }).then((r) => + r.json(), + ); + yield* __yieldStar(this.paginate(nextPage)); + } + }); + } + /** + * Wait for a prediction to finish. + * + * If the prediction has already finished, + * this function returns immediately. + * Otherwise, it polls the API until the prediction finishes. + * + * @async + * @param {object} prediction - Prediction object + * @param {object} options - Options + * @param {number} [options.interval] - Polling interval in milliseconds. Defaults to 500 + * @param {Function} [stop] - Async callback function that is called after each polling attempt. Receives the prediction object as an argument. Return false to cancel polling. + * @throws {Error} If the prediction doesn't complete within the maximum number of attempts + * @throws {Error} If the prediction failed + * @returns {Promise<object>} Resolves with the completed prediction object + */ + wait(prediction, options, stop) { + return __async(this, null, function* () { + const { id } = prediction; + if (!id) { + throw new Error("Invalid prediction"); + } + if ( + prediction.status === "succeeded" || + prediction.status === "failed" || + prediction.status === "canceled" + ) { + return prediction; + } + const sleep = (ms) => + new Promise((resolve) => setTimeout(resolve, ms)); + const interval = (options && options.interval) || 500; + let updatedPrediction = yield this.predictions.get(id); + while ( + updatedPrediction.status !== "succeeded" && + updatedPrediction.status !== "failed" && + updatedPrediction.status !== "canceled" + ) { + if (stop && (yield stop(updatedPrediction)) === true) { + break; + } + yield sleep(interval); + updatedPrediction = yield this.predictions.get(prediction.id); + } + if (updatedPrediction.status === "failed") { + throw new Error(`Prediction failed: ${updatedPrediction.error}`); + } + return updatedPrediction; + }); + } + }; + module.exports = Replicate; + module.exports.validateWebhook = validateWebhook; + module.exports.parseProgressFromLogs = parseProgressFromLogs; + }, +}); +export default require_replicate(); diff --git a/packages/core/src/internal/deps/replicate.license b/packages/core/src/internal/deps/replicate.license new file mode 100644 index 0000000000000000000000000000000000000000..bb1d6479bfbfd3daa579aec3a8862595c30259c3 --- /dev/null +++ b/packages/core/src/internal/deps/replicate.license @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2023 Replicate, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/packages/core/src/llm/index.ts b/packages/core/src/llm/index.ts index 097b8afdd549514a3ea76740154f582a1f88996c..836cd4be71cc598441e04c1386dae7416c3f3f84 100644 --- a/packages/core/src/llm/index.ts +++ b/packages/core/src/llm/index.ts @@ -12,8 +12,10 @@ export { Portkey } from "./portkey.js"; export * from "./replicate_ai.js"; // Note: The type aliases for replicate are to simplify usage for Llama 2 (we're using replicate for Llama 2 support) export { - ReplicateChatStrategy as DeuceChatStrategy, - ReplicateLLM as LlamaDeuce, + DeuceChatStrategy, + LlamaDeuce, + ReplicateChatStrategy, + ReplicateLLM, } from "./replicate_ai.js"; export { TogetherLLM } from "./together.js"; export * from "./types.js"; diff --git a/packages/core/src/llm/replicate_ai.ts b/packages/core/src/llm/replicate_ai.ts index b369a1bf37c1d365c841d16036c4fa38c5423107..acc807700930c8e053d8704dde47f8131795f362 100644 --- a/packages/core/src/llm/replicate_ai.ts +++ b/packages/core/src/llm/replicate_ai.ts @@ -1,5 +1,5 @@ import { getEnv } from "@llamaindex/env"; -import Replicate from "replicate"; +import Replicate from "../internal/deps/replicate.js"; import { BaseLLM } from "./base.js"; import type { ChatMessage, @@ -69,6 +69,16 @@ export const ALL_AVAILABLE_REPLICATE_MODELS = { replicateApi: "meta/llama-2-7b-chat:13c3cdee13ee059ab779f0291d29054dab00a47dad8261375654de5540165fb0", }, + + "llama-3-70b-instruct": { + contextWindow: 8192, + replicateApi: "meta/meta-llama-3-70b-instruct", + }, + + "llama-3-8b-instruct": { + contextWindow: 8192, + replicateApi: "meta/meta-llama-3-8b-instruct", + }, }; export enum ReplicateChatStrategy { @@ -81,8 +91,11 @@ export enum ReplicateChatStrategy { //^ To satisfy Replicate's 4 bit models' requirements where they also insert some INST tags REPLICATE4BITWNEWLINES = "replicate4bitwnewlines", //^ Replicate's documentation recommends using newlines: https://replicate.com/blog/how-to-prompt-llama + LLAMA3 = "llama3", } +export const DeuceChatStrategy = ReplicateChatStrategy; + /** * Replicate LLM implementation used */ @@ -94,16 +107,25 @@ export class ReplicateLLM extends BaseLLM { maxTokens?: number; replicateSession: ReplicateSession; - constructor(init?: Partial<ReplicateLLM>) { + constructor(init?: Partial<ReplicateLLM> & { noWarn?: boolean }) { super(); - this.model = init?.model ?? "Llama-2-70b-chat-4bit"; + + if (!init?.model && !init?.noWarn) { + console.warn( + "The default model has been changed to llama-3-70b-instruct. Set noWarn to true to suppress this warning.", + ); + } + + this.model = init?.model ?? "llama-3-70b-instruct"; this.chatStrategy = init?.chatStrategy ?? - (this.model.endsWith("4bit") - ? ReplicateChatStrategy.REPLICATE4BITWNEWLINES // With the newer Replicate models they do the system message themselves. - : ReplicateChatStrategy.METAWBOS); // With BOS and EOS seems to work best, although they all have problems past a certain point + (this.model.startsWith("llama-3") + ? ReplicateChatStrategy.LLAMA3 + : this.model.endsWith("4bit") + ? ReplicateChatStrategy.REPLICATE4BITWNEWLINES // With the newer Replicate models they do the system message themselves. + : ReplicateChatStrategy.METAWBOS); // With BOS and EOS seems to work best, although they all have problems past a certain point this.temperature = init?.temperature ?? 0.1; // minimum temperature is 0.01 for Replicate endpoint - this.topP = init?.topP ?? 1; + this.topP = init?.topP ?? (this.model.startsWith("llama-3") ? 0.9 : 1); // llama-3 defaults to 0.9 top P this.maxTokens = init?.maxTokens ?? ALL_AVAILABLE_REPLICATE_MODELS[this.model].contextWindow; // For Replicate, the default is 500 tokens which is too low. @@ -122,7 +144,9 @@ export class ReplicateLLM extends BaseLLM { } mapMessagesToPrompt(messages: ChatMessage[]) { - if (this.chatStrategy === ReplicateChatStrategy.A16Z) { + if (this.chatStrategy === ReplicateChatStrategy.LLAMA3) { + return this.mapMessagesToPromptLlama3(messages); + } else if (this.chatStrategy === ReplicateChatStrategy.A16Z) { return this.mapMessagesToPromptA16Z(messages); } else if (this.chatStrategy === ReplicateChatStrategy.META) { return this.mapMessagesToPromptMeta(messages); @@ -145,6 +169,32 @@ export class ReplicateLLM extends BaseLLM { } } + mapMessagesToPromptLlama3(messages: ChatMessage[]) { + return { + prompt: + "<|begin_of_text|>" + + messages.reduce((acc, message) => { + let content = ""; + if (typeof message.content === "string") { + content = message.content; + } else { + if (message.content[0].type === "text") { + content = message.content[0].text; + } else { + content = ""; + } + } + + return ( + acc + + `<|start_header_id|>${message.role}<|end_header_id|>\n\n${content}<|eot_id|>` + ); + }, "") + + "<|start_header_id|>assistant<|end_header_id|>\n\n", + systemPrompt: undefined, + }; + } + mapMessagesToPromptA16Z(messages: ChatMessage[]) { return { prompt: @@ -278,6 +328,10 @@ If a question does not make any sense, or is not factually coherent, explain why replicateOptions.input.max_length = this.maxTokens; } + if (this.model.startsWith("llama-3")) { + replicateOptions.input.prompt_template = "{prompt}"; + } + //TODO: Add streaming for this if (stream) { throw new Error("Streaming not supported for ReplicateLLM"); @@ -298,3 +352,5 @@ If a question does not make any sense, or is not factually coherent, explain why }; } } + +export const LlamaDeuce = ReplicateLLM; diff --git a/packages/edge/package.json b/packages/edge/package.json index 1b595b2beba872018b50237aa1bde584b0caf4ef..66fd8b3db8b71b3a753e4cfa6388518cde369070 100644 --- a/packages/edge/package.json +++ b/packages/edge/package.json @@ -4,7 +4,7 @@ "license": "MIT", "type": "module", "dependencies": { - "@anthropic-ai/sdk": "^0.20.4", + "@anthropic-ai/sdk": "^0.20.6", "@aws-crypto/sha256-js": "^5.2.0", "@datastax/astra-db-ts": "^1.0.1", "@grpc/grpc-js": "^1.10.6", @@ -18,20 +18,20 @@ "@types/node": "^20.12.7", "@types/papaparse": "^5.3.14", "@types/pg": "^8.11.5", - "@xenova/transformers": "^2.16.1", - "@zilliz/milvus2-sdk-node": "^2.3.5", + "@xenova/transformers": "^2.17.1", + "@zilliz/milvus2-sdk-node": "^2.4.1", "ajv": "^8.12.0", - "assemblyai": "^4.3.4", + "assemblyai": "^4.4.1", "chromadb": "~1.7.3", - "cohere-ai": "^7.9.3", - "js-tiktoken": "^1.0.10", + "cohere-ai": "^7.9.5", + "js-tiktoken": "^1.0.11", "lodash": "^4.17.21", "magic-bytes.js": "^1.10.0", "mammoth": "^1.7.1", "md-utils-ts": "^2.0.0", "mongodb": "^6.5.0", "notion-md-crawler": "^0.0.2", - "openai": "^4.33.0", + "openai": "^4.38.0", "papaparse": "^5.4.1", "pathe": "^1.1.2", "pdf2json": "^3.0.5", @@ -39,7 +39,6 @@ "pgvector": "^0.1.8", "portkey-ai": "^0.1.16", "rake-modified": "^1.0.8", - "replicate": "^0.25.2", "string-strip-html": "^13.4.8", "wikipedia": "^2.1.2", "wink-nlp": "^1.14.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 792347f4c92820b3660c0171822b43f6a3f14dff..34d730e580429c68539997bad3fea96e07545de8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -132,11 +132,11 @@ importers: specifier: ^1.1.3 version: 1.1.3 '@zilliz/milvus2-sdk-node': - specifier: ^2.3.5 - version: 2.3.5 + specifier: ^2.4.1 + version: 2.4.1 chromadb: specifier: ^1.8.1 - version: 1.8.1(cohere-ai@7.9.4(encoding@0.1.13))(encoding@0.1.13)(openai@4.36.0(encoding@0.1.13)) + version: 1.8.1(cohere-ai@7.9.5(encoding@0.1.13))(encoding@0.1.13)(openai@4.38.0(encoding@0.1.13)) commander: specifier: ^11.1.0 version: 11.1.0 @@ -144,11 +144,11 @@ importers: specifier: ^16.4.5 version: 16.4.5 js-tiktoken: - specifier: ^1.0.10 - version: 1.0.10 + specifier: ^1.0.11 + version: 1.0.11 llamaindex: specifier: latest - version: link:../packages/core + version: 0.2.9(encoding@0.1.13)(node-fetch@2.7.0(encoding@0.1.13))(readable-stream@4.5.2)(typescript@5.4.5) mongodb: specifier: ^6.5.0 version: 6.5.0 @@ -161,7 +161,7 @@ importers: version: 20.12.7 ts-node: specifier: ^10.9.2 - version: 10.9.2(@swc/core@1.4.13(@swc/helpers@0.5.2))(@types/node@20.12.7)(typescript@5.4.5) + version: 10.9.2(@swc/core@1.4.16(@swc/helpers@0.5.2))(@types/node@20.12.7)(typescript@5.4.5) tsx: specifier: ^4.7.2 version: 4.7.2 @@ -173,14 +173,14 @@ importers: dependencies: llamaindex: specifier: latest - version: 0.2.8(encoding@0.1.13)(node-fetch@2.7.0(encoding@0.1.13))(readable-stream@4.5.2)(typescript@5.4.3) + version: 0.2.9(encoding@0.1.13)(node-fetch@2.7.0(encoding@0.1.13))(readable-stream@4.5.2)(typescript@5.4.3) devDependencies: '@types/node': specifier: ^20.12.7 version: 20.12.7 ts-node: specifier: ^10.9.2 - version: 10.9.2(@swc/core@1.4.13(@swc/helpers@0.5.2))(@types/node@20.12.7)(typescript@5.4.3) + version: 10.9.2(@swc/core@1.4.16(@swc/helpers@0.5.2))(@types/node@20.12.7)(typescript@5.4.3) typescript: specifier: ^5.4.3 version: 5.4.3 @@ -188,8 +188,8 @@ importers: packages/core: dependencies: '@anthropic-ai/sdk': - specifier: ^0.20.4 - version: 0.20.4(encoding@0.1.13) + specifier: ^0.20.6 + version: 0.20.6(encoding@0.1.13) '@aws-crypto/sha256-js': specifier: ^5.2.0 version: 5.2.0 @@ -230,26 +230,26 @@ importers: specifier: ^8.11.5 version: 8.11.5 '@xenova/transformers': - specifier: ^2.16.1 - version: 2.16.1 + specifier: ^2.17.1 + version: 2.17.1 '@zilliz/milvus2-sdk-node': - specifier: ^2.3.5 - version: 2.3.5 + specifier: ^2.4.1 + version: 2.4.1 ajv: specifier: ^8.12.0 version: 8.12.0 assemblyai: - specifier: ^4.3.4 - version: 4.3.4 + specifier: ^4.4.1 + version: 4.4.1 chromadb: specifier: ~1.7.3 - version: 1.7.3(cohere-ai@7.9.3(encoding@0.1.13))(encoding@0.1.13)(openai@4.33.0(encoding@0.1.13)) + version: 1.7.3(cohere-ai@7.9.5(encoding@0.1.13))(encoding@0.1.13)(openai@4.38.0(encoding@0.1.13)) cohere-ai: - specifier: ^7.9.3 - version: 7.9.3(encoding@0.1.13) + specifier: ^7.9.5 + version: 7.9.5(encoding@0.1.13) js-tiktoken: - specifier: ^1.0.10 - version: 1.0.10 + specifier: ^1.0.11 + version: 1.0.11 lodash: specifier: ^4.17.21 version: 4.17.21 @@ -269,8 +269,8 @@ importers: specifier: ^0.0.2 version: 0.0.2(encoding@0.1.13) openai: - specifier: ^4.33.0 - version: 4.33.0(encoding@0.1.13) + specifier: ^4.38.0 + version: 4.38.0(encoding@0.1.13) papaparse: specifier: ^5.4.1 version: 5.4.1 @@ -292,9 +292,6 @@ importers: rake-modified: specifier: ^1.0.8 version: 1.0.8 - replicate: - specifier: ^0.25.2 - version: 0.25.2 string-strip-html: specifier: ^13.4.8 version: 13.4.8 @@ -307,10 +304,10 @@ importers: devDependencies: '@swc/cli': specifier: ^0.3.12 - version: 0.3.12(@swc/core@1.4.13(@swc/helpers@0.5.2))(chokidar@3.6.0) + version: 0.3.12(@swc/core@1.4.16(@swc/helpers@0.5.2))(chokidar@3.6.0) '@swc/core': - specifier: ^1.4.13 - version: 1.4.13(@swc/helpers@0.5.2) + specifier: ^1.4.16 + version: 1.4.16(@swc/helpers@0.5.2) concurrently: specifier: ^8.2.2 version: 8.2.2 @@ -351,8 +348,8 @@ importers: packages/edge: dependencies: '@anthropic-ai/sdk': - specifier: ^0.20.4 - version: 0.20.4(encoding@0.1.13) + specifier: ^0.20.6 + version: 0.20.6(encoding@0.1.13) '@aws-crypto/sha256-js': specifier: ^5.2.0 version: 5.2.0 @@ -393,26 +390,26 @@ importers: specifier: ^8.11.5 version: 8.11.5 '@xenova/transformers': - specifier: ^2.16.1 - version: 2.16.1 + specifier: ^2.17.1 + version: 2.17.1 '@zilliz/milvus2-sdk-node': - specifier: ^2.3.5 - version: 2.3.5 + specifier: ^2.4.1 + version: 2.4.1 ajv: specifier: ^8.12.0 version: 8.12.0 assemblyai: - specifier: ^4.3.4 - version: 4.3.4 + specifier: ^4.4.1 + version: 4.4.1 chromadb: specifier: ~1.7.3 - version: 1.7.3(cohere-ai@7.9.3(encoding@0.1.13))(encoding@0.1.13)(openai@4.33.0(encoding@0.1.13)) + version: 1.7.3(cohere-ai@7.9.5(encoding@0.1.13))(encoding@0.1.13)(openai@4.38.0(encoding@0.1.13)) cohere-ai: - specifier: ^7.9.3 - version: 7.9.3(encoding@0.1.13) + specifier: ^7.9.5 + version: 7.9.5(encoding@0.1.13) js-tiktoken: - specifier: ^1.0.10 - version: 1.0.10 + specifier: ^1.0.11 + version: 1.0.11 lodash: specifier: ^4.17.21 version: 4.17.21 @@ -432,8 +429,8 @@ importers: specifier: ^0.0.2 version: 0.0.2(encoding@0.1.13) openai: - specifier: ^4.33.0 - version: 4.33.0(encoding@0.1.13) + specifier: ^4.38.0 + version: 4.38.0(encoding@0.1.13) papaparse: specifier: ^5.4.1 version: 5.4.1 @@ -455,9 +452,6 @@ importers: rake-modified: specifier: ^1.0.8 version: 1.0.8 - replicate: - specifier: ^0.25.2 - version: 0.25.2 string-strip-html: specifier: ^13.4.8 version: 13.4.8 @@ -682,11 +676,8 @@ packages: resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} - '@anthropic-ai/sdk@0.18.0': - resolution: {integrity: sha512-3XsWEn/4nPGRd4AdSguugbSDFy6Z2AWTNOeI3iK+aV22+w23+vY9CEb3Hiy0kvKIQuxSmZz/+5WKC8nPWy8gVg==} - - '@anthropic-ai/sdk@0.20.4': - resolution: {integrity: sha512-ULzz+0Smk9SNkAi1tcjJByxbt4taBhnQkRAB75iH0ku5dRwiPxGxN0WOWHoNIq22dGWBXJByrQRhVf80V4xAPA==} + '@anthropic-ai/sdk@0.20.6': + resolution: {integrity: sha512-vpVWAol+Ih1UkZGUj8DYPuqWDGxBp6M/JYz4nvq2HBT0zKdvi24Z9oznA7tr+HDed78JZrw+nbxs2I8JbTAIiQ==} '@assemblyscript/loader@0.19.23': resolution: {integrity: sha512-ulkCYfFbYj01ie1MDOyxv2F6SpRN1TOj7fQxbP07D6HmeR+gr2JLSmINKjga2emB+b1L2KGrFKBTc+e00p54nw==} @@ -1790,20 +1781,11 @@ packages: resolution: {integrity: sha512-xP58G7wDQ4TCmN/cMUHh00DS7SRDv/+lC+xFLrTkMIN8h55X5NhZMLYbvy7dSELP15qlI6hPhNCRWVMtZMwqLA==} engines: {node: '>=12.10.0'} - '@grpc/grpc-js@1.8.17': - resolution: {integrity: sha512-DGuSbtMFbaRsyffMf+VEkVu8HkSXEUfO3UyGJNtqxW9ABdtTIA+2UXAJpwbJS+xfQxuwqLUeELmL6FuZkOqPxw==} - engines: {node: ^8.13.0 || >=10.10.0} - '@grpc/proto-loader@0.7.12': resolution: {integrity: sha512-DCVwMxqYzpUCiDMl7hQ384FqP4T3DbNpXU8pt681l3UWCip1WUiD5JrkImUwCB9a7f2cq4CUTmi5r/xIMRPY1Q==} engines: {node: '>=6'} hasBin: true - '@grpc/proto-loader@0.7.7': - resolution: {integrity: sha512-1TIeXOi8TuSCQprPItwoMymZXxWT0CPxUhkrkeCUH+D8U7QDwQ6b7SUz2MaLuWM2llT+J/TVFLmQI5KtML3BhQ==} - engines: {node: '>=6'} - hasBin: true - '@hapi/hoek@9.3.0': resolution: {integrity: sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==} @@ -1841,10 +1823,6 @@ packages: resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} engines: {node: '>=6.0.0'} - '@jridgewell/resolve-uri@3.1.1': - resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} - engines: {node: '>=6.0.0'} - '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} @@ -1987,6 +1965,9 @@ packages: resolution: {integrity: sha512-XhdSY/4B1D34tSco/GION+23GMjaS9S2zszcqYkMHo8RcWInymF6L1x+Gk7EmHdrSxNFva2WM8orhC4BwQCwgw==} engines: {node: '>=12'} + '@petamoriken/float16@3.8.6': + resolution: {integrity: sha512-GNJhABTtcmt9al/nqdJPycwFD46ww2+q2zwZzTjY0dFFwUAFRw9zszvEr9osyJRd9krRGy6hUDopWUg9fX7VVw==} + '@pinecone-database/pinecone@1.1.3': resolution: {integrity: sha512-bGldvvoAr4agVZ2ql4RZesXIDjMLjnuqNmKYfMQoVO3UFRYeuO9z+1WJodvanGIPY2iGh1w9yz0jDAkBiT53qw==} engines: {node: '>=14.0.0'} @@ -2267,8 +2248,8 @@ packages: chokidar: optional: true - '@swc/core-darwin-arm64@1.4.13': - resolution: {integrity: sha512-36P72FLpm5iq85IvoEjBvi22DiqkkEIanJ1M0E8bkxcFHUbjBrYfPY9T6cpPyK5oQqkaTBvNAc3j1BlVD6IH6w==} + '@swc/core-darwin-arm64@1.4.16': + resolution: {integrity: sha512-UOCcH1GvjRnnM/LWT6VCGpIk0OhHRq6v1U6QXuPt5wVsgXnXQwnf5k3sG5Cm56hQHDvhRPY6HCsHi/p0oek8oQ==} engines: {node: '>=10'} cpu: [arm64] os: [darwin] @@ -2279,8 +2260,8 @@ packages: cpu: [arm64] os: [darwin] - '@swc/core-darwin-x64@1.4.13': - resolution: {integrity: sha512-ye7OgKpDdyA8AMIVVdmD1ICDaFXgoEXORnVO8bBHyul0WN71yUBZMX+YxEx2lpWtiftA2vY/1MAuOR80vHkBCw==} + '@swc/core-darwin-x64@1.4.16': + resolution: {integrity: sha512-t3bgqFoYLWvyVtVL6KkFNCINEoOrIlyggT/kJRgi1y0aXSr0oVgcrQ4ezJpdeahZZ4N+Q6vT3ffM30yIunELNA==} engines: {node: '>=10'} cpu: [x64] os: [darwin] @@ -2291,8 +2272,8 @@ packages: cpu: [x64] os: [darwin] - '@swc/core-linux-arm-gnueabihf@1.4.13': - resolution: {integrity: sha512-+x593Jlmu4c3lJtZUKRejWpV2MAij1Js5nmQLLdjo6ChR2D4B2rzj3iMiKn5gITew7fraF9t3fvXALdWh7HmUg==} + '@swc/core-linux-arm-gnueabihf@1.4.16': + resolution: {integrity: sha512-DvHuwvEF86YvSd0lwnzVcjOTZ0jcxewIbsN0vc/0fqm9qBdMMjr9ox6VCam1n3yYeRtj4VFgrjeNFksqbUejdQ==} engines: {node: '>=10'} cpu: [arm] os: [linux] @@ -2303,8 +2284,8 @@ packages: cpu: [arm] os: [linux] - '@swc/core-linux-arm64-gnu@1.4.13': - resolution: {integrity: sha512-0x8OVw4dfyNerrs/9eZX9wNnmvwbwXSMCi+LbE6Xt1pXOIwvoLtFIXcV3NsrlkFboO3sr5UAQIwDxKqbIZA9pQ==} + '@swc/core-linux-arm64-gnu@1.4.16': + resolution: {integrity: sha512-9Uu5YlPbyCvbidjKtYEsPpyZlu16roOZ5c2tP1vHfnU9bgf5Tz5q5VovSduNxPHx+ed2iC1b1URODHvDzbbDuQ==} engines: {node: '>=10'} cpu: [arm64] os: [linux] @@ -2315,8 +2296,8 @@ packages: cpu: [arm64] os: [linux] - '@swc/core-linux-arm64-musl@1.4.13': - resolution: {integrity: sha512-Z9c4JiequtZvngPcxbCuAOkmWBxi2vInZbjjhD5I+Q9oiJdXUz1t2USGwsGPS41Xvk1BOA3ecK2Sn1ilY3titg==} + '@swc/core-linux-arm64-musl@1.4.16': + resolution: {integrity: sha512-/YZq/qB1CHpeoL0eMzyqK5/tYZn/rzKoCYDviFU4uduSUIJsDJQuQA/skdqUzqbheOXKAd4mnJ1hT04RbJ8FPQ==} engines: {node: '>=10'} cpu: [arm64] os: [linux] @@ -2327,8 +2308,8 @@ packages: cpu: [arm64] os: [linux] - '@swc/core-linux-x64-gnu@1.4.13': - resolution: {integrity: sha512-ChatHtk+vX0Ke5QG+jO+rIapw/KwZsi9MedCBHFXHH6iWF4z8d51cJeN68ykcn+vAXzjNeFNdlNy5Vbkd1zAqg==} + '@swc/core-linux-x64-gnu@1.4.16': + resolution: {integrity: sha512-UUjaW5VTngZYDcA8yQlrFmqs1tLi1TxbKlnaJwoNhel9zRQ0yG1YEVGrzTvv4YApSuIiDK18t+Ip927bwucuVQ==} engines: {node: '>=10'} cpu: [x64] os: [linux] @@ -2339,8 +2320,8 @@ packages: cpu: [x64] os: [linux] - '@swc/core-linux-x64-musl@1.4.13': - resolution: {integrity: sha512-0Pz39YR530mXpsztwQkmEKdkkZy4fY4Smdh4pkm6Ly8Nndyo0te/l4bcAGqN24Jp7aVwF/QSy14SAtw4HRjU9g==} + '@swc/core-linux-x64-musl@1.4.16': + resolution: {integrity: sha512-aFhxPifevDTwEDKPi4eRYWzC0p/WYJeiFkkpNU5Uc7a7M5iMWPAbPFUbHesdlb9Jfqs5c07oyz86u+/HySBNPQ==} engines: {node: '>=10'} cpu: [x64] os: [linux] @@ -2351,8 +2332,8 @@ packages: cpu: [x64] os: [linux] - '@swc/core-win32-arm64-msvc@1.4.13': - resolution: {integrity: sha512-LVZfhlD+jHcAbz5NN+gAJ1BEasB0WpcvUzcsJt0nQSRsojgzPzFjJ+fzEBnvT7SMtqKkrnVJ0OmDYeh88bDRpw==} + '@swc/core-win32-arm64-msvc@1.4.16': + resolution: {integrity: sha512-bTD43MbhIHL2s5QgCwyleaGwl96Gk/scF2TaVKdUe4QlJCDV/YK9h5oIBAp63ckHtE8GHlH4c8dZNBiAXn4Org==} engines: {node: '>=10'} cpu: [arm64] os: [win32] @@ -2363,8 +2344,8 @@ packages: cpu: [arm64] os: [win32] - '@swc/core-win32-ia32-msvc@1.4.13': - resolution: {integrity: sha512-78hxHWUvUZtWsnhcf8DKwhBcNFJw+j4y4fN2B9ioXmBWX2tIyw+BqUHOrismOtjPihaZmwe/Ok2e4qmkawE2fw==} + '@swc/core-win32-ia32-msvc@1.4.16': + resolution: {integrity: sha512-/lmZeAN/qV5XbK2SEvi8e2RkIg8FQNYiSA8y2/Zb4gTUMKVO5JMLH0BSWMiIKMstKDPDSxMWgwJaQHF8UMyPmQ==} engines: {node: '>=10'} cpu: [ia32] os: [win32] @@ -2375,8 +2356,8 @@ packages: cpu: [ia32] os: [win32] - '@swc/core-win32-x64-msvc@1.4.13': - resolution: {integrity: sha512-WSfy1u2Xde6jU7UpHIInCUMW98Zw9iZglddKUAvmr1obkZji5U6EX0Oca3asEJdZPFb+2lMLjt0Mh5a1YisROg==} + '@swc/core-win32-x64-msvc@1.4.16': + resolution: {integrity: sha512-BPAfFfODWXtUu6SwaTTftDHvcbDyWBSI/oanUeRbQR5vVWkXoQ3cxLTsDluc3H74IqXS5z1Uyoe0vNo2hB1opA==} engines: {node: '>=10'} cpu: [x64] os: [win32] @@ -2387,8 +2368,8 @@ packages: cpu: [x64] os: [win32] - '@swc/core@1.4.13': - resolution: {integrity: sha512-rOtusBE+2gaeRkAJn5E4zp5yzZekZOypzSOz5ZG6P1hFbd+Cc26fWEdK6sUSnrkkvTd0Oj33KXLB/4UkbK/UHA==} + '@swc/core@1.4.16': + resolution: {integrity: sha512-Xaf+UBvW6JNuV131uvSNyMXHn+bh6LyKN4tbv7tOUFQpXyz/t9YWRE04emtlUW9Y0qrm/GKFCbY8n3z6BpZbTA==} engines: {node: '>=10'} peerDependencies: '@swc/helpers': ^0.5.0 @@ -2537,9 +2518,6 @@ packages: '@types/lodash@4.17.0': resolution: {integrity: sha512-t7dhREVv6dbNj0q17X12j7yDG4bD/DHYX7o5/DbDxobP0HnGPgpRz2Ej77aL7TZT3DSw13fqUTj8J4mMnqa7WA==} - '@types/long@4.0.2': - resolution: {integrity: sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==} - '@types/mdast@4.0.3': resolution: {integrity: sha512-LsjtqsyF+d2/yFOYaN22dHZI1Cpwkrj+g06G8+qtUKlhovPW89YhqSnfKtMbkgmEtYpH2gydRNULd6y8mciAFg==} @@ -2597,9 +2575,6 @@ packages: '@types/prop-types@15.7.12': resolution: {integrity: sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==} - '@types/qs@6.9.14': - resolution: {integrity: sha512-5khscbd3SwWMhFqylJBLQ0zIu7c1K6Vz0uBIt915BI3zV0q1nfjRQD3RqSBcPaO6PHEF4ov/t9y89fSiyThlPA==} - '@types/qs@6.9.15': resolution: {integrity: sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==} @@ -2885,11 +2860,8 @@ packages: '@webassemblyjs/wast-printer@1.12.1': resolution: {integrity: sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==} - '@xenova/transformers@2.16.1': - resolution: {integrity: sha512-p2ii7v7oC3Se0PC012dn4vt196GCroaN5ngOYJYkfg0/ce8A5frsrnnnktOBJuejG3bW5Hreb7JZ/KxtUaKd8w==} - - '@xenova/transformers@2.17.0': - resolution: {integrity: sha512-usmDut7hwnrc4EqP59cboYqE6C8up63SqMy3E9RjG9nCsOhrsLndEU7DMu+bZ9R+HcAI8jRGabTIxH+B6agBVA==} + '@xenova/transformers@2.17.1': + resolution: {integrity: sha512-zo702tQAFZXhzeD2GCYUNUqeqkoueOdiSbQWa4s0q7ZE4z8WBIwIsMMPGobpgdqjQ2u0Qulo08wuqVEUrBXjkQ==} '@xmldom/xmldom@0.8.10': resolution: {integrity: sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==} @@ -2901,8 +2873,8 @@ packages: '@xtuc/long@4.2.2': resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} - '@zilliz/milvus2-sdk-node@2.3.5': - resolution: {integrity: sha512-bWbQnhvu+7jZXoqI+qySycwph3vloy0LDV54TBY4wRmu6HhMlqIqyIiI8sQNeSJFs8M1jHg1PlmhE/dvckA1bA==} + '@zilliz/milvus2-sdk-node@2.4.1': + resolution: {integrity: sha512-j3vbMvaQyjnUhDA+Nk6AmEKroGJiA6qTW6lVkLMGYsPQd2WzDXjbEM4YCLUcfyh8xsngAzKFkPmM4YIpI3BdQQ==} abort-controller@3.0.0: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} @@ -3094,12 +3066,8 @@ packages: resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} engines: {node: '>=0.10.0'} - assemblyai@4.3.4: - resolution: {integrity: sha512-qsDkLjbAKqgVrpxTdoxF1b5dt1Txmdh49lmO/02MJzXFXzMFUqpsgE/hvQ8Hkfykx/aXuU7WcU2otA9tXKgTPA==} - engines: {node: '>=18'} - - assemblyai@4.4.0: - resolution: {integrity: sha512-UlIDMF/bCzMbD32PI9vd+MXlSMCU+pY+4Z9gJcGxGyv7StJdCDEZFhKQlwFWgKqpxF0DTrcldXev0s/8ngae0A==} + assemblyai@4.4.1: + resolution: {integrity: sha512-GzpbSRhZ0VlHNTQTOKxOrod3Ckw4AZVQQlnE5sJeCuAhTXJLLi5SE6U4vOapTsxf3lO7+93tdNTlWBrkwYO4Nw==} engines: {node: '>=18'} assemblyscript@0.19.23: @@ -3204,9 +3172,6 @@ packages: bare-path@2.1.1: resolution: {integrity: sha512-OHM+iwRDRMDBsSW7kl3dO62JyHdBKO3B25FB9vNQBPcGHMo4+eA8Yj41Lfbk3pS/seDY+siNge0LdRTulAau/A==} - base-64@0.1.0: - resolution: {integrity: sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA==} - base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} @@ -3411,9 +3376,6 @@ packages: chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} - charenc@0.0.2: - resolution: {integrity: sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==} - check-error@1.0.3: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} @@ -3530,11 +3492,8 @@ packages: resolution: {integrity: sha512-PDyvQ5f2PValmqZZIJATimcokDt4JjIev8cKbZgEOoZm+U1IJDYuLeTcxZPQdep99R/X0RIlQ6ReQgPOVnPbNw==} engines: {node: '>=14.18.0'} - cohere-ai@7.9.3: - resolution: {integrity: sha512-DcZ6B9Fa1yaFFkZ3+HO/aE4R97m08cZs/ww7YpfEcTatAljznmnXtaFKRMP57olLMGKmYA/oHpkUqh/Vt4kvFA==} - - cohere-ai@7.9.4: - resolution: {integrity: sha512-ZdrDNs/zAVLd1DUCCX3Dz5/k7IfBDQ31TboxQD1SM44Nboc1NEPoy7mNpqffRzXjwFanQCUg0n+4ZjPp3K6eIQ==} + cohere-ai@7.9.5: + resolution: {integrity: sha512-tr8LUR3Q46agFpfEwaYwzYO4qAuN0/R/8YroG4bc86LadOacBAabctZUq0zfCdLiL7gB4yWJs4QCzfpRH3rQuw==} collapse-white-space@2.1.0: resolution: {integrity: sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==} @@ -3723,9 +3682,6 @@ packages: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} - crypt@0.0.2: - resolution: {integrity: sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==} - crypto-random-string@4.0.0: resolution: {integrity: sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==} engines: {node: '>=12'} @@ -4072,9 +4028,6 @@ packages: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} - digest-fetch@1.3.0: - resolution: {integrity: sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA==} - dingbat-to-unicode@1.0.1: resolution: {integrity: sha512-98l0sW87ZT58pU4i61wa2OHwxbiYSbuxsCBozaVnYX2iCnr3bLM3fIes1/ej7h1YdOKuKt/MLs706TVnALA65w==} @@ -4754,6 +4707,10 @@ packages: functions-have-names@1.2.3: resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} + generic-pool@3.9.0: + resolution: {integrity: sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==} + engines: {node: '>= 4'} + gensync@1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} @@ -4932,10 +4889,6 @@ packages: has-property-descriptors@1.0.2: resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} - has-proto@1.0.1: - resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} - engines: {node: '>= 0.4'} - has-proto@1.0.3: resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==} engines: {node: '>= 0.4'} @@ -4952,10 +4905,6 @@ packages: resolution: {integrity: sha512-IrsVwUHhEULx3R8f/aA8AHuEzAorplsab/v8HBzEiIukwq5i/EC+xmOW+HfP1OaDP+2JkgT1yILHN2O3UFIbcA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - hasown@2.0.0: - resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} - engines: {node: '>= 0.4'} - hasown@2.0.2: resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} @@ -5228,9 +5177,6 @@ packages: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} - is-buffer@1.1.6: - resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==} - is-callable@1.2.7: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} @@ -5498,9 +5444,6 @@ packages: js-base64@3.7.7: resolution: {integrity: sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==} - js-tiktoken@1.0.10: - resolution: {integrity: sha512-ZoSxbGjvGyMT13x6ACo9ebhDha/0FHdKA+OsQcMOWcm1Zs7r90Rhk5lhERLzji+3rA7EKpXCgwXcM5fF3DMpdA==} - js-tiktoken@1.0.11: resolution: {integrity: sha512-PajXFLq2vx7/8jllQZ43vzNpAai/0MOVdJjW/UrNyJorNQRTjHrqdGJG/mjHVy7h9M6dW6CaG43eNLMYFkTh6w==} @@ -5643,8 +5586,8 @@ packages: resolution: {integrity: sha512-ovJXBXkKGfq+CwmKTjluEqFi3p4h8xvkxGQQAQan22YCgef4KZ1mKGjzfGh6PL6AW5Csw0QiQPNuQyH+6Xk3hA==} engines: {node: '>=18.0.0'} - llamaindex@0.2.8: - resolution: {integrity: sha512-aZrWC5MAMko+RPGwRWiBXEhYWffq/Gp6+GWDOyNQGmQom6Dr3EuKcQ9b+QiTV7w9XLUss4NA2aMmTYX60azSiQ==} + llamaindex@0.2.9: + resolution: {integrity: sha512-Ifmk4Bu0CEKI3cwfER3WyZSP7+gOBHgtWobsEJ1c+1pYcIMipwxpqBUba/YXQceuEmh7xsCd0+ROkoNumUX3CQ==} engines: {node: '>=18.0.0'} load-yaml-file@0.2.0: @@ -5818,9 +5761,6 @@ packages: md-utils-ts@2.0.0: resolution: {integrity: sha512-sMG6JtX0ebcRMHxYTcmgsh0/m6o8hGdQHFE2OgjvflRZlQM51CGGj/uuk056D+12BlCiW0aTpt/AdlDNtgQiew==} - md5@2.3.0: - resolution: {integrity: sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==} - mdast-util-directive@3.0.0: resolution: {integrity: sha512-JUpYOqKI4mM3sZcNxmF/ox04XYFFkNwr0CFlrQIkCwbvH0xzMCqkMqAde9wRd80VAhaUrwFwKm2nxretdT1h7Q==} @@ -6396,12 +6336,8 @@ packages: resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==} engines: {node: '>=12'} - openai@4.33.0: - resolution: {integrity: sha512-Sh4KvplkvkAREuhb8yZpohqsOo08cBBu6LNWLD8YyMxe8yCxbE+ouJYUs1X2oDPrzQGANj0rFNQYiwW9gWLBOg==} - hasBin: true - - openai@4.36.0: - resolution: {integrity: sha512-AtYrhhWY64LhB9P6f3H0nV8nTSaQJ89mWPnfNU5CnYg81zlYaV8nkyO+aTNfprdqP/9xv10woNNUgefXINT4Dg==} + openai@4.38.0: + resolution: {integrity: sha512-q1w04cRm+7CgUAGDXqt+OMa89zXBffHrEK0FcVDRhD+zL1S1aAatu4iYO5sIxR2QFEP//i8CM3QaxGVTNajxuw==} hasBin: true opener@1.5.2: @@ -7129,8 +7065,8 @@ packages: resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} engines: {node: '>=0.6'} - qs@6.12.0: - resolution: {integrity: sha512-trVZiI6RMOkO476zLGaBIzszOdFPnCCXHPG9kn0yuS1uz6xdVxPfZdB3vUig9pxPFDM9BRAgz/YUIVQ1/vuiUg==} + qs@6.12.1: + resolution: {integrity: sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ==} engines: {node: '>=0.6'} querystringify@2.2.0: @@ -8969,21 +8905,7 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 - '@anthropic-ai/sdk@0.18.0(encoding@0.1.13)': - dependencies: - '@types/node': 18.19.31 - '@types/node-fetch': 2.6.11 - abort-controller: 3.0.0 - agentkeepalive: 4.5.0 - digest-fetch: 1.3.0 - form-data-encoder: 1.7.2 - formdata-node: 4.4.1 - node-fetch: 2.7.0(encoding@0.1.13) - web-streams-polyfill: 3.3.3 - transitivePeerDependencies: - - encoding - - '@anthropic-ai/sdk@0.20.4(encoding@0.1.13)': + '@anthropic-ai/sdk@0.20.6(encoding@0.1.13)': dependencies: '@types/node': 18.19.31 '@types/node-fetch': 2.6.11 @@ -10818,11 +10740,6 @@ snapshots: '@grpc/proto-loader': 0.7.12 '@js-sdsl/ordered-map': 4.4.2 - '@grpc/grpc-js@1.8.17': - dependencies: - '@grpc/proto-loader': 0.7.7 - '@types/node': 20.12.7 - '@grpc/proto-loader@0.7.12': dependencies: lodash.camelcase: 4.3.0 @@ -10830,14 +10747,6 @@ snapshots: protobufjs: 7.2.6 yargs: 17.7.2 - '@grpc/proto-loader@0.7.7': - dependencies: - '@types/long': 4.0.2 - lodash.camelcase: 4.3.0 - long: 4.0.0 - protobufjs: 7.2.6 - yargs: 17.7.2 - '@hapi/hoek@9.3.0': {} '@hapi/topo@5.1.0': @@ -10886,8 +10795,6 @@ snapshots: '@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/trace-mapping': 0.3.25 - '@jridgewell/resolve-uri@3.1.1': {} - '@jridgewell/resolve-uri@3.1.2': {} '@jridgewell/set-array@1.2.1': {} @@ -10906,7 +10813,7 @@ snapshots: '@jridgewell/trace-mapping@0.3.9': dependencies: - '@jridgewell/resolve-uri': 3.1.1 + '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.4.15 '@js-sdsl/ordered-map@4.4.2': {} @@ -10915,10 +10822,10 @@ snapshots: '@llamaindex/cloud@0.0.5(node-fetch@2.7.0(encoding@0.1.13))': dependencies: - '@types/qs': 6.9.14 + '@types/qs': 6.9.15 form-data: 4.0.0 js-base64: 3.7.7 - qs: 6.12.0 + qs: 6.12.1 optionalDependencies: node-fetch: 2.7.0(encoding@0.1.13) @@ -11054,6 +10961,8 @@ snapshots: transitivePeerDependencies: - encoding + '@petamoriken/float16@3.8.6': {} + '@pinecone-database/pinecone@1.1.3': dependencies: '@sinclair/typebox': 0.29.6 @@ -11296,10 +11205,10 @@ snapshots: transitivePeerDependencies: - supports-color - '@swc/cli@0.3.12(@swc/core@1.4.13(@swc/helpers@0.5.2))(chokidar@3.6.0)': + '@swc/cli@0.3.12(@swc/core@1.4.16(@swc/helpers@0.5.2))(chokidar@3.6.0)': dependencies: '@mole-inc/bin-wrapper': 8.0.1 - '@swc/core': 1.4.13(@swc/helpers@0.5.2) + '@swc/core': 1.4.16(@swc/helpers@0.5.2) '@swc/counter': 0.1.3 commander: 8.3.0 fast-glob: 3.3.2 @@ -11326,81 +11235,81 @@ snapshots: optionalDependencies: chokidar: 3.6.0 - '@swc/core-darwin-arm64@1.4.13': + '@swc/core-darwin-arm64@1.4.16': optional: true '@swc/core-darwin-arm64@1.4.2': optional: true - '@swc/core-darwin-x64@1.4.13': + '@swc/core-darwin-x64@1.4.16': optional: true '@swc/core-darwin-x64@1.4.2': optional: true - '@swc/core-linux-arm-gnueabihf@1.4.13': + '@swc/core-linux-arm-gnueabihf@1.4.16': optional: true '@swc/core-linux-arm-gnueabihf@1.4.2': optional: true - '@swc/core-linux-arm64-gnu@1.4.13': + '@swc/core-linux-arm64-gnu@1.4.16': optional: true '@swc/core-linux-arm64-gnu@1.4.2': optional: true - '@swc/core-linux-arm64-musl@1.4.13': + '@swc/core-linux-arm64-musl@1.4.16': optional: true '@swc/core-linux-arm64-musl@1.4.2': optional: true - '@swc/core-linux-x64-gnu@1.4.13': + '@swc/core-linux-x64-gnu@1.4.16': optional: true '@swc/core-linux-x64-gnu@1.4.2': optional: true - '@swc/core-linux-x64-musl@1.4.13': + '@swc/core-linux-x64-musl@1.4.16': optional: true '@swc/core-linux-x64-musl@1.4.2': optional: true - '@swc/core-win32-arm64-msvc@1.4.13': + '@swc/core-win32-arm64-msvc@1.4.16': optional: true '@swc/core-win32-arm64-msvc@1.4.2': optional: true - '@swc/core-win32-ia32-msvc@1.4.13': + '@swc/core-win32-ia32-msvc@1.4.16': optional: true '@swc/core-win32-ia32-msvc@1.4.2': optional: true - '@swc/core-win32-x64-msvc@1.4.13': + '@swc/core-win32-x64-msvc@1.4.16': optional: true '@swc/core-win32-x64-msvc@1.4.2': optional: true - '@swc/core@1.4.13(@swc/helpers@0.5.2)': + '@swc/core@1.4.16(@swc/helpers@0.5.2)': dependencies: '@swc/counter': 0.1.3 '@swc/types': 0.1.6 optionalDependencies: - '@swc/core-darwin-arm64': 1.4.13 - '@swc/core-darwin-x64': 1.4.13 - '@swc/core-linux-arm-gnueabihf': 1.4.13 - '@swc/core-linux-arm64-gnu': 1.4.13 - '@swc/core-linux-arm64-musl': 1.4.13 - '@swc/core-linux-x64-gnu': 1.4.13 - '@swc/core-linux-x64-musl': 1.4.13 - '@swc/core-win32-arm64-msvc': 1.4.13 - '@swc/core-win32-ia32-msvc': 1.4.13 - '@swc/core-win32-x64-msvc': 1.4.13 + '@swc/core-darwin-arm64': 1.4.16 + '@swc/core-darwin-x64': 1.4.16 + '@swc/core-linux-arm-gnueabihf': 1.4.16 + '@swc/core-linux-arm64-gnu': 1.4.16 + '@swc/core-linux-arm64-musl': 1.4.16 + '@swc/core-linux-x64-gnu': 1.4.16 + '@swc/core-linux-x64-musl': 1.4.16 + '@swc/core-win32-arm64-msvc': 1.4.16 + '@swc/core-win32-ia32-msvc': 1.4.16 + '@swc/core-win32-x64-msvc': 1.4.16 '@swc/helpers': 0.5.2 '@swc/core@1.4.2(@swc/helpers@0.5.2)': @@ -11563,8 +11472,6 @@ snapshots: '@types/lodash@4.17.0': {} - '@types/long@4.0.2': {} - '@types/mdast@4.0.3': dependencies: '@types/unist': 3.0.2 @@ -11622,8 +11529,6 @@ snapshots: '@types/prop-types@15.7.12': {} - '@types/qs@6.9.14': {} - '@types/qs@6.9.15': {} '@types/range-parser@1.2.7': {} @@ -12019,15 +11924,7 @@ snapshots: '@webassemblyjs/ast': 1.12.1 '@xtuc/long': 4.2.2 - '@xenova/transformers@2.16.1': - dependencies: - '@huggingface/jinja': 0.2.2 - onnxruntime-web: 1.14.0 - sharp: 0.32.6 - optionalDependencies: - onnxruntime-node: 1.14.0 - - '@xenova/transformers@2.17.0': + '@xenova/transformers@2.17.1': dependencies: '@huggingface/jinja': 0.2.2 onnxruntime-web: 1.14.0 @@ -12041,11 +11938,13 @@ snapshots: '@xtuc/long@4.2.2': {} - '@zilliz/milvus2-sdk-node@2.3.5': + '@zilliz/milvus2-sdk-node@2.4.1': dependencies: - '@grpc/grpc-js': 1.8.17 - '@grpc/proto-loader': 0.7.7 + '@grpc/grpc-js': 1.10.6 + '@grpc/proto-loader': 0.7.12 + '@petamoriken/float16': 3.8.6 dayjs: 1.11.10 + generic-pool: 3.9.0 lru-cache: 9.1.2 protobufjs: 7.2.6 winston: 3.13.0 @@ -12265,14 +12164,7 @@ snapshots: arrify@1.0.1: {} - assemblyai@4.3.4: - dependencies: - ws: 8.16.0 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - - assemblyai@4.4.0: + assemblyai@4.4.1: dependencies: ws: 8.16.0 transitivePeerDependencies: @@ -12390,8 +12282,6 @@ snapshots: bare-os: 2.2.1 optional: true - base-64@0.1.0: {} - base64-js@1.5.1: {} batch@0.6.1: {} @@ -12629,8 +12519,6 @@ snapshots: chardet@0.7.0: {} - charenc@0.0.2: {} - check-error@1.0.3: dependencies: get-func-name: 2.0.2 @@ -12668,33 +12556,23 @@ snapshots: chownr@1.1.4: {} - chromadb@1.7.3(cohere-ai@7.9.3(encoding@0.1.13))(encoding@0.1.13)(openai@4.33.0(encoding@0.1.13)): + chromadb@1.7.3(cohere-ai@7.9.5(encoding@0.1.13))(encoding@0.1.13)(openai@4.38.0(encoding@0.1.13)): dependencies: cliui: 8.0.1 isomorphic-fetch: 3.0.0(encoding@0.1.13) optionalDependencies: - cohere-ai: 7.9.3(encoding@0.1.13) - openai: 4.33.0(encoding@0.1.13) + cohere-ai: 7.9.5(encoding@0.1.13) + openai: 4.38.0(encoding@0.1.13) transitivePeerDependencies: - encoding - chromadb@1.7.3(cohere-ai@7.9.4(encoding@0.1.13))(encoding@0.1.13)(openai@4.36.0(encoding@0.1.13)): + chromadb@1.8.1(cohere-ai@7.9.5(encoding@0.1.13))(encoding@0.1.13)(openai@4.38.0(encoding@0.1.13)): dependencies: cliui: 8.0.1 isomorphic-fetch: 3.0.0(encoding@0.1.13) optionalDependencies: - cohere-ai: 7.9.4(encoding@0.1.13) - openai: 4.36.0(encoding@0.1.13) - transitivePeerDependencies: - - encoding - - chromadb@1.8.1(cohere-ai@7.9.4(encoding@0.1.13))(encoding@0.1.13)(openai@4.36.0(encoding@0.1.13)): - dependencies: - cliui: 8.0.1 - isomorphic-fetch: 3.0.0(encoding@0.1.13) - optionalDependencies: - cohere-ai: 7.9.4(encoding@0.1.13) - openai: 4.36.0(encoding@0.1.13) + cohere-ai: 7.9.5(encoding@0.1.13) + openai: 4.38.0(encoding@0.1.13) transitivePeerDependencies: - encoding @@ -12763,17 +12641,7 @@ snapshots: dependencies: rfdc: 1.3.1 - cohere-ai@7.9.3(encoding@0.1.13): - dependencies: - form-data: 4.0.0 - js-base64: 3.7.2 - node-fetch: 2.7.0(encoding@0.1.13) - qs: 6.11.2 - url-join: 4.0.1 - transitivePeerDependencies: - - encoding - - cohere-ai@7.9.4(encoding@0.1.13): + cohere-ai@7.9.5(encoding@0.1.13): dependencies: form-data: 4.0.0 js-base64: 3.7.2 @@ -12977,8 +12845,6 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 - crypt@0.0.2: {} - crypto-random-string@4.0.0: dependencies: type-fest: 1.4.0 @@ -13357,11 +13223,6 @@ snapshots: diff@4.0.2: {} - digest-fetch@1.3.0: - dependencies: - base-64: 0.1.0 - md5: 2.3.0 - dingbat-to-unicode@1.0.1: {} dir-glob@3.0.1: @@ -14314,6 +14175,8 @@ snapshots: functions-have-names@1.2.3: {} + generic-pool@3.9.0: {} + gensync@1.0.0-beta.2: {} get-amd-module-type@3.0.2: @@ -14336,9 +14199,9 @@ snapshots: dependencies: es-errors: 1.3.0 function-bind: 1.1.2 - has-proto: 1.0.1 + has-proto: 1.0.3 has-symbols: 1.0.3 - hasown: 2.0.0 + hasown: 2.0.2 get-own-enumerable-property-symbols@3.0.2: {} @@ -14523,8 +14386,6 @@ snapshots: dependencies: es-define-property: 1.0.0 - has-proto@1.0.1: {} - has-proto@1.0.3: {} has-symbols@1.0.3: {} @@ -14535,10 +14396,6 @@ snapshots: has-yarn@3.0.0: {} - hasown@2.0.0: - dependencies: - function-bind: 1.1.2 - hasown@2.0.2: dependencies: function-bind: 1.1.2 @@ -14885,8 +14742,6 @@ snapshots: call-bind: 1.0.7 has-tostringtag: 1.0.2 - is-buffer@1.1.6: {} - is-callable@1.2.7: {} is-ci@3.0.1: @@ -15111,10 +14966,6 @@ snapshots: js-base64@3.7.7: {} - js-tiktoken@1.0.10: - dependencies: - base64-js: 1.5.1 - js-tiktoken@1.0.11: dependencies: base64-js: 1.5.1 @@ -15263,9 +15114,9 @@ snapshots: rfdc: 1.3.1 wrap-ansi: 9.0.0 - llamaindex@0.2.8(encoding@0.1.13)(node-fetch@2.7.0(encoding@0.1.13))(readable-stream@4.5.2)(typescript@5.4.3): + llamaindex@0.2.9(encoding@0.1.13)(node-fetch@2.7.0(encoding@0.1.13))(readable-stream@4.5.2)(typescript@5.4.3): dependencies: - '@anthropic-ai/sdk': 0.18.0(encoding@0.1.13) + '@anthropic-ai/sdk': 0.20.6(encoding@0.1.13) '@aws-crypto/sha256-js': 5.2.0 '@datastax/astra-db-ts': 0.1.4 '@grpc/grpc-js': 1.10.6 @@ -15279,12 +15130,12 @@ snapshots: '@types/node': 20.12.7 '@types/papaparse': 5.3.14 '@types/pg': 8.11.5 - '@xenova/transformers': 2.17.0 - '@zilliz/milvus2-sdk-node': 2.3.5 + '@xenova/transformers': 2.17.1 + '@zilliz/milvus2-sdk-node': 2.4.1 ajv: 8.12.0 - assemblyai: 4.4.0 - chromadb: 1.7.3(cohere-ai@7.9.4(encoding@0.1.13))(encoding@0.1.13)(openai@4.36.0(encoding@0.1.13)) - cohere-ai: 7.9.4(encoding@0.1.13) + assemblyai: 4.4.1 + chromadb: 1.7.3(cohere-ai@7.9.5(encoding@0.1.13))(encoding@0.1.13)(openai@4.38.0(encoding@0.1.13)) + cohere-ai: 7.9.5(encoding@0.1.13) js-tiktoken: 1.0.11 lodash: 4.17.21 magic-bytes.js: 1.10.0 @@ -15292,7 +15143,66 @@ snapshots: md-utils-ts: 2.0.0 mongodb: 6.5.0 notion-md-crawler: 0.0.2(encoding@0.1.13) - openai: 4.36.0(encoding@0.1.13) + openai: 4.38.0(encoding@0.1.13) + papaparse: 5.4.1 + pathe: 1.1.2 + pdf2json: 3.0.5 + pg: 8.11.5 + pgvector: 0.1.8 + portkey-ai: 0.1.16 + rake-modified: 1.0.8 + replicate: 0.25.2 + string-strip-html: 13.4.8 + wikipedia: 2.1.2 + wink-nlp: 1.14.3 + transitivePeerDependencies: + - '@aws-sdk/credential-providers' + - '@google/generative-ai' + - '@mongodb-js/zstd' + - bufferutil + - debug + - encoding + - gcp-metadata + - kerberos + - mongodb-client-encryption + - node-fetch + - pg-native + - readable-stream + - snappy + - socks + - typescript + - utf-8-validate + + llamaindex@0.2.9(encoding@0.1.13)(node-fetch@2.7.0(encoding@0.1.13))(readable-stream@4.5.2)(typescript@5.4.5): + dependencies: + '@anthropic-ai/sdk': 0.20.6(encoding@0.1.13) + '@aws-crypto/sha256-js': 5.2.0 + '@datastax/astra-db-ts': 0.1.4 + '@grpc/grpc-js': 1.10.6 + '@llamaindex/cloud': 0.0.5(node-fetch@2.7.0(encoding@0.1.13)) + '@llamaindex/env': 0.0.7(@aws-crypto/sha256-js@5.2.0)(pathe@1.1.2)(readable-stream@4.5.2) + '@mistralai/mistralai': 0.1.3(encoding@0.1.13) + '@notionhq/client': 2.2.15(encoding@0.1.13) + '@pinecone-database/pinecone': 2.2.0 + '@qdrant/js-client-rest': 1.8.2(typescript@5.4.5) + '@types/lodash': 4.17.0 + '@types/node': 20.12.7 + '@types/papaparse': 5.3.14 + '@types/pg': 8.11.5 + '@xenova/transformers': 2.17.1 + '@zilliz/milvus2-sdk-node': 2.4.1 + ajv: 8.12.0 + assemblyai: 4.4.1 + chromadb: 1.7.3(cohere-ai@7.9.5(encoding@0.1.13))(encoding@0.1.13)(openai@4.38.0(encoding@0.1.13)) + cohere-ai: 7.9.5(encoding@0.1.13) + js-tiktoken: 1.0.11 + lodash: 4.17.21 + magic-bytes.js: 1.10.0 + mammoth: 1.7.1 + md-utils-ts: 2.0.0 + mongodb: 6.5.0 + notion-md-crawler: 0.0.2(encoding@0.1.13) + openai: 4.38.0(encoding@0.1.13) papaparse: 5.4.1 pathe: 1.1.2 pdf2json: 3.0.5 @@ -15508,12 +15418,6 @@ snapshots: md-utils-ts@2.0.0: {} - md5@2.3.0: - dependencies: - charenc: 0.0.2 - crypt: 0.0.2 - is-buffer: 1.1.6 - mdast-util-directive@3.0.0: dependencies: '@types/mdast': 4.0.3 @@ -16373,20 +16277,7 @@ snapshots: is-docker: 2.2.1 is-wsl: 2.2.0 - openai@4.33.0(encoding@0.1.13): - dependencies: - '@types/node': 18.19.31 - '@types/node-fetch': 2.6.11 - abort-controller: 3.0.0 - agentkeepalive: 4.5.0 - form-data-encoder: 1.7.2 - formdata-node: 4.4.1 - node-fetch: 2.7.0(encoding@0.1.13) - web-streams-polyfill: 3.3.3 - transitivePeerDependencies: - - encoding - - openai@4.36.0(encoding@0.1.13): + openai@4.38.0(encoding@0.1.13): dependencies: '@types/node': 18.19.31 '@types/node-fetch': 2.6.11 @@ -17115,7 +17006,7 @@ snapshots: dependencies: side-channel: 1.0.6 - qs@6.12.0: + qs@6.12.1: dependencies: side-channel: 1.0.6 @@ -18305,7 +18196,7 @@ snapshots: ts-graphviz@1.8.2: {} - ts-node@10.9.2(@swc/core@1.4.13(@swc/helpers@0.5.2))(@types/node@20.12.7)(typescript@5.4.3): + ts-node@10.9.2(@swc/core@1.4.16(@swc/helpers@0.5.2))(@types/node@20.12.7)(typescript@5.4.3): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.9 @@ -18323,9 +18214,9 @@ snapshots: v8-compile-cache-lib: 3.0.1 yn: 3.1.1 optionalDependencies: - '@swc/core': 1.4.13(@swc/helpers@0.5.2) + '@swc/core': 1.4.16(@swc/helpers@0.5.2) - ts-node@10.9.2(@swc/core@1.4.13(@swc/helpers@0.5.2))(@types/node@20.12.7)(typescript@5.4.5): + ts-node@10.9.2(@swc/core@1.4.16(@swc/helpers@0.5.2))(@types/node@20.12.7)(typescript@5.4.5): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.9 @@ -18343,7 +18234,7 @@ snapshots: v8-compile-cache-lib: 3.0.1 yn: 3.1.1 optionalDependencies: - '@swc/core': 1.4.13(@swc/helpers@0.5.2) + '@swc/core': 1.4.16(@swc/helpers@0.5.2) tsconfig-paths@3.15.0: dependencies: