diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..13dfa363 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.env +node_modules/ \ No newline at end of file diff --git a/vector-database/nodejs/.env.template b/vector-database/nodejs/.env.template new file mode 100644 index 00000000..5373752f --- /dev/null +++ b/vector-database/nodejs/.env.template @@ -0,0 +1 @@ +OPENAI_API_KEY="your key" \ No newline at end of file diff --git a/vector-database/nodejs/LICENSE b/vector-database/nodejs/LICENSE new file mode 100644 index 00000000..262f93e2 --- /dev/null +++ b/vector-database/nodejs/LICENSE @@ -0,0 +1 @@ +Redis, Inc. proprietary, subject to the Redis Enterprise Software and/or Cloud Services license \ No newline at end of file diff --git a/vector-database/nodejs/README.md b/vector-database/nodejs/README.md index e69de29b..2fd7ae8c 100644 --- a/vector-database/nodejs/README.md +++ b/vector-database/nodejs/README.md @@ -0,0 +1,89 @@ +# Redis VSS + AI Examples in Nodejs + +## Contents +1. [Summary](#summary) +2. [Architecture](#architecture) +3. [Features](#features) +4. [Prerequisites](#prerequisites) +5. [Installation](#installation) +6. [Usage](#usage) +7. [Execution](#execution) + +## Summary +This provides a series of examples of how to use Redis VSS in a Nodejs domain. Both standalone vector searches and +searches in conjunction with generative AI queries are demonstrated. + +## Architecture +![architecture](https://docs.google.com/drawings/d/e/2PACX-1vQlOwYbS5EN29m1Ld2lbZQA16oiB4h1T_x8q0N9_pi8pYNiDQw9igTsP9IZVm1Zje_FQvgag9GJqlaW/pub?w=462&h=268) + + +## Features +- Nodejs source for implementing Redis VSS on hash sets and JSON +- Nodejs source for creating a OpenAI client and executing ChatCompletion and Embedding operations +- Docker compose file to start up a Redis Stack instance. + +## Prerequisites +- Docker +- Nodejs +- [OpenAI key](https://platform.openai.com) + +## Installation +1. Clone this repo. +2. CD to the nodejs directory +3. Create a .env file and add this line: OPENAI_API_KEY="your key" +4. Start up Redis Stack: docker compose up -d +5. Install the node module dependencies as listed in package.json: npm install +6. Execute the node app (app.js) via script from the included package.json: npm start + +## Execution +### Redis Client Connection + ```text +PONG + ``` + ### OpenAI Client Connection + ```text +Pong! + ``` + ### Index Build + ```text +idx1 (FLAT, L2, 1536, FLOAT32, JSON): OK +idx2 (HNSW, COSINE, 1536, FLOAT32, M=48, HASH): OK + ``` +### Data Load +```text +Number of JSON documents loaded: 10 +Number of HASH documents loaded: 10 +``` +### Vector Search Scenario #1 +```text +Scenario: JSON docs, FLAT index, Top 2 KNN, Sports topic input + +key: jsonDoc:6 +content: O'Sullivan commits to Dublin race Sonia O'Sullivan will seek to regain her title at the Bupa Great Ireland Run on 9 April in Dublin. The 35-year-old was beaten into fourth at last year's event, having won it a year earlier. "I understand she's had a solid winter's training down in Australia after recovering from a minor injury," said race director Matthew Turnbull. Mark Carroll, Irish record holder at 3km, 5km and 10km, will make his debut in the mass participation 10km race. Carroll has stepped up his form in recent weeks and in late January scored an impressive 3,000m victory over leading American Alan Webb in Boston. Carroll will be facing stiff competition from Australian Craig Mottram, winner in Dublin for the last two years. + +key: jsonDoc:7 +content: Hansen 'delays return until 2006' British triple jumper Ashia Hansen has ruled out a comeback this year after a setback in her recovery from a bad knee injury, according to reports. Hansen, the Commonwealth and European champion, has been sidelined since the European Cup in Poland in June 2004. It was hoped she would be able to return this summer, but the wound from the injury has been very slow to heal. Her coach Aston Moore told the Times: "We're not looking at any sooner than 2006, not as a triple jumper." Moore said Hansen may be able to return to sprinting and long jumping sooner, but there is no short-term prospect of her being involved again in her specialist event. "There was a problem with the wound healing and it set back her rehabilitation by about two months, but that has been solved and we can push ahead now," he said. "The aim is for her to get fit as an athlete - then we will start looking at sprinting and the long jump as an introduction back to the competitive arena." Moore said he is confident Hansen can make it back to top-level competition, though it is unclear if that will be in time for the Commonwealth Games in Melbourne next March, when she will be 34. "It's been a frustrating time for her, but it has not fazed her determination," he added. +``` +### Vector Search Scenario #2 +```text +Scenario: HASH docs, HNSW index, Hybrid w/Top 2 KNN, Entertainment topic input + +key: hashDoc:3 +content: Slater to star in Broadway play Actor Christian Slater is stepping into the role of Tom in the Broadway revival of The Glass Menagerie. Slater, 35, is replacing actor Dallas Roberts in the Tennessee Williams drama, which opens next month. No reason was given for Roberts' departure. The role will be played by understudy Joey Collins until Slater joins the show. Slater won rave reviews for his recent performance in One Flew Over the Cuckoo's Nest in London's West End. He has also starred in a number of films, including Heathers, Robin Hood: Prince of Thieves and more recently Churchill: The Hollywood Years. Preview performances of The Glass Menagerie will begin at New York's Ethel Barrymore Theatre on Thursday. Philip Rinaldi, a spokesman for the show, said the play's 15 March opening date remains unchanged. The revival, directed by David Leveaux, will also star Jessica Lange as the domineering mother, Amanda Wingfield. +``` +### LLM Question Answering Scenario #1 +```text +Scenario: Ask the LLM a question which is outside of its knowledge base +Prompt: Is Sam Bankman-Fried's company, FTX, considered a well-managed company? + +Response: As an AI language model, I cannot provide a personal opinion. However, FTX has been recognized as one of the fastest-growing cryptocurrency exchanges and has received positive reviews for its user-friendly interface, low fees, and innovative products. Additionally, Sam Bankman-Fried has been praised for his leadership and strategic decision-making, including FTX's recent acquisition of Blockfolio. Overall, FTX appears to be a well-managed company. +``` +### LLM Question Answering Scenario #2 +```text +Scenario: Vectorize the question, search Redis for relevant docs, then provide additional info from Redis to the LLM +Prompt: Using the information delimited by triple hyphens, answer this question: Is Sam Bankman-Fried's company, FTX, considered a well-managed company? + + Context: ---Embattled Crypto Exchange FTX Files for Bankruptcy Nov. 11, 2022 On Monday, Sam Bankman-Fried, the chief executive of the cryptocurrency exchange FTX, took to Twitter to reassure his customers: “FTX is fine,” he wrote. “Assets are fine.” On Friday, FTX announced that it was filing for bankruptcy, capping an extraordinary week of corporate drama that has upended crypto markets, sent shock waves through an industry struggling to gain mainstream credibility and sparked government investigations that could lead to more damaging revelations or even criminal charges. In a statement on Twitter, the company said that Mr. Bankman-Fried had resigned, with John J. Ray III, a corporate turnaround specialist, taking over as chief executive. The speed of FTX’s downfall has left crypto insiders stunned. Just days ago, Mr. Bankman-Fried was considered one of the smartest leaders in the crypto industry, an influential figure in Washington who was lobbying to shape regulations. (abbreviated) --- + +Response: No, FTX is not considered a well-managed company as it has filed for bankruptcy and owes as much as $8 billion to its creditors. The collapse of FTX has also destabilized the crypto industry and sparked government investigations into the company's practices. The bankruptcy filing included FTX, its U.S. arm, and Alameda Research, a trading firm that Mr. Bankman-Fried also founded, and has left investors and customers scrambling to salvage funds. The bankruptcy is a stunning fall from grace for Mr. Bankman-Fried, who was considered one of the smartest leaders in the crypto industry and an influential figure in Washington. +``` \ No newline at end of file diff --git a/vector-database/nodejs/app.js b/vector-database/nodejs/app.js new file mode 100644 index 00000000..475f8bc9 --- /dev/null +++ b/vector-database/nodejs/app.js @@ -0,0 +1,232 @@ +/** + * @fileoverview Redis VSS w/AI integration examples + * + */ + +import { createClient, SchemaFieldTypes, VectorAlgorithms } from 'redis'; +import * as dotenv from 'dotenv'; +import { Configuration, OpenAIApi } from 'openai'; +import fsPromises from 'node:fs/promises'; + +/** + * Creates a Redis client connection and executes the ping command on it. + * @returns {_RedisClientType} + */ +async function redisClient() { + const client = createClient({url: 'redis://localhost:6379'}); + await client.connect(); + const result = await client.ping(); + console.log('*** Redis Connection ***') + console.log(result); + return client; +} + +/** + * Submits a prompt to ChatGPT and returns the response + * @param {OpenAIApi} openai + * @param {string} prompt + * @param {string} model + * @returns {Promise} + */ +async function getCompletion(openai, prompt, model="gpt-3.5-turbo") { + const msg = [{"role": "user", "content": prompt}] + const response = await openai.createChatCompletion({ + model: model, + messages: msg, + temperature: 0 + }); + return response.data.choices[0].message.content; +} + +/** + * Submits text to ChatGPT and returns its embedding (array of floats) + * @param {OpenAIApi} openai + * @param {string} content + * @returns {Promise} + */ +async function getEmbedding(openai, content) { + const response = await openai.createEmbedding({ + model: 'text-embedding-ada-002', + input: content + }); + return response.data.data[0].embedding; +} + +/** + * Opens an OpenAI connection and pings for response + * @returns {Promise} + */ +async function openaiClient() { + const config = new Configuration({apiKey: process.env.OPENAI_API_KEY,}); + const client = new OpenAIApi(config); + const response = await getCompletion(client, 'ping'); + console.log('\n*** OpenAI Connection ***') + console.log(response); + return client; +} + +/** + * Builds 2 different indices in Redis, each with a vector and text field. One index is on vectors stored in + * JSON objects; the other is on vectors stored in hashsets. + * @param {_RedisClientType} redis + * @returns {Promise} + */ +async function buildIndices(redis) { + try { + await redis.ft.dropIndex('idx1'); + await redis.ft.dropIndex('idx2'); + } + catch(err) {}; + + const idx1 = await redis.ft.create('idx1', { + '$.vector': { + type: SchemaFieldTypes.VECTOR, + AS: 'vector', + ALGORITHM: VectorAlgorithms.FLAT, + TYPE: 'FLOAT32', + DIM: 1536, + DISTANCE_METRIC: 'L2' + }, + '$.content': { + type: SchemaFieldTypes.TEXT, + AS: 'content' + } + }, { ON: 'JSON', PREFIX: 'jsonDoc:'}); + + const idx2 = await redis.ft.create('idx2', { + 'vector': { + type: SchemaFieldTypes.VECTOR, + ALGORITHM: VectorAlgorithms.HNSW, + TYPE: 'FLOAT32', + DIM: 1536, + M: 48, + DISTANCE_METRIC: 'COSINE' + }, + 'content': { + type: SchemaFieldTypes.TEXT, + } + }, { ON: 'HASH', PREFIX: 'hashDoc:'}); + + console.log('\n*** Indices Build ***'); + console.log(`idx1 (FLAT, L2, 1536, FLOAT32, JSON): ${idx1}`); + console.log(`idx2 (HNSW, COSINE, 1536, FLOAT32, M=48, HASH): ${idx2}`); +} + +/** + * Loads text files into hash and JSON objects in Redis. The text of each file is vectorized and stored in that hash or + * JSON. + * @param {_RedisClientType} redis + * @param {OpenAIApi} openai + * @returns {Promise} + */ +async function loadData(redis, openai) { + let files = await fsPromises.readdir('./data'); + files = files.filter(file => file.endsWith(('.txt'))); + let i = 0; + + for (const file of files) { + let content = await fsPromises.readFile(`./data/${file}`, { encoding: 'utf8' }); + content = content.replace(/[\r\n]/gm, " "); + const vector = await getEmbedding(openai, content); + + await redis.json.set(`jsonDoc:${i}`, '$', { "content": content, "vector": vector }); + await redis.hSet(`hashDoc:${i}`, { content: content, vector: Buffer.from(new Float32Array(vector).buffer) }); + i++; + } + + console.log('\n*** Data Load ***'); + console.log(`Number of JSON documents loaded: ${i}`); + console.log(`Number of HASH documents loaded: ${i}`); +} + +/** + * Executes 2 different VSS scenarios using 2 different index and object types. + * @param {_RedisClientType} redis + * @param {OpenAIApi} openai + * @returns {Promise} + */ +async function vectorSearch(redis, openai) { + //Vector search scenario #1 + let topic = "Teenager LaShawn Merritt ran the third fastest indoor 400m of all time at the Fayetteville Invitational meeting." + let vector = await getEmbedding(openai, topic); + let result = await redis.ft.search('idx1', '*=>[KNN 2 @vector $query_vec]', { + PARAMS: { query_vec: Buffer.from(new Float32Array(vector).buffer) }, + DIALECT: 2, + SORTBY: { + BY: '__vector_score', + DIRECTIION: 'ASC' + } + }); + console.log('\n*** Vector Search #1 ***'); + console.log('Scenario: JSON docs, FLAT index, Top 2 KNN, Sports topic input'); + for (const doc of result.documents) { + console.log(`\nkey: ${doc.id}`); + console.log(`content: ${doc.value.content}`); + } + + // Vector search scenario #2 + topic = "The History Boys by Alan Bennett has been named best new play in the Critics' Circle Theatre Awards." + vector = await getEmbedding(openai, topic); + result = await redis.ft.search('idx2', '(@content:"Christian Slater")=>[KNN 2 @vector $query_vec]', { + PARAMS: { query_vec: Buffer.from(new Float32Array(vector).buffer) }, + DIALECT: 2, + SORTBY: { + BY: '__vector_score', + DIRECTIION: 'ASC' + } + }); + console.log('\n*** Vector Search #2 ***'); + console.log('Scenario: HASH docs, HNSW index, Hybrid w/Top 2 KNN, Entertainment topic input'); + for (const doc of result.documents) { + console.log(`\nkey: ${doc.id}`); + console.log(`content: ${doc.value.content}`); + } +} + +/** + * Executes a ChatGPT prompt on data that is outside of ChatGPT knowledge cut-off date. Then, the prompt is vectorized + * and Redis is search for relevant documents that provide context. The ChatGTP prompt is then re-executed with that + * additional context. + * @param {_RedisClientType} redis + * @param {OpenAIApi} openai + * @returns {Promise} + */ +async function qna(redis, openai) { + let prompt = "Is Sam Bankman-Fried's company, FTX, considered a well-managed company?"; + + console.log('\n*** AI Q&A #1 ***') + console.log('Scenario: Ask the AI a question which is outside of its knowledge base'); + console.log(`Prompt: ${prompt}`); + console.log(`Response: ${await getCompletion(openai, prompt)}`); + + console.log('\n*** AI Q&A #2 ***') + console.log('Scenario: Vectorize the question, search Redis for relevant docs, then provide additional info from Redis to the AI'); + const vector = await getEmbedding(openai, prompt); + const result = await redis.ft.search('idx1', '*=>[KNN 1 @vector $query_vec]', { + PARAMS: { query_vec: Buffer.from(new Float32Array(vector).buffer) }, + DIALECT: 2, + SORTBY: { + BY: '__vector_score', + DIRECTIION: 'ASC' + } + }); + prompt = `Using the information delimited by triple hyphens, answer this question: Is Sam Bankman-Fried's company, FTX, considered a well-managed company? + + Context: ---${result.documents[0].value.content}---` + console.log(`Prompt: ${prompt}`); + console.log(`\nResponse: ${await getCompletion(openai, prompt)}`); +} + +/** + * Main function that executes all the functions above. + */ +(async () => { + dotenv.config(); + const redis = await redisClient(); + const openai = await openaiClient(); + await buildIndices(redis); + await loadData(redis, openai); + await vectorSearch(redis, openai); + await qna(redis, openai); + await redis.disconnect(); +})(); \ No newline at end of file diff --git a/vector-database/nodejs/data/001.txt b/vector-database/nodejs/data/001.txt new file mode 100644 index 00000000..f4e22427 --- /dev/null +++ b/vector-database/nodejs/data/001.txt @@ -0,0 +1,11 @@ +Ad sales boost Time Warner profit + +Quarterly profits at US media giant TimeWarner jumped 76% to $1.13bn (£600m) for the three months to December, from $639m year-earlier. + +The firm, which is now one of the biggest investors in Google, benefited from sales of high-speed internet connections and higher advert sales. TimeWarner said fourth quarter sales rose 2% to $11.1bn from $10.9bn. Its profits were buoyed by one-off gains which offset a profit dip at Warner Bros, and less users for AOL. + +Time Warner said on Friday that it now owns 8% of search-engine Google. But its own internet business, AOL, had has mixed fortunes. It lost 464,000 subscribers in the fourth quarter profits were lower than in the preceding three quarters. However, the company said AOL's underlying profit before exceptional items rose 8% on the back of stronger internet advertising revenues. It hopes to increase subscribers by offering the online service free to TimeWarner internet customers and will try to sign up AOL's existing customers for high-speed broadband. TimeWarner also has to restate 2000 and 2003 results following a probe by the US Securities Exchange Commission (SEC), which is close to concluding. + +Time Warner's fourth quarter profits were slightly better than analysts' expectations. But its film division saw profits slump 27% to $284m, helped by box-office flops Alexander and Catwoman, a sharp contrast to year-earlier, when the third and final film in the Lord of the Rings trilogy boosted results. For the full-year, TimeWarner posted a profit of $3.36bn, up 27% from its 2003 performance, while revenues grew 6.4% to $42.09bn. "Our financial performance was strong, meeting or exceeding all of our full-year objectives and greatly enhancing our flexibility," chairman and chief executive Richard Parsons said. For 2005, TimeWarner is projecting operating earnings growth of around 5%, and also expects higher revenue and wider profit margins. + +TimeWarner is to restate its accounts as part of efforts to resolve an inquiry into AOL by US market regulators. It has already offered to pay $300m to settle charges, in a deal that is under review by the SEC. The company said it was unable to estimate the amount it needed to set aside for legal reserves, which it previously set at $500m. It intends to adjust the way it accounts for a deal with German music publisher Bertelsmann's purchase of a stake in AOL Europe, which it had reported as advertising revenue. It will now book the sale of its stake in AOL Europe as a loss on the value of that stake. diff --git a/vector-database/nodejs/data/002.txt b/vector-database/nodejs/data/002.txt new file mode 100644 index 00000000..6845d62a --- /dev/null +++ b/vector-database/nodejs/data/002.txt @@ -0,0 +1,60 @@ +Embattled Crypto Exchange FTX Files for Bankruptcy + +Nov. 11, 2022 +On Monday, Sam Bankman-Fried, the chief executive of the cryptocurrency exchange FTX, took to Twitter to reassure his customers: “FTX is fine,” he wrote. “Assets are fine.” + +On Friday, FTX announced that it was filing for bankruptcy, capping an extraordinary week of corporate drama that has upended crypto markets, sent shock waves through an industry struggling to gain mainstream credibility and sparked government investigations that could lead to more damaging revelations or even criminal charges. + +In a statement on Twitter, the company said that Mr. Bankman-Fried had resigned, with John J. Ray III, a corporate turnaround specialist, taking over as chief executive. + +The speed of FTX’s downfall has left crypto insiders stunned. Just days ago, Mr. Bankman-Fried was considered one of the smartest leaders in the crypto industry, an influential figure in Washington who was lobbying to shape regulations. And FTX was widely viewed as one of the most stable and responsible companies in the freewheeling, loosely regulated crypto industry. + +“Here we are, with one of the richest people in the world, his net worth dropping to zero, his business dropping to zero,” said Jared Ellias, a bankruptcy professor at Harvard Law School. “The velocity of this failure is just unbelievable.” + +Now, the bankruptcy has set up a rush among investors and customers to salvage funds from what remains of FTX. A surge of customers tried to withdraw funds from the platform this week, and the company couldn’t meet the demand. The exchange owes as much as $8 billion, according to people familiar with its finances. + +FTX’s collapse has destabilized the crypto industry, which was already reeling from a crash in the spring that drained $1 trillion from the market. The prices of the leading cryptocurrencies, Bitcoin and Ether, have plummeted. The crypto lender BlockFi, which was closely entangled with FTX, announced on Thursday that it was suspending operations as a result of FTX’s collapse. + +Mr. Bankman-Fried was backed by some of the highest-profile venture capital investors in Silicon Valley, including Sequoia Capital and Lightspeed Venture Partners. Some of those investors, facing questions about how closely they scrutinized FTX before they put money into it, have said that their nine-figure investments in the crypto exchange are now essentially worthless. + +The company’s demise has also set off a reckoning over risky practices that have become pervasive in crypto, an industry that was founded partly as a corrective to the type of dangerous financial engineering that caused the 2008 economic crisis. + +“I’m really sorry, again, that we ended up here,” Mr. Bankman-Fried said on Twitter on Friday. “Hopefully this can bring some amount of transparency, trust, and governance.” + +The bankruptcy filing marks the start of what will probably be months or even years of legal fallout, as lawyers try to work out whether the exchange can ever continue to operate in some form and customers demand compensation. FTX is already the target of investigations by the Securities and Exchange Commission and the Justice Department, with investigators focused on whether the company improperly used customer funds to prop up Alameda Research, a trading firm that Mr. Bankman-Fried also founded. + +The bankruptcy filing included FTX, its U.S. arm and Alameda. According to a bare-bones legal filing in U.S. Bankruptcy Court in Delaware, FTX has assets valued between $10 billion and $50 billion, with the size of its liabilities in the same range. The company has more than 100,000 creditors, the filing said. + +The bankruptcy is a stunning fall from grace for the 30-year-old Mr. Bankman-Fried, who cultivated a reputation as a boy genius with a host of endearing quirks, including a habit of sleeping on a beanbag at the office. At one point, he was one of the richest people in the industry, with an estimated fortune of $24 billion. He hobnobbed with actors, professional athletes and former world leaders. + +Mr. Bankman-Fried’s crypto empire had an elaborate structure. The bankruptcy filing lists more than 130 corporate entities affiliated with FTX and Alameda. But as of June, FTX had only about 300 employees, a point of pride for Mr. Bankman-Fried, who said he had resisted calls from venture investors to hire more staff. + +“We told them additional employees added too quickly were net negative,” Mr. Bankman-Fried said on Twitter in June. “They could take it or leave it.” + +Unusually for a major start-up, none of FTX’s investors had seats on the board, which instead consisted of Mr. Bankman-Fried, another FTX executive and a lawyer in Antigua and Barbuda. + +FTX and Alameda were based in the Bahamas, where Mr. Bankman-Fried and a small circle of top executives called most of the shots and lived together in a luxury resort. Officially, Alameda was run by Caroline Ellison, a former trader for the hedge fund Jane Street, but Mr. Bankman-Fried was heavily involved, contributing to the decision-making on big trades, according to a person familiar with the matter. + +In addition to Mr. Bankman-Fried and Ms. Ellison, the circle of executives running FTX included Nishad Singh, FTX’s director of engineering, and Gary Wang, the chief technology officer. Few others had visibility into how the company was run: When the firm collapsed this week, lower-ranking employees were left confused and blindsided, according to people familiar with the matter. Mr. Singh and Ms. Ellison did not respond to requests for comment; Mr. Wang could not immediately be reached. + +As a crypto exchange, FTX provided a marketplace for customers to buy, sell and store a wide range of digital currencies. Most of its revenue stemmed from a risky type of trade — in which crypto investors borrowed money to make huge bets on the future prices of cryptocurrencies — that remains illegal in the United States. But Mr. Bankman-Fried also ran a smaller U.S. affiliate that offered more basic trading options. + +Mr. Bankman-Fried’s problems started over the weekend, when the chief executive of Binance, the largest crypto exchange, suggested publicly that FTX might be on shaky financial footing. A rush of customers tried to withdraw their crypto holdings from the platform, and FTX was unable to meet the demand. + +On Tuesday, Mr. Bankman-Fried said he had struck a deal to sell FTX to Binance. But after reviewing the company’s financial documents, Binance’s chief executive, Changpeng Zhao, pulled out of the agreement, leaving Mr. Bankman-Fried with limited options. + +In calls with investors and messages to employees this week, he apologized repeatedly and stressed that he was working hard to raise money and resolve the situation. But the hole was ultimately too big to fill. + +FTX’s bankruptcy is the latest — and by far the biggest — in a series of bankruptcies that have shaken the crypto world this year. After a market crash in the spring, two crypto lending companies, Celsius Network and Voyager Digital, filed for bankruptcy, kicking off months of legal maneuvering over how their remaining assets should be divided. In an ironic twist, FTX had recently won an auction to buy Voyager’s remaining assets. + +As it enters its own bankruptcy process, FTX will be led by Mr. Ray, who has ample experience managing distressed situations. He helped manage Enron after the collapse of its business in an accounting fraud scandal in 2001. And he helped liquidate the trust of the subprime mortgage company ResCap after its 2012 bankruptcy. + +The bankruptcy proceedings may be only the beginning of Mr. Bankman-Fried’s legal troubles. Federal investigators are examining the relationship between FTX and Alameda, and customers are likely to file lawsuits. + +Mr. Bankman-Fried’s old allies have quickly abandoned him. On Thursday night, the team running the FTX Future Fund, a charitable group that Mr. Bankman-Fried bankrolled, announced that they were resigning. + +“We were shocked and immensely saddened to learn of the recent events at FTX,” they wrote in a statement. “We have fundamental questions about the legitimacy and integrity of the business operations that were funding the FTX Foundation and the Future Fund.” + +Not long ago, Mr. Bankman-Fried was performing a comedy routine onstage at a conference with Anthony Scaramucci, the former White House communications director and a business partner of FTX. + +“I’m disappointed,” Mr. Scaramucci said in an interview on CNBC on Friday. “Duped, I guess, is the right word.” diff --git a/vector-database/nodejs/data/003.txt b/vector-database/nodejs/data/003.txt new file mode 100644 index 00000000..92bb95af --- /dev/null +++ b/vector-database/nodejs/data/003.txt @@ -0,0 +1,7 @@ +Musical treatment for Capra film + +The classic film It's A Wonderful Life is to be turned into a musical by the producer of the controversial hit show Jerry Springer - The Opera. + +Frank Capra's 1946 movie starring James Stewart, is being turned into a £7m musical by producer Jon Thoday. He is working with Steve Brown, who wrote the award-winning musical Spend Spend Spend. A spokeswoman said the plans were in the "very early stages", with no cast, opening date or theatre announced. + +A series of workshops have been held in London, and on Wednesday a cast of singers unveiled the musical to a select group of potential investors. Mr Thoday said the idea of turning the film into a musical had been an ambition of his for almost 20 years. It's a Wonderful Life was based on a short story, The Greatest Gift, by Philip van Doren Stern. Mr Thoday managed to buy the rights to the story from Van Doren Stern's family in 1999, following Mr Brown's success with Spend Spend Spend. He later secured the film rights from Paramount, enabling them to use the title It's A Wonderful Life. diff --git a/vector-database/nodejs/data/004.txt b/vector-database/nodejs/data/004.txt new file mode 100644 index 00000000..4daaf112 --- /dev/null +++ b/vector-database/nodejs/data/004.txt @@ -0,0 +1,7 @@ +Slater to star in Broadway play + +Actor Christian Slater is stepping into the role of Tom in the Broadway revival of The Glass Menagerie. + +Slater, 35, is replacing actor Dallas Roberts in the Tennessee Williams drama, which opens next month. No reason was given for Roberts' departure. The role will be played by understudy Joey Collins until Slater joins the show. Slater won rave reviews for his recent performance in One Flew Over the Cuckoo's Nest in London's West End. + +He has also starred in a number of films, including Heathers, Robin Hood: Prince of Thieves and more recently Churchill: The Hollywood Years. Preview performances of The Glass Menagerie will begin at New York's Ethel Barrymore Theatre on Thursday. Philip Rinaldi, a spokesman for the show, said the play's 15 March opening date remains unchanged. The revival, directed by David Leveaux, will also star Jessica Lange as the domineering mother, Amanda Wingfield. \ No newline at end of file diff --git a/vector-database/nodejs/data/005.txt b/vector-database/nodejs/data/005.txt new file mode 100644 index 00000000..17748d8e --- /dev/null +++ b/vector-database/nodejs/data/005.txt @@ -0,0 +1,15 @@ +Brown ally rejects Budget spree + +Chancellor Gordon Brown's closest ally has denied suggestions there will be a Budget giveaway on 16 March. + +Ed Balls, ex-chief economic adviser to the Treasury, said there would be no spending spree before polling day. But Mr Balls, a prospective Labour MP, said he was confident the chancellor would meet his fiscal rules. He was speaking as Sir Digby Jones, CBI director general, warned Mr Brown not to be tempted to use any extra cash on pre-election bribes. + +Mr Balls, who stepped down from his Treasury post to stand as a Labour candidate in the election, had suggested that Mr Brown would meet his golden economic rule - "with a margin to spare". He said he hoped more would be done to build on current tax credit rules. + +He also stressed rise in interest rates ahead of an expected May election would not affect the Labour Party's chances of winning. Expectations of a rate rise have gathered pace after figures showed house prices are still rising. Consumer borrowing rose at a near-record pace in January. "If the MPC (the Bank of England's Monetary Policy Committee) were to judge that a rate rise was justified before the election because of the strength of the economy - and I'm not predicting that they will - I do not believe that this will be a big election issue in Britain for Labour," he told a Parliamentary lunch. "This is a big change in our political culture." + +During an interview with BBC Radio 4's Today programme, Mr Balls said he was sure Mr Brown's Budget would not put at risk the stability of the economy. "I don't think we'll see a pre-election spending spree - we certainly did not see that before 2001," he said. + +His assurances came after Sir Digby Jones said stability was all important and any extra cash should be spent on improving workers' skills. His message to the chancellor was: "Please don't give it away in any form of electioneering." Sir Digby added: "I don't think he will. I have to say he has been a prudent chancellor right the way through. Stability is the key word - British business needs boring stability more than anything. "We would say to him 'don't increase your public spending, don't give it away. But if you are going to anywhere, just add something to the competitiveness of Britain, put it into skilling our people'. "That would be a good way to spend any excess." + +Mr Balls refused to say whether Mr Brown would remain as chancellor after the election, amid speculation he will be offered the job of Foreign Secretary. "I think that Gordon Brown wants to be part of the successful Labour government which delivers in the third term for the priorities of the people and sees off a Conservative Party that will take Britain backwards," Mr Balls told Today. Prime Minister Tony Blair has yet to name the date of the election, but most pundits are betting on 5 May. diff --git a/vector-database/nodejs/data/006.txt b/vector-database/nodejs/data/006.txt new file mode 100644 index 00000000..9dc86400 --- /dev/null +++ b/vector-database/nodejs/data/006.txt @@ -0,0 +1,7 @@ +'Errors' doomed first Dome sale + +The initial attempt to sell the Millennium Dome failed due to a catalogue of errors, a report by the government's finance watchdog says. + +The report said too many parties were involved in decision-making when the attraction first went on sale after the Millennium exhibition ended. The National Audit Office said the Dome cost taxpayers £28.7m to maintain and sell in the four years after it closed. Finally, a deal to turn it into a sport and entertainment venue was struck. More than £550m could now be returned to the public sector in the wake of the deal to regenerate the site in Greenwich, London. + +The NAO report said that this sale went through because it avoided many of the problems of the previous attempt to sell the Dome. Deputy Prime Minister John Prescott said a good deal had been secured. "Delivery of the many benefits secured through this deal will continue the substantial progress already made at the Millennium Village and elsewhere on the peninsula," he said. But Edward Leigh, who is chairman of the Commons public accounts committee, warned the government would have to work hard to ensure taxpayers would get full benefit from the Dome deal. He said: "This report also shows that the first attempt to sell the Dome proved a complete fiasco. Every arm of government seems to have had a finger in the pie. The process was confused and muddled." He added: "Four years after the Millennium Exhibition closed, the Government finally has a deal to find a use for what has been a white elephant since it closed in a deal that, incredible as it may seem, should bring in some money and provide a benefit for the local area and the country as whole. However, it was more a question of luck that a strong bid turned up after thefirst abortive attempt." NAO head Sir John Bourn said: "In difficult circumstances following the failure of the first competition, English Partnerships and the office of the deputy prime minister have worked hard to get a deal." diff --git a/vector-database/nodejs/data/007.txt b/vector-database/nodejs/data/007.txt new file mode 100644 index 00000000..1047180b --- /dev/null +++ b/vector-database/nodejs/data/007.txt @@ -0,0 +1,5 @@ +O'Sullivan commits to Dublin race + +Sonia O'Sullivan will seek to regain her title at the Bupa Great Ireland Run on 9 April in Dublin. + +The 35-year-old was beaten into fourth at last year's event, having won it a year earlier. "I understand she's had a solid winter's training down in Australia after recovering from a minor injury," said race director Matthew Turnbull. Mark Carroll, Irish record holder at 3km, 5km and 10km, will make his debut in the mass participation 10km race. Carroll has stepped up his form in recent weeks and in late January scored an impressive 3,000m victory over leading American Alan Webb in Boston. Carroll will be facing stiff competition from Australian Craig Mottram, winner in Dublin for the last two years. diff --git a/vector-database/nodejs/data/008.txt b/vector-database/nodejs/data/008.txt new file mode 100644 index 00000000..b2b47ae4 --- /dev/null +++ b/vector-database/nodejs/data/008.txt @@ -0,0 +1,5 @@ +Hansen 'delays return until 2006' + +British triple jumper Ashia Hansen has ruled out a comeback this year after a setback in her recovery from a bad knee injury, according to reports. + +Hansen, the Commonwealth and European champion, has been sidelined since the European Cup in Poland in June 2004. It was hoped she would be able to return this summer, but the wound from the injury has been very slow to heal. Her coach Aston Moore told the Times: "We're not looking at any sooner than 2006, not as a triple jumper." Moore said Hansen may be able to return to sprinting and long jumping sooner, but there is no short-term prospect of her being involved again in her specialist event. "There was a problem with the wound healing and it set back her rehabilitation by about two months, but that has been solved and we can push ahead now," he said. "The aim is for her to get fit as an athlete - then we will start looking at sprinting and the long jump as an introduction back to the competitive arena." Moore said he is confident Hansen can make it back to top-level competition, though it is unclear if that will be in time for the Commonwealth Games in Melbourne next March, when she will be 34. "It's been a frustrating time for her, but it has not fazed her determination," he added. diff --git a/vector-database/nodejs/data/009.txt b/vector-database/nodejs/data/009.txt new file mode 100644 index 00000000..3af3f256 --- /dev/null +++ b/vector-database/nodejs/data/009.txt @@ -0,0 +1,69 @@ +Apple laptop is 'greatest gadget' + +The Apple Powerbook 100 has been chosen as the greatest gadget of all time, by US magazine Mobile PC. + +The 1991 laptop was chosen because it was one of the first "lightweight" portable computers and helped define the layout of all future notebook PCs. The magazine has compiled an all-time top 100 list of gadgets, which includes the Sony Walkman at number three and the 1956 Zenith remote control at two. Gadgets needed moving parts and/or electronics to warrant inclusion. The magazine specified that gadgets also needed to be a "self-contained apparatus that can be used on its own, not a subset of another device". + +"In general we included only items that were potentially mobile," said the magazine. + +"In the end, we tried to get to the heart of what really makes a gadget a gadget," it concluded. The oldest "gadget" in the top 100 is the abacus, which the magazine dates at 190 A.D., and put in 60th place. Other pre-electronic gadgets in the top 100 include the sextant from 1731 (59th position), the marine chronometer from 1761 (42nd position) and the Kodak Brownie camera from 1900 (28th position). The Tivo personal video recorder is the newest device to make the top 10, which also includes the first flash mp3 player (Diamound Multimedia), as well as the first "successful" digital camera (Casio QV-10) and mobile phone (Motorola Startac). The most popular gadget of the moment, the Apple iPod, is at number 12 in the list while the first Sony transistor radio is at number 13. + +Sony's third entry in the top 20 is the CDP-101 CD player from 1983. "Who can forget the crystalline, hiss-free blast of Madonna's Like A Virgin emenating from their first CD player?" asked the magazine. Karl Elsener's knife, the Swiss Army Knife from 1891, is at number 20 in the list. Gadgets which could be said to feature surprisngly low down in the list include the original telephone (23rd), the Nintendo GameBoy (25th), and the Pulsar quartz digital watch (36th). The list also contains plenty of oddities: the Pez sweet dispenser (98th), 1980s toy Tamagotchi (86th) and the bizarre Ronco inside the shell egg scrambler (84th). + +Why worry about mobile phones. Soon they will be subsumed into the PDA's / laptops etc. + +What about the Marine Chronometer? Completely revolutionised navigation for boats and was in use for centuries. For it's time, a technological marvel! + +Sony Net Minidisc! It paved the way for more mp3 player to explode onto the market. I always used my NetMD, and could not go anywhere without it. + +A laptop computer is not a gadget! It's a working tool! + +The Sinclair Executive was the world's first pocket calculator. I think this should be there as well. + +How about the clockwork radio? Or GPS? Or a pocket calculator? All these things are useful to real people, not just PC magazine editors. + +Are the people who created this list insane ? Surely the most important gadget of the modern age is the mobile phone? It has revolutionalised communication, which is more than can be said for a niche market laptop. From outside the modern age, the marine chronometer is the single most important gadget, without which modern transportation systems would not have evolved so quickly. + +Has everyone forgot about the Breville pie maker?? + +An interesting list. Of the electronic gadgets, thousands of journalists in the early 1980s blessed the original noteboook pc - the Tandy 100. The size of A4 paper and light, three weeks on a set of batteries, an excellent keyboard, a modem. A pity Tandy did not make it DOS compatible. + +What's an Apple Powerbook 100 ? It's out of date - not much of a "gadget". Surely it has to be something simple / timeless - the tin opener, Swiss Army Knife, safety razor blade, wristwatch or the thing for taking stones out of horses hooves ? + +It has to be the mobile phone. No other single device has had such an effect on our way of living in such a short space of time. + +The ball point pen has got to be one of the most used and common gadgets ever. Also many might be grateful for the pocket calculator which was a great improvement over the slide rule. + +The Casio pocket calculator that played a simple game and made tinny noises was also a hot gadget in 1980. A true gadget, it could be carried around and shown off. + +All top 10 are electronic toys, so the list is probably a better reflection of the current high-tech obsession than anyhting else. I say this as the Swiss Army Knife only made No 20. + +Sinclair QL a machine far ahead of its time. The first home machine with a true multi-takings OS. Shame the marketing was so bad!!! + +Apple.. a triumph of fashion over... well everything else. + +Utter rubbish. Yes, the Apple laptop and Sony Walkman are classic gadgets. But to call the sextant and the marine chronometer 'gadgets' and rank them as less important than a TV remote control reveals a quite shocking lack of historical perspective. The former literally helped change the world by vastly improving navigation at see. The latter is the seed around which the couch potato culture has developed. No competition. + +I'd also put Apple's Newton and the first Palm Pilot there as the front runners for portable computing, and possibly the Toshiba Libretto for the same reason. I only wish that Vulcan Inc's Flipstart wasn't just vapourware otherwise it would be at the top. + +How did a laptop ever manage to beat off the challenge of the wristwatch or the telephone (mobile or otherwise)? What about radios and TVs? + +The swiss army knife. By far the most useful gadget. I got mine 12 years ago. Still wearing and using it a lot! It stood the test of time. + +Psion Organiser series 3, should be up there. Had a usable qwerty keyboard, removable storage, good set of apps and programmable. Case design was good (batteries in the hinge - a first, I think). Great product innovation. + +The first mobile PC was voted best gadget by readers of...err... mobile PC?! Why do you keep putting these obviously biased lists on your site? It's obviously the mobile phone or remote control, and readers of a less partisan publication would tell you that. + +The Motorola Startac should be Number One. Why? There will be mobile phones long after notebook computers and other gadgets are either gone or integrated in communications devices. + +The Psion series 3c! The first most practical way to carry all your info around... + +I too would back the Sinclair Spectrum - without this little beauty I would never have moved into the world of IT and earn the living that I do now. + +I'd have put the mobile phone high up the list. Probably a Nokia model. + +Sinclair Spectrum - 16k. It plugged into the tv. Games were rubbish but it gave me a taste for programming and that's what I do for a living now. + +I wish more modern notebooks -- even Apple's newest offerings -- were more like the PB100. Particularly disheartening is the demise of the trackball, which has given way to the largely useless "trackpad" which every notebook on the market today uses. They're invariably inaccurate, uncomfortable, and cumbersome to use. + +Congratulations to Apple, a deserved win! diff --git a/vector-database/nodejs/data/010.txt b/vector-database/nodejs/data/010.txt new file mode 100644 index 00000000..3e4bd431 --- /dev/null +++ b/vector-database/nodejs/data/010.txt @@ -0,0 +1,11 @@ +Google's toolbar sparks concern + +Search engine firm Google has released a trial tool which is concerning some net users because it directs people to pre-selected commercial websites. + +The AutoLink feature comes with Google's latest toolbar and provides links in a webpage to Amazon.com if it finds a book's ISBN number on the site. It also links to Google's map service, if there is an address, or to car firm Carfax, if there is a licence plate. Google said the feature, available only in the US, "adds useful links". But some users are concerned that Google's dominant position in the search engine market place could mean it would be giving a competitive edge to firms like Amazon. + +AutoLink works by creating a link to a website based on information contained in a webpage - even if there is no link specified and whether or not the publisher of the page has given permission. + +If a user clicks the AutoLink feature in the Google toolbar then a webpage with a book's unique ISBN number would link directly to Amazon's website. It could mean online libraries that list ISBN book numbers find they are directing users to Amazon.com whether they like it or not. Websites which have paid for advertising on their pages may also be directing people to rival services. Dan Gillmor, founder of Grassroots Media, which supports citizen-based media, said the tool was a "bad idea, and an unfortunate move by a company that is looking to continue its hypergrowth". In a statement Google said the feature was still only in beta, ie trial, stage and that the company welcomed feedback from users. It said: "The user can choose never to click on the AutoLink button, and web pages she views will never be modified. "In addition, the user can choose to disable the AutoLink feature entirely at any time." + +The new tool has been compared to the Smart Tags feature from Microsoft by some users. It was widely criticised by net users and later dropped by Microsoft after concerns over trademark use were raised. Smart Tags allowed Microsoft to link any word on a web page to another site chosen by the company. Google said none of the companies which received AutoLinks had paid for the service. Some users said AutoLink would only be fair if websites had to sign up to allow the feature to work on their pages or if they received revenue for any "click through" to a commercial site. Cory Doctorow, European outreach coordinator for digital civil liberties group Electronic Fronter Foundation, said that Google should not be penalised for its market dominance. "Of course Google should be allowed to direct people to whatever proxies it chooses. "But as an end user I would want to know - 'Can I choose to use this service?, 'How much is Google being paid?', 'Can I substitute my own companies for the ones chosen by Google?'." Mr Doctorow said the only objection would be if users were forced into using AutoLink or "tricked into using the service". diff --git a/vector-database/nodejs/docker-compose.yml b/vector-database/nodejs/docker-compose.yml new file mode 100644 index 00000000..81bb83bc --- /dev/null +++ b/vector-database/nodejs/docker-compose.yml @@ -0,0 +1,5 @@ +services: + redis: + image: redis/redis-stack-server:latest + ports: + - 6379:6379 \ No newline at end of file diff --git a/vector-database/nodejs/package-lock.json b/vector-database/nodejs/package-lock.json new file mode 100644 index 00000000..41c89583 --- /dev/null +++ b/vector-database/nodejs/package-lock.json @@ -0,0 +1,205 @@ +{ + "name": "nodejs", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "nodejs", + "version": "1.0.0", + "license": "See License", + "dependencies": { + "dotenv": "^16.0.3", + "openai": "^3.2.1", + "redis": "^4.6.6" + } + }, + "node_modules/@redis/bloom": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.2.0.tgz", + "integrity": "sha512-HG2DFjYKbpNmVXsa0keLHp/3leGJz1mjh09f2RLGGLQZzSHpkmZWuwJbAvo3QcRY8p80m5+ZdXZdYOSBLlp7Cg==", + "peerDependencies": { + "@redis/client": "^1.0.0" + } + }, + "node_modules/@redis/client": { + "version": "1.5.7", + "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.5.7.tgz", + "integrity": "sha512-gaOBOuJPjK5fGtxSseaKgSvjiZXQCdLlGg9WYQst+/GRUjmXaiB5kVkeQMRtPc7Q2t93XZcJfBMSwzs/XS9UZw==", + "dependencies": { + "cluster-key-slot": "1.1.2", + "generic-pool": "3.9.0", + "yallist": "4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@redis/graph": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@redis/graph/-/graph-1.1.0.tgz", + "integrity": "sha512-16yZWngxyXPd+MJxeSr0dqh2AIOi8j9yXKcKCwVaKDbH3HTuETpDVPcLujhFYVPtYrngSco31BUcSa9TH31Gqg==", + "peerDependencies": { + "@redis/client": "^1.0.0" + } + }, + "node_modules/@redis/json": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@redis/json/-/json-1.0.4.tgz", + "integrity": "sha512-LUZE2Gdrhg0Rx7AN+cZkb1e6HjoSKaeeW8rYnt89Tly13GBI5eP4CwDVr+MY8BAYfCg4/N15OUrtLoona9uSgw==", + "peerDependencies": { + "@redis/client": "^1.0.0" + } + }, + "node_modules/@redis/search": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@redis/search/-/search-1.1.2.tgz", + "integrity": "sha512-/cMfstG/fOh/SsE+4/BQGeuH/JJloeWuH+qJzM8dbxuWvdWibWAOAHHCZTMPhV3xIlH4/cUEIA8OV5QnYpaVoA==", + "peerDependencies": { + "@redis/client": "^1.0.0" + } + }, + "node_modules/@redis/time-series": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-1.0.4.tgz", + "integrity": "sha512-ThUIgo2U/g7cCuZavucQTQzA9g9JbDDY2f64u3AbAoz/8vE2lt2U37LamDUVChhaDA3IRT9R6VvJwqnUfTJzng==", + "peerDependencies": { + "@redis/client": "^1.0.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, + "node_modules/cluster-key-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz", + "integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/generic-pool": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.9.0.tgz", + "integrity": "sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/openai": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/openai/-/openai-3.2.1.tgz", + "integrity": "sha512-762C9BNlJPbjjlWZi4WYK9iM2tAVAv0uUp1UmI34vb0CN5T2mjB/qM6RYBmNKMh/dN9fC+bxqPwWJZUTWW052A==", + "dependencies": { + "axios": "^0.26.0", + "form-data": "^4.0.0" + } + }, + "node_modules/redis": { + "version": "4.6.6", + "resolved": "https://registry.npmjs.org/redis/-/redis-4.6.6.tgz", + "integrity": "sha512-aLs2fuBFV/VJ28oLBqYykfnhGGkFxvx0HdCEBYdJ99FFbSEMZ7c1nVKwR6ZRv+7bb7JnC0mmCzaqu8frgOYhpA==", + "dependencies": { + "@redis/bloom": "1.2.0", + "@redis/client": "1.5.7", + "@redis/graph": "1.1.0", + "@redis/json": "1.0.4", + "@redis/search": "1.1.2", + "@redis/time-series": "1.0.4" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } +} diff --git a/vector-database/nodejs/package.json b/vector-database/nodejs/package.json new file mode 100644 index 00000000..6a74959d --- /dev/null +++ b/vector-database/nodejs/package.json @@ -0,0 +1,18 @@ +{ + "name": "nodejs", + "version": "1.0.0", + "description": "", + "main": "app.js", + "scripts": { + "start": "node app.js" + }, + "keywords": [], + "author": "", + "license": "See LICENSE", + "dependencies": { + "dotenv": "^16.0.3", + "openai": "^3.2.1", + "redis": "^4.6.6" + }, + "type": "module" +}