Download the PHP package mindfulcoder49/mysql-vector-openai without Composer
On this page you can find all versions of the php package mindfulcoder49/mysql-vector-openai. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mindfulcoder49/mysql-vector-openai
More information about mindfulcoder49/mysql-vector-openai
Files in mindfulcoder49/mysql-vector-openai
Package mysql-vector-openai
Short Description Perform vector operations natively on MySQL using openAI embeddings
License MIT
Informations about the package mysql-vector-openai
Here's a README.md
file that reflects the current functionality of your VectorTable
class.
sql
CREATE TABLE your_table_name_vectors
(
id
INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
vector
JSON, -- The original vector
normalized_vector
JSON, -- The normalized vector
magnitude
DOUBLE, -- The magnitude of the vector
binary_code
BLOB, -- Binary representation of the vector for efficient searching
created
TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB;
sql
CREATE FUNCTION COSIM(v1 JSON, v2 JSON) RETURNS FLOAT DETERMINISTIC
BEGIN
DECLARE sim FLOAT DEFAULT 0;
DECLARE i INT DEFAULT 0;
DECLARE len INT DEFAULT JSON_LENGTH(v1);
IF JSON_LENGTH(v1) != JSON_LENGTH(v2) THEN RETURN NULL; END IF;
WHILE i < len DO
SET sim = sim + (JSON_EXTRACT(v1, CONCAT('$[', i, ']')) * JSON_EXTRACT(v2, CONCAT('$[', i, ']')));
SET i = i + 1;
END WHILE;
RETURN sim;
END;
This README.md
outlines the features, core functionalities, usage examples, and setup instructions for your VectorTable
class. It reflects the current state of your code, including both cosine similarity and Hamming distance-based searches, and explains how to initialize, insert, search, and manage vectors in the MySQL database.
All versions of mysql-vector-openai with dependencies
ext-mysqli Version *
bdelespierre/php-kmeans Version ^2.2
ext-mbstring Version *
ext-intl Version *
symfony/polyfill-intl-normalizer Version ^1.28
symfony/polyfill-mbstring Version ^1.28
ext-ctype Version *
symfony/polyfill-ctype Version ^1.28
ext-iconv Version *
symfony/polyfill-iconv Version ^1.28