This section describes how to generate vector embeddings using the
ML_EMBED_ROW
HeatWave GenAI routine.
Vector embeddings are a numerical representation of the text that
capture the semantics of the data and relationships to other data.
You can pass the text string in the routine manually or use data
from tables in your database. To embed multiple rows of text
stored in a table in a single run, you can even
run a batch query.
Using this method, you can create vector embedding tables that you
can use to perform similarity searches using the
DISTANCE()
function, without
setting up a vector store.
This method does not support embedding unstructured data. To learn how to create vector embeddings for unstructured data, see Section 4.4, “Setting Up a Vector Store”.
Review the Requirements.
Connect to your HeatWave Database System.
For Run Batch Queries, add the text that you want to embed to a column in a new or existing table.
To generate a vector embedding using HeatWave GenAI, perform the following steps:
-
To define the text that you want to encode, set the
@text
variable:Press CTRL+C to copySET @text="TextToEncode";
Replace
TextToEncode
with the text that you want to encode. For example:Press CTRL+C to copySET @text="HeatWave GenAI is a feature of HeatWave that lets you communicate with unstructured data in HeatWave using natural-language queries.";
-
To generate a vector embedding for the specified text, pass the text to the embedding model using the
ML_EMBED_ROW
routine:Press CTRL+C to copySELECT sys.ML_EMBED_ROW(@text, JSON_OBJECT("model_id", "EmbeddingModel")) into @text_embedding;
Replace
EmbeddingModel
with ID of the embedding model you want to use. To view the lists of available embedding models, see HeatWave In-Database Embedding Models and OCI Generative AI Service Embedding Models.For example:
Press CTRL+C to copySELECT sys.ML_EMBED_ROW(@text, JSON_OBJECT("model_id", "all_minilm_l12_v2")) into @text_embedding;
The routine returns a
VECTOR
, and this commad stores it in the@text_embedding
variable. -
Print the vector embedding stored in the
@text_embedding
variable:Press CTRL+C to copySELECT @text_embedding;
The output, which is a binary representation of the specified text, looks similar to the following:
Press CTRL+C to copy-----------------------------------------------------+ | 0xEB0FE93C21737D3C4ED2F0BC6DCC06BD0668DBBB15D1ABBBDF3E03BD09DC21BC229512BD06B602BD4824F6BCFFEF70BDFFB53C3D98A2BB3C02E0D63DD3C79BBC8A5B45BD29B32F3C63040DBD17AE91BDECEEED3C3B8A003D05E03CBB42B2203D9F41643D404E4BBDEA4B93BBACED3D3DA0C2C43C8D2B55BCFED9103E280EA93D8424503CEE8A143D7A9BD03C0553AFBD203443BD9276E23C024D15BDE8A6C83D8FD2E9BC401DA33AD661AFBDCA06633CEBB1823D11335C3D14B292BDE38028BB335F273B55BA053D3472BFBDF60A64BD4B91B3BC6039BE3D37A5763DA85A863D4D08363B3F1E6DBD732F74BDA3BA0B3C0B436BBC4E4081BDBD4866BDB4F1AB3C9E0692BCAE0160BB6D782D3DD321B83DC521813DE090D7BD8A96EEBC334FFDBCD0F146BD17217D3DAD8A333C3B427A3DE93EDC3C673712BDE8B21FBC52011A3A3A058A3D0BC534BD8A19AB3B8C1B493C731CB03BDC0894BD6E7180BD44AC2DBC5131B03C108D8B3D61E13FBCB2B69A3C10423B3DFDAC73BD33883A3DEB357E3D3C27363D34599BBD5D9A523D63441D3D95F8EFBC7D74CE3BD420AEBD5A7B313CB1A6BDBCEAFAA53C07A01EBD02FF373D8912B73C4E16D5BD00EC99BD50A0ED3B121129BB44AB1D3D56CA8A3D2BF183BD500A653C37F5B1BB2EEA3DBD443FB13DE5FD6E3C0ACC27BDF4F724BD73EB193D32A2773D37FCA8BDA279D0BA13730EBC94238A3DBD72D13DC3072B3D0FF8F33A8404B53DFFC7983D79FD213DB5A0E7BBDBE31A3D7C7A8DBDFDA55CBA99FEA73D28E9F1BC87C1AD3D7934563BD80E4EBD51ED65BCE5199DBC122A08BD7B35A43B344EADBD07E41C3D028CA13D6385933CB2A623BDA866093DE4BE843D48F772B8A9DA973D152E733D55FF363D56AAC33C0F18703D1F39043D45AB0D3CA7992C3C9053F3BDFE1718BEB199F43C579F8F3D7489B1BDCE51B6BDA864CDBC8BC8B13D681E83BD7EFB0ABD01A5E8BD7B5949BDFAEA713DAADBE7BC417FACBD5050A33D8BBC263C560A3BBD96AC13BD4E5D19BC3691C13D5F78FEBC383990BDED5E65BD12AD23BD139B883CB678763B4A943F3B3CF6DB3CC0FF0B3DC45AA13C00D893BCCC560A3D2EC4EBBABF3F10BD8FE40F3C1FEE8EBD80829B3C10F186BDAA0A1E3D7245EE3CDFB41BBDC0BD08BC209B813D337860BD7D5621BDBD5850BCDEB93B3DD6ED30BD1E526DBBF98F703DB2884ABC35A25B3C9895213C6040EEBC8DA4473C6690083EE09C2EB77D972FBD60B7180A69C488BCAE6529BDF98CABBD175DCA3D85BA56BDE540C73CE677F43CB382C03D4C79A63D10E2163CF3EB3ABDCED222BCFF398BBC9E268BBD669E93BD68A7383CF162293D4E138C3CB3E0C13DB96E243D7DD984BDD3C3ABBC818188BD7DA8593B679E623DADE31D3D01DED53C39277ABD2460B4BC4ABFDEBCA7224EBD5F9C233AB77405BC8B532DBDEE7F15BCFD05C43D1D5E953D1FD8B3BCF1EBED3C1BAC3BBCC9FF2B3D097588BA2F14FB3B5BB6383DF85C71BD7A877A3D2542C3BD53824E3D576B9FBD5C247BBD9AD0C03DEB77F7BCA5804B3DCFF8A7BCBAFF893D6EDBACBDBB20A83C24884BBDDF61C0BD527A92BD4822583D99687EBDFD682DBDE80E65BD717093BC46A3993D6A4F143E15EE8FBC2A81A7BDF811EFBCFBCF883D3F739CBC2BC0863DFBBADDBCC72B823C9B9CE2BC631448BD203017BD853B94BD42BC723D4A1807BBB888753C99A10B3D5390613CAF9E623DC7F5A5BDF4A1653CA17EF6BBBFAC35BC17394BBB3DF39A3D7ACCD83D0DEACCBDEF29C3BC2814633DBD40870BC6CFDE3C759CE9BC754AD03CA0849D3D64CE9B3C5569293CD36D57BDE9A267BA6CFA503D00BB36BDAE16833C01188DBDA0737B3DDB913C3C0FD08FBD8C9DF6BC0D2CE23CFE0771BCC4F6583D9E730EBD6E8CA4BCBECB8C3DE1F09B3B3D4034BBE53806BD92AE80BCF2F8D7BC2385493C679C493DC2324CBD266765BC4FC494BC79364C3D8AB7303DE0E4B8BCBDEF903DCE3DD6BC220727BC589FC2BC22A94DBDAA82983BC78C8F3DCB6AC2BA31089DBCEB49FC3C2510EC3B3F05083D90DDDBBDA1E15ABD80362E3D9936A3BDF401D03C6CDB893DF3684ABDFB2DB7BB76ED95BD03A3FE3C2371B5BDBD5F7EBB1AACF7BB156BE53C1E8A9BBC440E2CBDFF1B99BD |
To encode multiple rows of text strings stored in a table
column, in parallel, use the
ML_EMBED_TABLE
routine. This
method is faster than running the
ML_EMBED_ROW
routine multiple times.
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
.
The ML_EMBED_TABLE
routine is available in
MySQL 9.0.1-u1.
To run the steps in this section, create a new database
demo_db
and table
input_table
:
Press CTRL+C to copyCREATE DATABASE demo_db; USE demo_db; CREATE TABLE input_table (id INT AUTO_INCREMENT, Input TEXT, primary key (id)); INSERT INTO input_table (Input) VALUES('Describe what is MySQL in 50 words.'); INSERT INTO input_table (Input) VALUES('Describe Artificial Intelligence in 50 words.'); INSERT INTO input_table (Input) VALUES('Describe Machine Learning in 50 words.');
To run batch queries using ML_EMBED_TABLE
, perform the following steps:
-
Call the
ML_EMBED_TABLE
routine:Press CTRL+C to copyCALL sys.ML_EMBED_TABLE("InputDBName.InputTableName.InputColumn", "OutputDBName.OutputTableName.OutputColumn", JSON_OBJECT("model_id", "EmbeddingModel"));
Replace the following:
InputDBName
: the name of the database that contains the table column where your input queries are stored.InputTableName
: the name of the table that contains the column where your input queries are stored.InputColumn
: the name of the column that contains input queries.OutputDBName
: the name of the database that contains the table where you want to store the generated outputs. This can be the same as the input database.OutputTableName
: the name of the table where you want to create a new column to store the generated outputs. This can be the same as the input table. If the specified table doesn't exist, a new table is created.OutputColumn
: the name for the new column where you want to store the output generated for the input queries.EmbeddingModel
: ID of the embedding model to use. To view the lists of available embedding models, see HeatWave In-Database Embedding Models and OCI Generative AI Service Embedding Models.
For example:
Press CTRL+C to copyCALL sys.ML_EMBED_TABLE("demo_db.input_table.Input", "demo_db.output_table.Output", JSON_OBJECT("model_id", "all_minilm_l12_v2"));
-
View the contents of the output table:
Press CTRL+C to copySELECT * FROM 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) DEFAULT NULL COMMENT 'GENAI_OPTIONS=EMBED_MODEL_ID=minilm', `details` json DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci | +--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
This lets you use tables generated using this routine for context retrieval while running retrieval-augmented generation (RAG) as well as HeatWave Chat.