The ML_EMBED_TABLE
routine runs multiple
embedding generations in a batch, in parallel.
In versions older than MySQL 9.2.1, to alter an existing table
or create a new table, MySQL requires you to set the
sql-require-primary-key
system variable to 0
.
This routine is available as of MySQL 9.0.1-u1.
This topic contains the following sections:
To learn about the privileges you need to run this routine, see Required Privileges.
Press CTRL+C to copymysql>CALL sys.ML_EMBED_TABLE('InputTableColumn', 'OutputTableColumn', [options]); options: { JSON_OBJECT('key','value'[,'key','value'] ...) 'key','value': { ['model_id', {'all_minilm_l12_v2'|'minilm'|'multilingual-e5-small'|'cohere.embed-english-v3.0'|'cohere.embed-multilingual-v3.0'}] ['truncate', {true|false}] ['batch_size', BatchSize] ['details_column', ErrorDetailsColumnName] } }
Following are ML_EMBED_TABLE
parameters:
-
InputTableColumn
: specifies the names of the input database, table, and column that contains the text to encode. TheInputTableColumn
is specified in the following format:DBName
.TableName
.ColumnName
.The specified input table can be an internal or external table.
The specified input table must already exist, must not be empty, and must have a primary key.
The input column must already exist and must contain
text
orvarchar
values.The input column must not be a part of the primary key and must not have
NULL
values or empty strings.There must be no backticks used in the
DBName
,TableName
, orColumnName
and there must be no period used in theDBName
orTableName
.
-
OutputTableColumn
: specifies the names of the database, table, and column where the generated embeddings are stored. TheOutputTableColumn
is specified in the following format:DBName
.TableName
.ColumnName
.The specified output table must be an internal table.
If the specified output table already exists, then it must be the same as the input table. And, the specified output column must not already exist in the input table. A new
VECTOR
column is added to the table. External tables are read only. So if input table is an external table, then it cannot be used to store the output.If the specified output table doesn't exist, then a new table is created. The new output table has key columns which contains the same primary key values as the input table and a
VECTOR
column that stores the generated embeddings.There must be no backticks used in the
DBName
,TableName
, orColumnName
and there must be no period used in theDBName
orTableName
.
-
options
: specifies optional parameters as key-value pairs in JSON format. It can include the following parameters:-
model_id
: specifies the embedding model to use for encoding the text. Possible values are:-
multilingual-e5-small
:As of MySQL 9.3.0, used as the default embedding model.
-
As of MySQL 9.2.1, can be used for encoding text in any supported language.
In earlier versions of MySQL, can be used for encoding text or files in supported languages other than English.
This embedding model is available as of MySQL 9.0.1-u1.
-
all_minilm_l12_v2
:In MySQL 9.2.2 and earlier versions, used as the default model embedding.
-
As of MySQL 9.2.1, can be used for encoding text in any supported language.
In earlier versions of MySQL, can be used for encoding text in English only.
-
cohere.embed-english-v3.0
:-
As of MySQL 9.2.1, can be used for encoding text in any supported language.
In earlier versions of MySQL, can be used for encoding text in English only.
This embedding model is available as of MySQL 9.0.1-u1.
-
-
cohere.embed-multilingual-v3.0
:-
As of MySQL 9.2.1, can be used for encoding text in any supported language.
In earlier versions of MySQL, can be used for encoding text in supported languages other than English.
This embedding model is available as of MySQL 9.0.1-u1.
-
To view the lists of available embedding models, see HeatWave In-Database Embedding Models and OCI Generative AI Service Embedding Models. To view the list of supported languages, see Languages.
-
truncate
: specifies whether to truncate inputs longer than the maximum token size. Default value istrue
.batch_size
: specifies the batch size for the routine. This option is supported for internal tables only. Default value is1000
. Possible values are integer values between1
and1000
.-
details_column
: specifies a name for the output table column that is created for adding details of errors encountered for rows that aren't processed successfully by the routine. Ensure that a column by the specified name does not already exist in the table. Default value isdetails
.This option is available as of MySQL 9.3.0.
-
Consider the following input table
demo_db.input_table
:
Create a new database demo_db
and table
input_table
:
Press CTRL+C to copymysql>CREATE DATABASE demo_db; mysql>USE demo_db; mysql>CREATE TABLE input_table (id INT AUTO_INCREMENT, Input TEXT, primary key (id)); mysql>INSERT INTO input_table (Input) VALUES('Describe what is MySQL in 50 words.'); mysql>INSERT INTO input_table (Input) VALUES('Describe Artificial Intelligence in 50 words.'); mysql>INSERT INTO input_table (Input) VALUES('Describe Machine Learning in 50 words.');
Generate embeddings for text stored in
demo_db.input_table.Input
using the
all_minilm_l12_v2
embedding model, and save
the generated embeddings in the output table
demo_db.output_table.Output
:
Press CTRL+C to copymysql>CALL sys.ML_EMBED_TABLE("demo_db.input_table.Input", "demo_db.output_table.Output", JSON_OBJECT("model_id", "all_minilm_l12_v2"));
The output table contains the following fields:
Press CTRL+C to copymysql>DESCRIBE demo_db.output_table; +---------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------+-------+ | id | int | NO | PRI | 0 | | | Output | vector(2048) | YES | | NULL | | | details | json | YES | | NULL | | +---------+--------------+------+-----+---------+-------+
View the contents of the output table:
Press CTRL+C to copymysql>select * from demo_db.output_table; +----+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+ | id | Output | details | +----+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+ | 1 | 0xFF50873DB76340BD6EE860BDDFDB8C3BF8110ABE7569F83B7D91B63D8F5C003D15F996BDAAB8883D702CB4BD322F443A09F70D3EC0D3DEBD8926B03BFF5E363B5F20F53CF07F3BBD1543D5BCDD6E89BDC1F199BD1993BC3A580F1DBDDCC0F93C59B292BD5B0E923C23E3B8BBE6D3D93BAC030BBDFBA616BD4AFDD2BBFEB9B63DE79B003EA72B133D0C940ABDEAF23BBC9A31B1BC824ECD3C0B3A12BDF0B300BD1C1FFCBB9027553CB85E1DBD5A167B3C8655583D639661BD61E3F03C93FF8ABC042845BD27E0B53B0BD57ABDF49919BDB7F0A5BD0352443D0879F23C459938BB712097BCCF8F7DBDB44F12BE6669D0BD839B703D0CB1873D7001153DEE53A23D159ACD39796AEC3C68408C3D7320723D29EF36BD45624ABD84E873BD648428BDA3FED8BBC7D5E33DB13586BC78B185BDA5482F3D8C32E53CCE7712BD85151BBBA49F0BBC468C9C3C8355B4BAB6399C3CF5BB93BDE51C15BD113D78BC14D0563DA56DDEBBBDD23AB9797D4E3CF32D31BDA180113C171087BD62AB2BBDBD2D073D8E1B9EBC428382BD67B22F3DCCE2033D2917BB3C85F680BB95F9433DB4F701BD374159BDDCC97C3D2459E83C44DD8DBD37AD71BDFFD1B0BD5FC958BCAB495C3DFD7017BC440DADBDCFBCCD3D4E96FCBC80997DBD6F43983D5ABE15BD7E29D03D864A34BDA458383D8F6D7E3C6C9F353CFCE913BDB7CD26BCA393643CAA75883D212959BDA801F33C9567DEBC5ACD803DDB4222BD03ED333DA519FA3CE25B07BD288758BDD4AC12BC76C3573B49A9F63CA32547BCACA0BF3C3FDAD83A0FC2E9BC69515DBC81F8773D7ACBC4BA28A3AA3CEE4DA8BDF46CB03C06CDFCBA243DC13CAE87223EFA07043DB55DB4BDCBD021BD04DD8CBC9DEA983D0A55FE3C4ECC7EBB028966BD73EC17BD43DC1DBD0AA3103D9F5285BD0FBC1CBDB53E523BAAC05BBD4C3B5ABDB5520EBD71EC743D8485A73C6D256DBB4002523DB4E69EBD4F3AF7BCC7D633BBA807ABBB82A2C63C0B299CBD1234963DC7AC38BDE3F6433D4BF1353D24F61B3C660544BD8034B7BDC578263DFBCB933D5A6FB2BB26C24D3D4719853D14ADBA3D3C6BB3BCE2A6EDBC03C5C7BDBA65EE3BC93A743DDD7E38BDD3C1A6BDE963193BEFA50B3EC627C1BDC847B13D8C4385B9ED8B9C3B887EC2BAF54748BD54409FBD4E769EBD6C0653BD667AFE3DF2FFADBDB192A23D2103813D98CC83BC3EFD25BCFFC5053C300B4BBD1858693D942C3F3DB885073D790138BD515EEE08569DCC3B04000F3D9204CDBDB736313D3086713C9F9A1C3D04C44FBB2738533D6940303C1C3CC13CEC7D4ABC3AFEB73DD56F993C2D613EB9E95FBDBD62431E3C00D0433C7F40CCBDACF4873B238C063E881AD7BCE31BAF3DFE502DBDE03B9F3CEE0C313B584BA43D5740B13C211BA0BD175BB73C7DC681BC69EFE13C661314BCA7EBC1BCA8BBCB3D8CBD58BDC9CAE7BC50828B3D754587BDDDFE203DAD9D9DBD821DF2BB2DD6F2BCAB3E7CBC173E77BB1185143CECBD493D5E57E1BC74C29BBBF2E2113CEDF6EF3C6AD5DEBCD6F6803C367B7C3DF55190BD1A685E3D11F425BDF468213CFD858BBCF11168BD58E68EBD2FB0B33CAB65A8BD01A262BDD562CD3D047D11BD0B6BA73D415C1F3DBEF309BB6DCF11BD0A66F3BC30AB97BC42FDE73C7544913AC4DAB9BCB8A254BD7D37D53D3C886FBD64C3C83D9EF9653D7326663D72562C3DD5AC16BC91BC3D3DF65B11BD40AEDBBC2C34A2BD9D803FBC60DB7A3DC74E563C0E2A7ABBB664043D3A2B88BDF431B1BDA128423C92CF53BD94C08C0A9249023D4AD9813C7F2FD53C8D91DC3CEA628E3DA6A162BD39FA083DE67A433DB29C733C636E0BBDEAAD173D421E88BCA9E924BDD6E2D93B07BA043DD971D33CD7F9D9BC4AC0FE3B00C5E73C9B9BA2BC39F6CD3D21714C37DBC9A3BC37A5E439B341ED3CD431813C11FA003DF6C0A23DC8A5AA3DCFAFECBC2171623BFE94873D2E4727BD4B4F03BD56F6DEBB423CD5BC8E1EA73C6D25D2BA0FF8DBBC6CBF923CC413373DAD8EB83DD943D33C25B4973C827A213CC33DBC3BF15CDBBC783D733C1792473DA8E8ABBDC109E3BD8DCDC53C5E4B393D7F4DEF3C39D296BDCD8FF93C1702D6BA3E6BFEBC8C06813DCC462DBD9573FEBC57E98F3D234B23BCEFA6FFBC | {"error": null} | | 2 | 0xE4C75E3DA70A91BD0E3A96BB1E29D7BA6B3AD1BD0256763C8A248F3DE7A85B3D758165BD277FCD3DB6F854BDD7B556BC481E213D45FDB1BC89991FBCA3BF133DAC03253DD0E7BD3CF18A77BD4479B3BD7992383CFAF4343D8F18DEBB1B61383CF596C2BD8B1BCA3DEB06143D64753C3DC032283D30121FBD563C47BD149689BCE5DF073E363C9A3CB49996BD2048773CFADE18BDC06883BD464D603C522BF4BC0082F5BC6378BCBDFE603CBCF00FD03CC4C9B13CE5123ABCE66177BD49695ABB475B40BD68CE81BD126601BE78A298BD752A08BD34D3E43C0E2203BC5E2669BD4E38CBBC4D5812BD28184ABD6D9DA0BD29EB8938B209693D578AC03D3284203D45DAD13B82BA0C3D5B25C13C43E0B93C9D754CBDEDB969BC2FACAF3DC488FABCA48026BDFF50C33D739BEF3CB7003A3C7204613DB01B2DBC5B05F53C3462CEBCF5453FBDC35975BD8439C2BCDF1ED43D122D72BD2A506A3C1181ABBD3A699C3D2F9BB73DD9C72ABC2FE70A3D26AB29BD7571933DEA63F3BB702FB33C95309E3D06C796BC8BEDB9BD13771DBDBD38493D45D894BD2309FD3CC46B913C515C7EBD328495BC1FEFF7BBB8BB64BDB7B99BBD2C78D9BC808282BC08B09E3A55CFD83B68FCCF3CE80630BD6205823C412DE5BCDBD483BDD372163DF846A8BC0B2F493DB6B6E5BCE39D813D19BBE23B590FC23D564AA63CEF1C71BDF300B93C6550803D81FC0EBDA818B43C211F22BDE079503D11248DBD732783BD231AB73D1F754C3CE8EF41BDDFFF93BD23D857BD32E0A93C43E306BD7023C53DE4E3423D48ECDABC6DCC243D9376223DC601C7BCDD6B333CFBF0F33C2798D13C14EF853C0BDB37BD7F8ACB3DFD373FBC1C9E1C3DD54A323C73682C3C98CC8F3DD8E0553CFD8C783D1C26133D06E3993D8CCF963D3CF0CFBC29FB3D393A77D9BC394FDE3C7A11C3BCB9C0E4BD3FA74D3C7905843D8309773DEF17973D5B99123D85A5C8BB96A84BBC4BD4113CB2B0863D947F213CD4800DBCC41A9BBC4271F3BD8C3EE23C46DA4A3D13E4E33B852C53BDA4D2C7BC904A8BBC3420B1BB913F90BC57B57F3DE775CD3DDC5E943D7CBDD83C6AD58CBCC7B4E3BDC70E113D2BB9003ED41F89BCD92F8CBD7E699EBD121B2B3D5DA2B5BDC8013EBCDAAB43BC1B0844BCEA6BE0BB6B3789BD2AED28BDDDD743BBA4912ABDACFDA0BC2B1BC2BCD36E523D2ABE223DFE6646BD73BD94BD45F516BC281279BCEB6AEABA3DF5183D873EA13D628397BD68EA4E89780385BD5F80D63BDC84E9BDC1E45E3D2DBC663D91FB5A3DBA0CFBBC09F97B3DE61AD93C253D04BBD358A0BD565B3C3C069683BCCCAC123DAE83ADBD3E7582BBB31708BD3D789FBD7C92F63C748B0C3EA559803D94087B3DCEE91BBD71C58D3C7E827BBDF9A29E3DD13F50BBF36410BB20F8DD3C571AE6BC0AB12C3DDDE7903C05621FBDFDFBF63D0AA483BC1CEB123DAC6D953D80BEB0BD4224CFBC0211ABBD6163263D257709BB9F2E84BD567423BC4299173C3ABD49BB1F8458BC842D85BC57B0093C9EFFB83CA6BC38BB380D8DBA1A05053C2E2792BDC928A53D1B088DBD6F3CA7BB30CD6FBA3E64B23C1BCB5D3D7377F0BB297017BDCA0F143D3BFF9E3D651C55BD4637A13D6BBC2A3D7EB9633C0614FEBC5AD4D3BDE0FEEE3CEA7AA63D0371BD3CFB3C31BDAA8C3ABD1ACA323D4496CBBD7855253D1C51283DB305A23D82FBADBB4DB427BD0062053DEA0C92BD58B72FBDCE895D3CAA4385BDF1FDE6BCEECAD8BB34E1373DCFBFCC3C0BEEA6BDB6DB113C531F7E398D3A39BDF649140A33CD363CCE2DA83C055B953B2C73943D15035BBCE0F6803CD658CCBBF0A84EBD60041CBD80BE4EBDDCDB153D52F70CBC47E12CBCC32BE93DADF2123D3305D03CDC284CBD5429B13CF1CA8FBC2EABA5BCBA5AC73DB30D09BCE4E00ABEC68C9F3CE4EA0ABDD80079BD303DAFBADC6B223C8B81833C3D2155BC2867A2BB901B703D8A4A39BD2A46BE3C3F7FC5BB1244423DA806F8BC916A533D923D85BC1F21F9BCC5CDACBD501BA23D0734D6BCB51988BC3A658B3D15621E3C4C7A0ABD0C0C87BDDC611B3CB26482BD3CE049BDC8A4053D11E31DBD224E6E3DCD27BB3D9924973D5813933C5413BA3B6DFC01BD082EBA3DAC6BE2BC1640A33DCE2682BBEFECB2BD | {"error": null} | | 3 | 0xA8CAE33C4B9EBFBD3AC704BD8F6DBDBC4B24B4BD9747723DF992273DC8ED8F3CC4B384BDB800A53DF07B0ABD181E0ABC70AB4D3D526A88BD0DB6DEBC69EB9B3D932A483D95833B3DC71DB8BC145BBEBD763B073D91A5283D06DB4DBCBAEDB63CE8E7AEBD8652283D0B8D973DE6C4463D2B24E1BB75238EBD14F3BFBC4095513C937BF63D6DAE303CC69E91BD8BD5DBBC61E52EBD805D17BD40CDACBCE0D46F3B530621BCE72CB1BD4EB705BDE2AA573C6B09673D79C486BC46F30A3BA889BABCA88464BD05A146BD83A8E2BDA148C0BD82D492BD49CFB53CF90080BB5A51BFBD19B074BDB7A62D3D6C19FBBC7CB5A0BC92AB5B3CF6CB633C7603603D1E262E3D40F0023D1BFE033C1A23F83C1F36243D7B4798BD5FCD5E3C73F6BD3B322B3CBB7D1400BD0619D33D627900BB00A0353DDBED4C3DD689FABABE8CDD3C05321EBDA486CEBC7160053D3E1B69BB1CA1893C605E9EBD91F02A3D8CCC66BDCAC0353D95AC523DAE7D00BC75CCA6BB14770DBD241D1B3AC3D1A93C0512C3BC7623A33DDB30F5BC4D8A8EBDEB7F093D4E7C913D08008FBDBC495A3D912A083C6D5ECBBCEE89B03CC5BC16BD572847BDCE5FA5BBFCB95EBD4B10D1BC6D87A63C5956F23BA53404BC1F9C18BD98C07C3DDBBD8EBCA71EFFBC0C6536BC3D4296BD8BC1BA3D7AFBDABD1434C93CC0298FBC9573633D6591803C8E7469BD4D2951BBD5D7363D05E7923B6E31E1BCC9B7283C32890D3DABDF2FBDCF471ABD6597E83D570D633C18BDEEBC51A038BD5B882ABD6304DD3C726729BDBBE5A93DA28AAD3DA623273C45731E3DD9E5963D8B5B3BBD167A56BB0BCFE1BBA13B173D8F68163D70F5FBBC49A6693DEC4B02BDF5259FBCDEB7B5BCB624393DBA10A63D10CF2C3C45FE8C3D7FCA7F3CB4CCB73D4746C23D120528BDE24CE8BC547344BD4526CB3CD1220BBDDD8435BD82CC19BD777CDD3D71D9C43C9392AABAF1278C3D84D74CBC2335773C184171BD91E445B90BCCA53C6CBE1EBDFCF552BD76D491BD62DB703C3F31C83DAC93023DEC3C55BD590E14BD43196DBB421EE0BC4D306BBD8EC5D73D72CB683D37882C3DB9441E3CD4F8E3BCB99408BE6821433DE7859D3D84ABF73C92359CBD5FC002BE3D808E3C9CFC5DBD2216ADBC7E47DABC0503053C31A822BC184C10BCA7FD39BD7B96EF3CB972A5BDA36C8F3C28F006BDA64DB43D027EE83B2B6B35BC61699EBD0C44E5BCB4EEA7BDC189CF3B7C61103DB8B8C43CDE3B8ABDC4332309B415E6BD2D8AEA3CD98A54BD55048D3D02292D3DAFF3273D397BFFBC4C8B723DF5FF1D3C7685903CB51051BD6F9CDE3CDC8E81BDD1912F3C2DA8DABDCA905BBB3D43123D8CE3C0BD0E63C53C9DD0E73DD122923D99E4543D5BA340BD592D7A3D4A6E01BD5BB9AE3D797E9EBC12DBEC3B6B4CDD3CD8AC8FBDAC168DBC44B09C3CD3C8B2BC3C52063E484F67BD2D5CF93CA9DFD43DBEDC4EBDA3E768BC4B8F8FBDC7DC373DC574253DEBF3B2BD88A80CBD2F72FCBC7A669BBB4EF52B3DFBAAEBBCDA0AE13C2471933DB319933B33A3103D3FAE9DBCE6DD9F3B8A23083D7A7B9BBD92659A3BF713663CB53E30BDEBA93B3DA5F997BDB5370BBD646C0ABD543B973D5F708FBD23CD413DEE25DA3D5273453D99F32DBD7FE88ABD5EB00FBD1EF4BB3D181A9B3C66C74BBCBF59E0BC4FC22B3C73DE83BDAF386ABC6DDF483C4996D13DB622B8BC61CF90BD9498A43DC2568ABD561FCFBCA01F483CF6B73ABCE7A81BBD524619BC8DF3EB3CDBBA9F3C3ADECABDA8E1623CB7EC0C3C80141EBDD9F20D084145C9BBF081703D423D563D1135943D7548C2BC4773E83B9748BABC7C4DD5BA87AE35BD3BEF71BD0DB18E3D2F95393C294D65BD12BC6C3DE3A23C3D192B633D5BFDCF3A8BE7A23C5176EABB19C910BD604CF33D7AA35B3C3CE2C7BD8C57E83C3738C03CE27C7BBD18B1483D894C933D6806AB3CFBB789BCB766BFBC3301CF3D681487BC4B2F0F3C4EED4DBC53E6463D8A1CFB3CD93C713D3AF508BDB3B9DB3CE2F536BD06C4AF3D92399C3AF0D8BABC21BC5F3D349C5A3DE5C3DFBC3C4F6EBD54A18CBBF711A5BDEF3C1FBD8BB8F73CABEA993DD5FBBC3B0FE3B03CF509F43DF9D719BC0FC878B9E6450E39737BCC3D91DE03BD29E9743D4BC33ABD0B08B5BD | {"error": null} | +----+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+
As of MySQL 9.3.0, the output table generated using the
ML_EMBED_TABLE
routine contains an
additional column for error reporting. In case the routine
fails to generate output for specific rows, details of the
errors encountered and default values used are added for the
rows in this additional column.
As of MySQL 9.2.1, to specify the embedding model used to generate the vector embeddings, the routine adds the following comment for the VECTOR column in the output table:
Press CTRL+C to copy'GENAI_OPTIONS=EMBED_MODEL_ID=EmbeddingModelID'
For example:
Press CTRL+C to copymysql>SHOW CREATE TABLE output_table; +--------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +--------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | output_table | CREATE TABLE `output_table` ( `id` int NOT NULL DEFAULT '0', `Output` vector(2048) NOT NULL COMMENT 'GENAI_OPTIONS=EMBED_MODEL_ID=minilm', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci | +--------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+