Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support together AI #230

Merged
merged 16 commits into from
Feb 20, 2025
Merged

Conversation

threewebcode
Copy link
Contributor

Together AI: https://docs.together.ai/docs/introduction

Example execution:

cargo run --example agent_with_together
Running `target/debug/examples/agent_with_together`
According to the provided attachments, a "glarb-glarb" is an ancient tool used by the ancestors of the inhabitants of planet Jiro to farm the land.

@threewebcode
Copy link
Contributor Author

@cvauclair Could you please review this change set?

@joshua-mo-143 joshua-mo-143 self-requested a review January 29, 2025 22:07
@joshua-mo-143
Copy link
Contributor

Hi @threewebcode , thanks for opening this PR! I'll be having a look over today/tomorrow.

@joshua-mo-143 joshua-mo-143 self-assigned this Feb 4, 2025
@threewebcode
Copy link
Contributor Author

Hi @threewebcode , thanks for opening this PR! I'll be having a look over today/tomorrow.

@joshua-mo-143 Please help review the codes.

@cvauclair cvauclair added this to the 2025-02-24 milestone Feb 10, 2025
Copy link
Contributor

@joshua-mo-143 joshua-mo-143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it looks like the basic example works, which is good.

Can you please fix your tool/embedding implementation? It looks like trying to switch in the together client on the embedding and tool examples totally breaks the examples

@threewebcode
Copy link
Contributor Author

cargo run --example together_embeddings --features="derive"
[(Greetings { message: "Hello, world!" }, OneOrMany { first: Embedding { document: "Hello, world!", vec: [-0.11740354, 0.26279107, 0.41426593, 0.18313019, -0.26873958, -0.20330779, 0.031139802, -0.09057242, -0.18092705, -0.116894126, 0.15841371, 0.07927452, -0.108259566, -0.039442617, -0.06550552, -0.2683548, 0.20659666, -0.1413944, -0.16275455, -0.048185695, 0.110521056, 0.09919632, 0.037056513, 0.09262756, -0.18222469, -0.14062512, 0.13748223, 0.12269319, 0.0705135, -0.08491075, 0.038639303, -0.09183136, -0.105466366, -0.30625987, 0.12048704, 0.065468155, 0.08548964, 0.38496095, -0.13310114, 0.15707646, -0.2298638, 0.25910786, -0.07799479, 0.08622466, 0.101226084, -0.0637708, 0.12811956, -0.10491989, -0.08330918, 0.17066553, 0.11044821, -0.17243294, -0.037474252, 0.05419937, 0.03015584, 0.16551563, 0.073789775, 0.3992646, -0.08829495, 0.37475604, 0.13439049, 0.035373617, 0.101656646, 0.23669182, -0.058321137, -0.14468409, -0.16038899, -0.40308356, -0.29188734, 0.26347846, -0.15517849, 0.11598223, 0.0672086, -0.029677982, -0.16684145, -0.0664978, 0.086131044, -0.10922916, 0.03218168, 0.047418147, 0.026514513, 0.2476813, 0.20901956, -0.10963565, -0.24136348, -0.13763082, -0.090389475, -0.04018596, -0.08107418, -0.2521793, -0.29700083, 0.09206898, 0.14294875, 0.079251796, 0.03387643, 0.010124497, 0.20713933, -0.13803512, 0.059846424, 0.14540307, -0.23804933, -0.021881916, -0.022494042, -0.1328991, -0.23787268, -0.006230167, -0.2555986, -0.03743934, -0.087138355, 0.12686466, -0.0629558, -0.080727525, 0.019096531, -0.053511605, -0.043896157, 0.21274832, 0.079524726, -0.026999557, -0.018037338, -0.14699684, 0.088035055, 0.107976325, -0.025099855, -0.058621775, -0.30136523, -0.039602168, -0.17678365, 0.036349148, -0.059592593, -0.2563274, -0.36271906, 0.24390343, -0.16657704, 0.25642493, 0.19252491, 0.03267488, -0.012097908, 0.12960257, 0.1684257, 0.012044713, 0.00833866, -0.06356884, 0.12109081, -0.020809421, 0.023349777, -0.090819314, -0.05315657, 0.15789875, -0.13093105, 0.1573576, -0.17789261, -0.06766987, -0.19134971, -0.06658727, 0.06461151, 0.09208483, -0.14266752, -0.021203434, 0.063363716, -0.0768683, -0.12350186, 0.041038018, 0.14627892, 0.14128874, 0.15880306, 0.24417667, 0.16151954, -0.10937447, -0.24091227, -0.05237824, -0.103911795, 0.08125828, -0.12442517, 0.24972165, -0.03900618, -0.20854038, 0.054251295, 0.07326185, -0.13825086, -0.1441118, -0.082596876, -0.026589999, 0.13204725, -0.100564025, -0.08932892, 0.09516718, 0.04806509, -0.1472911, 0.08631011, 0.17938788, -0.22228268, -0.300236, -0.005030298, 0.07810031, 0.09092014, -0.06322584, 0.10663498, -0.080466, 0.11189502, -0.10818508, -0.051168606, 0.14397386, -0.13272758, -0.08394779, -0.11536417, 0.00051143265, 0.14319582, 0.10457539, -0.03902887, -0.14119127, -0.1315437, -0.1640659, 0.018071797, -0.30526075, 0.12527665, 0.040185284, -0.12377234, -0.24042203, -0.13327979, 0.009943547, 0.008765236, 0.16681924, 0.17494996, -0.11905465, 0.1534044, 0.046060897, 0.20399883, -0.18731746, -0.110356934, -0.26638457, 0.1461662, -0.11839184, -0.10535637, -0.026304917, 0.3285014, 0.08852766, 0.03889921, 0.030766677, -0.08909689, 0.44999787, -0.12453124, -0.123694114, 0.14747868, 0.07807734, 0.10104016, -0.23371199, -0.036381114, 0.26271245, -0.044311937, -0.22822167, -0.018543756, 0.006243145, 0.019823715, 0.14279063, 0.13931039, -0.29222807, -0.047587194, 0.24006698, -0.31686094, 0.112756625, 0.136798, -0.20002873, -0.15850523, -0.1485438, -0.111844935, -0.03532249, 0.031852275, 0.15501387, -0.12257364, -0.15581979, -0.16419615, 0.29242364, 0.00830344, -0.27936336, -0.10817711, 0.0033374059, -0.13631967, -0.023647767, -0.07478237, -0.2820921, -0.07006253, 0.39305168, -0.00026930764, -0.1071709, 0.011191976, -0.12183345, 0.100817285, -0.29975215, 0.10053168, -0.022386817, 0.20079124, 0.06353148, -0.012893725, 0.056960832, 0.08634906, 0.2828168, -0.07836986, 0.07001408, -0.16726865, 0.010731221, 0.20798455, 0.10289874, -0.18814887, -0.2540348, 0.06487513, -0.3899447, 0.033955723, -0.08208919, 0.08234662, -0.13513274, 0.026685236, 0.029129203, -0.106405094, -0.044110283, -0.055631086, -0.057137504, 0.17141418, 0.09196874, -0.032642514, 0.027708903, 0.030816892, -0.056343324, -0.08310488, -0.25924104, 0.189395, -0.09958994, -0.19727486, 0.25552806, 0.06778864, 0.1538238, 0.017717876, 0.061883323, -0.0761173, 0.10805258, -0.22926039, 0.21482389, -0.06528036, -0.13225448, -0.05917541, -0.10603949, -0.12637433, -0.0209691, 0.0031248855, -1.6011734e-5, -0.1271423, -0.071244664, -0.011901925, -0.060573507, -0.10050052, 0.048883293, -0.00902537, 0.011086427, 0.013934548, 0.18372127, 0.2661884, -0.11625224, 0.08790147, -0.17844929, -0.19847645, -0.053037588, -0.24441795, -0.035553932, 0.41710776, -0.07830013, 0.1277553, -0.18420312, -0.0739251, -0.0672149, 0.08272062, -0.107365556, -0.019294925, 0.1523367, 0.11160278, -0.06540633, 0.19167985, 0.020031618, 0.071111165, 0.06463924, 0.14961164, -0.05016949, -0.025088087, 0.08850958, 0.22916007, -0.080568284, 0.18891853, -0.124476165, -0.23375674, 0.25187153, 0.029670203, 0.07991627, -0.12941673, -0.20681345, -0.2127296, -0.07670646, -0.077584915, -0.16256836, 0.26304832, -0.33267534, -0.042137057, 0.2167053, 0.018327657, -0.023268702, -0.0654521, 0.09690257, -0.10881642, 0.14219508, -0.059375264, -0.2011987, -0.08156421, 0.030300185, 0.2043083, 0.07425809, 0.03320514, 0.10304685, -0.0019034108, 0.043276217, -0.2600304, -0.25036463, 0.21257591, 0.086498454, -0.21643719, -0.18638447, -0.054403618, -0.04585529, -0.23414443, 0.004874724, 0.16371007, -0.16166629, -0.13121511, 0.17238596, -0.043614525, 0.24079013, -0.16518325, 0.07114147, 0.12548326, 0.13751799, 0.2878421, -0.0022797564, 0.18833749, -0.25253367, 0.06601298, -0.15458257, 0.04468133, -0.21566588, -0.15316117, 0.08006974, -0.025742441, 0.08571866, -0.02680839, 0.27314293, -0.33312842, 0.06802122, -0.23000985, -0.07933063, -0.13645495, -0.17779514, -0.23931181, -0.20722978, -0.057232462, 0.041745115, -0.052382495, -0.17116079, 0.15428303, 0.18140681, 0.058665514, 0.057013344, -0.16199994, 0.28885517, -0.0035851256, -0.06605676, 0.032490242, -0.2504132, -0.0127925, 0.054757226, 0.18691891, 0.09463307, 0.0073787495, -0.07693088, -0.00390765, -0.04645284, 0.1919392, -0.1417025, 0.13788332, -0.056504454, 0.21627732, 0.11590124, -0.10356642, 0.11984295, -0.1148354, -0.23372354, 0.09504035, -0.14786798, 0.124375865, 0.14449511, -0.18979636, -0.11030902, -0.014062279, 0.014339393, 0.20622277, -0.17785712, -0.03798862, 0.076688714, -0.12500139, -0.044044964, -0.08791682, 0.25095028, 0.3461995, 0.06575098, 0.10777069, -0.029433059, -0.04686772, 0.28059596, -0.012035245, 0.039190665, 0.35409918, 0.09625813, -0.013390322, 0.056121815, 0.12522829, -0.10898058, -0.19369599, 0.063008614, -0.083861604, -0.07499236, -0.39539978, 0.06036367, 0.17519216, 0.0045047845, -0.19804466, 0.20122567, 0.028514318, -0.13786907, -0.08502614, 0.0010247369, 0.20460483, -0.07943926, 0.24130033, -0.058214568, 0.1860173, -0.08938558, -0.039946713, -0.07634051, 0.02237255, 0.15428141, 0.15033709, 0.18168554, -0.062713616, -0.016945243, -0.016089495, 0.11878994, 0.2988257, 0.021384044, 0.043342125, 0.009250658, -0.0027690912, 0.024525154, 0.1530921, -0.20938559, 0.124846175, -0.1991854, 0.042838447, 0.028258033, -0.11686285, 0.005499081, -0.06546222, 0.079323485, -0.03417224, 0.17601961, 0.20672233, -0.09816288, -0.21888825, -0.047217336, -0.020977747, -0.22539108, -0.2966238, 0.09497751, -0.06797251, -0.26482373, 0.044146765, -0.110984415, -0.00670989, 0.11733945, -0.14986554, -0.19478913, 0.038169406, 0.007815222, 0.09159502, 0.20917624, 0.0031761306, -0.16634782, 0.12622389, -0.101655565, 0.15097266, 0.21940765, -0.16622269, -0.26429135, -0.22996867, 0.35147318, 0.16125473, -0.108126, 0.05648805, 0.044177562, 0.09406001, -0.19313376, 0.031994946, -0.256451, 0.08766847, -0.1787597, 0.13312568, 0.19512133, 0.1537591, 0.022689326, 0.0591982, -0.035865627, -0.038406223, -0.04146836, -0.19170848, -0.29197198, -0.12021737, -0.244649, 0.24887, -0.16016309, -0.18692027, -0.12875311, -0.2647955, -0.16768867, 0.06578473, 0.079108715, 0.035654288, -0.18370388, 0.2581306, -0.023655044, 0.0009435384, -0.1159737, 0.12261216, 0.13659613, 0.0564596, -0.027227394, 0.018385563, -0.25568187, -0.30527318, -0.23472768, -0.3027975, -0.47108567, 0.25357512, -0.10458239, 0.1549091, 0.07975585, 0.09240553, -0.36513087, 0.040095508, -0.13647635, -0.21110153, -0.10445946, 0.10127719, 0.11280574, 0.093827434, -0.2800657, 0.08792899, 0.09102897, 0.12552047, -0.052052926, -0.1724393, -0.10967313, 0.2114153, -0.12662905, 0.09145808, 0.053700935, 0.18806048, -0.090753004, -0.08935728, 0.14979704, 0.0666072, -0.15775664, -0.16251677, 0.12257943, -0.012246121, -0.11077853, 0.044814263, -0.28193513, -0.047776982, 0.10363925, 0.13889661, -0.055517454, 0.06319953, -0.13646013, -0.13920681, -0.11814719, 0.17948838, -0.06694644, -0.17554636, -0.014014765, 0.28320894, -0.1996705, -0.1661952, -0.0967934, 0.08903691, 0.08082937, -0.23134242, -0.059660956, 0.15297875, 0.0041468493, -0.1385079, -0.008178845, -0.29556274, -0.0020233723, 0.016285637, -0.017401712, -0.3076995, 0.23974822, 0.080831066, 0.0027835958, -0.15915751, -0.34619668, -0.08455766, 0.0029312996, 0.149642, 0.21761285, -0.02169739, 0.07758429, 0.0751422, -0.268478, 0.17256372, -0.023439849, 0.28496918, 0.15898272, -0.07139314, -0.32657713, 0.0042494643, -0.074892126, -0.1394692, 0.12735578, 0.34235084, -0.059386007, 0.28556705, 0.10230322, -0.048093457, 0.2058367, -0.28044638, 0.04867599, 0.011635781, 0.15016028, 0.026212249, -0.2688328, 0.012751473, 0.21860437, -0.14084226, -0.09056213, 0.09558134, 0.03765245, 0.048638586, 0.078490265, 0.2979326, -0.08681702, -0.04413475, -0.05743938, 0.19477718, -0.07890432, 0.21063215, -0.031838153, -0.072977245, 0.033847157, 0.07894819, 0.19797209, -0.0156115135, 0.14527576, 0.10825275, -0.008077005] }, rest: [] }), (Greetings { message: "Goodbye, world!" }, OneOrMany { first: Embedding { document: "Goodbye, world!", vec: [-0.10222649, 0.25122336, 0.41003218, 0.18778425, -0.25974557, -0.22023214, 0.023547573, -0.094044685, -0.18247908, -0.09655758, 0.1803918, 0.073939286, -0.1372925, -0.03884867, -0.07903388, -0.28284937, 0.22893095, -0.138916, -0.17618805, -0.04472641, 0.10815139, 0.1000413, 0.03747693, 0.0979705, -0.19667846, -0.11590048, 0.1152343, 0.10970558, 0.08807254, -0.07530162, 0.03354575, -0.09552581, -0.112661175, -0.32416472, 0.11499421, 0.09129696, 0.086198516, 0.38038385, -0.12780644, 0.1494754, -0.23755832, 0.26679492, -0.098532446, 0.07622594, 0.10200695, -0.052149627, 0.13222124, -0.12690538, -0.086526334, 0.14091597, 0.12060369, -0.17738824, -0.048685934, 0.044699717, 0.031586047, 0.18289062, 0.07996538, 0.40492505, -0.08545743, 0.37287682, 0.12599447, 0.024366321, 0.09020844, 0.24066818, -0.030241227, -0.14765662, -0.16050507, -0.42193308, -0.27531248, 0.27590355, -0.15197317, 0.11841984, 0.075331345, -0.0132201305, -0.164403, -0.06903447, 0.1025889, -0.11110481, 0.042787883, 0.04871587, 0.014925758, 0.25351062, 0.20212585, -0.10624659, -0.26410398, -0.12187915, -0.07960172, -0.02890566, -0.08227209, -0.27089167, -0.31152147, 0.070464276, 0.15139222, 0.07718832, 0.045809, 0.038447052, 0.23939101, -0.15101093, 0.034787536, 0.17987482, -0.25291416, -0.03535473, -0.044817664, -0.1271261, -0.2626845, -0.0002347544, -0.22764051, -0.027850827, -0.09616325, 0.13055909, -0.059726432, -0.07177249, 0.0063996613, -0.04407458, -0.022041349, 0.22485526, 0.0896514, -0.02684735, -0.05155013, -0.13634412, 0.11327606, 0.08326546, -0.010453472, -0.06323975, -0.2897989, -0.055767518, -0.17014988, 0.05248214, -0.05456408, -0.27126697, -0.37026048, 0.25378236, -0.16445635, 0.27407703, 0.19685028, 0.030901903, 0.002098732, 0.11596648, 0.17217718, -0.004710948, 0.007509573, -0.058005437, 0.12284216, -0.013349132, 0.03327345, -0.0734245, -0.030953085, 0.15295029, -0.12510474, 0.15748811, -0.1476292, -0.06726612, -0.19244035, -0.064667754, 0.060075436, 0.099677764, -0.15734492, -0.030411126, 0.060921762, -0.08618446, -0.13333915, 0.040067315, 0.11771792, 0.13201761, 0.15527043, 0.25097126, 0.15078248, -0.11704178, -0.2528161, -0.071869336, -0.1087963, 0.060420886, -0.10124548, 0.2636117, -0.020635083, -0.2038991, 0.03728747, 0.08840878, -0.15189007, -0.16175936, -0.079816274, -0.026349619, 0.13129956, -0.11673176, -0.10530301, 0.077300705, 0.054561127, -0.14484085, 0.06400599, 0.18688516, -0.22117682, -0.29049718, -0.046420433, 0.10183754, 0.09341709, -0.05621844, 0.09583609, -0.10354045, 0.14063114, -0.07899683, -0.08416687, 0.14668742, -0.13953747, -0.095191576, -0.110965535, -0.0029177445, 0.14080714, 0.09673726, -0.02190301, -0.15754287, -0.12292191, -0.14767487, 0.037441727, -0.3189949, 0.11978961, 0.030654073, -0.11036855, -0.25989145, -0.14199741, 0.015237249, 0.0072579365, 0.17203079, 0.18516998, -0.12115078, 0.1513252, 0.03666752, 0.19853306, -0.20243017, -0.12918448, -0.2854086, 0.1421024, -0.0986534, -0.1280663, -0.02077684, 0.32001668, 0.08817115, 0.03531885, 0.048386633, -0.09896047, 0.4408198, -0.12353801, -0.12094669, 0.15246345, 0.06374891, 0.08263669, -0.26241508, -0.041304674, 0.2947124, -0.046772458, -0.22077386, -0.01736736, 0.00083907024, 0.033331778, 0.15960702, 0.15185253, -0.27962133, -0.048371784, 0.23302375, -0.32367432, 0.10264637, 0.13082257, -0.19709292, -0.16463591, -0.13430183, -0.11355188, -0.04001966, 0.028602295, 0.14377163, -0.11607901, -0.17085549, -0.17203881, 0.30377725, 0.008871524, -0.2656768, -0.10734455, 0.0002856307, -0.14567001, -0.023004234, -0.08770148, -0.27101097, -0.072393976, 0.38540834, 0.016288362, -0.12573884, 0.004216008, -0.117424466, 0.10585287, -0.29645476, 0.08771202, -0.01469635, 0.2115073, 0.061904255, -0.024272194, 0.03437704, 0.07328416, 0.30110812, -0.079280265, 0.062588856, -0.17925131, 0.022555662, 0.2342517, 0.11613223, -0.18566012, -0.24210247, 0.08861716, -0.38643625, 0.06064206, -0.0961752, 0.090309545, -0.112120755, 0.020235218, 0.020447733, -0.10227648, -0.051709253, -0.03693643, -0.087869324, 0.16537039, 0.09685961, -0.049320746, 0.041107126, 0.023586411, -0.05469302, -0.07250907, -0.27713397, 0.20647229, -0.08990832, -0.19746985, 0.254412, 0.060992908, 0.14550701, 0.0022238302, 0.05715665, -0.07580374, 0.093582116, -0.23964238, 0.21172716, -0.064236075, -0.1267168, -0.034607228, -0.0999892, -0.13913801, -0.021656565, 0.0048504416, -0.004855297, -0.14050184, -0.05827644, -0.021044461, -0.047686245, -0.11921755, 0.022361498, -0.013127105, 0.023640027, 0.0073992643, 0.20030576, 0.25863415, -0.124260105, 0.112509705, -0.17126168, -0.19739954, -0.05904986, -0.24040928, -0.034878615, 0.42668483, -0.040153924, 0.12352178, -0.16653982, -0.07208342, -0.07112443, 0.06974786, -0.092366196, -0.04690801, 0.16308361, 0.116749495, -0.058665402, 0.18876481, -0.008307094, 0.08233686, 0.084031515, 0.1522372, -0.0727647, -0.032252748, 0.103459075, 0.23940045, -0.09078262, 0.19610195, -0.11785975, -0.22254643, 0.25034472, 0.030924378, 0.062113706, -0.10423173, -0.1794601, -0.20103194, -0.05269476, -0.090018876, -0.15303747, 0.27829292, -0.3418751, -0.033990648, 0.20151727, 0.042995177, -0.02996816, -0.08624937, 0.08740334, -0.132739, 0.14523534, -0.070224054, -0.19663885, -0.074958436, 0.04259271, 0.17071478, 0.086179174, 0.03515326, 0.10290437, -0.014702339, 0.051467102, -0.26592952, -0.2650389, 0.20028773, 0.10280223, -0.21312584, -0.18795738, -0.048825566, -0.027483677, -0.23637678, -0.024175905, 0.15157269, -0.1886037, -0.12717535, 0.19496562, -0.05390881, 0.23728226, -0.17632514, 0.08177025, 0.13495803, 0.15677981, 0.2976408, 0.019433957, 0.1921445, -0.23775499, 0.078905396, -0.14418043, 0.048242167, -0.21555223, -0.16142298, 0.07586267, -0.023249082, 0.0773833, -0.022459902, 0.2612582, -0.3151982, 0.0683932, -0.21822605, -0.0915763, -0.119686976, -0.17579484, -0.24849437, -0.20159805, -0.06511446, 0.058134213, -0.077675186, -0.1649217, 0.18004969, 0.19027449, 0.05225994, 0.07203143, -0.16567929, 0.28016323, 0.0053344495, -0.0805827, 0.026534708, -0.22988194, 0.0007055934, 0.06296144, 0.17695501, 0.09176424, 0.002517542, -0.10006325, 0.00015471468, -0.052886955, 0.19657624, -0.13890794, 0.118643805, -0.06588279, 0.2257736, 0.11445301, -0.103806846, 0.13009198, -0.07543568, -0.24055913, 0.092100084, -0.13646808, 0.11830566, 0.14776704, -0.19773392, -0.108787775, -0.011861765, 0.028517717, 0.20523608, -0.16777834, -0.06261237, 0.065368444, -0.12036951, -0.063436784, -0.097738825, 0.24554488, 0.36440206, 0.070414826, 0.1071878, -0.022250615, -0.033554114, 0.2666371, -0.034862723, 0.031373087, 0.35913143, 0.11467262, -0.032739215, 0.058444068, 0.117473125, -0.10818704, -0.19988054, 0.05011419, -0.09752993, -0.06510837, -0.39821506, 0.052561153, 0.17466742, 0.018490251, -0.18971622, 0.19766289, 0.032802656, -0.15234707, -0.08789311, 0.018537223, 0.2055679, -0.087247774, 0.22165245, -0.040345732, 0.21220884, -0.10020028, -0.07268228, -0.08807426, 0.0089331735, 0.12955189, 0.121947415, 0.1983469, -0.06412542, -0.004083326, -0.041929867, 0.12313668, 0.2853684, 0.019436477, 0.056942135, 0.0077306693, 0.010718053, 0.010708668, 0.18171695, -0.21367736, 0.11738794, -0.19987093, 0.05287438, 0.053771965, -0.11643905, -0.0006987889, -0.07721532, 0.07020351, -0.010196885, 0.18227021, 0.20344622, -0.10820281, -0.25192428, -0.055064365, -0.039338503, -0.2182733, -0.28325462, 0.0891292, -0.064439036, -0.26439992, 0.05706159, -0.106143735, -0.006593219, 0.10684171, -0.16315633, -0.2067782, 0.01191962, 0.024227405, 0.10702525, 0.20601776, 0.016794208, -0.17582406, 0.11896612, -0.08833443, 0.13627265, 0.2132169, -0.14261343, -0.27974525, -0.2407849, 0.35126525, 0.15137732, -0.1057004, 0.05911686, 0.05414512, 0.12825574, -0.21812895, 0.032134898, -0.2287719, 0.08607681, -0.18981385, 0.12863295, 0.20771986, 0.15868212, 0.034738827, 0.043824572, 0.0064736595, -0.05738217, -0.053092364, -0.19600664, -0.30050594, -0.11702435, -0.23299359, 0.22346191, -0.15046361, -0.19993864, -0.12861675, -0.2581627, -0.16699621, 0.054541446, 0.09713399, 0.021742413, -0.168932, 0.26074195, -0.02670656, -0.0031857858, -0.10600673, 0.12213573, 0.12518883, 0.049585324, -0.02571102, 0.017774275, -0.23998544, -0.29639527, -0.24728219, -0.30328715, -0.4740077, 0.21479034, -0.117636114, 0.13813591, 0.09821251, 0.085489176, -0.36081663, 0.040579088, -0.13923211, -0.22273506, -0.11192377, 0.10801211, 0.11361867, 0.102845274, -0.2744564, 0.08454469, 0.082332484, 0.11236061, -0.009808128, -0.16633914, -0.11150671, 0.22211364, -0.13301255, 0.0793347, 0.0273989, 0.20595038, -0.09664487, -0.08344447, 0.13065164, 0.056499373, -0.16715284, -0.17274381, 0.1230171, -0.012660396, -0.10714401, 0.03913076, -0.29906335, -0.04816256, 0.11485113, 0.15449683, -0.04776148, 0.054790154, -0.12789975, -0.14882474, -0.105898134, 0.14385848, -0.07292122, -0.21093534, -0.0076982426, 0.2772093, -0.19005664, -0.17737955, -0.11096981, 0.0974598, 0.06959956, -0.23675197, -0.049623832, 0.16871454, 0.006166403, -0.13944185, 0.00012492714, -0.26545075, -0.005036437, 0.04466802, -0.010325288, -0.32129538, 0.22927101, 0.078952886, -0.011640118, -0.158592, -0.34327754, -0.0943176, 0.016204, 0.14727253, 0.20338647, -0.030738432, 0.052257366, 0.07281963, -0.25512975, 0.18178245, -0.013842982, 0.29732567, 0.17330496, -0.05759285, -0.32888365, 0.0065172464, -0.07935891, -0.16353, 0.11562385, 0.34927255, -0.06830281, 0.27838477, 0.09664968, -0.045692097, 0.18902932, -0.28797793, 0.022883074, 0.010040435, 0.13543127, 0.048598032, -0.24512292, -0.024883352, 0.20986974, -0.15663035, -0.108025506, 0.10206272, 0.05562547, 0.049250476, 0.08874526, 0.29991493, -0.076039135, -0.031812698, -0.07841623, 0.2082349, -0.08594059, 0.196746, -0.03913991, -0.06898064, 0.039704632, 0.08432295, 0.17965837, -0.0024265316, 0.16015963, 0.106359266, -0.010358849] }, rest: [] })]

@threewebcode
Copy link
Contributor Author

@joshua-mo-143 Thanks for your kind feedback. I updated codes and please help review again.

Copy link
Contributor

@joshua-mo-143 joshua-mo-143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there is some kind of error with trying to use this PR with tools. Together just returns str.replace() is not a function - don't suppose you have any insight into this?

Otherwise lgtm

@threewebcode
Copy link
Contributor Author

It looks like there is some kind of error with trying to use this PR with tools. Together just returns str.replace() is not a function - don't suppose you have any insight into this?

Otherwise lgtm

Can you remove your current code directory and try it again after cloning it from scratch ?

@joshua-mo-143
Copy link
Contributor

joshua-mo-143 commented Feb 17, 2025

Still doesn't work.

I had a thought: since the openai::Message struct now has the tool_calls field in it, maybe TogetherAI doesn't like it and is spitting the error back out? Their API reference doesn't mention the tool_calls field anywhere in their message input.

To fix this you'll probably need to write your own message struct that implements TryFrom<completion::Message> and then implement TryFrom<T> for the other way around.

Ref docs

The resulting API error can be found below:

Error: CompletionError: ProviderError: {
  "id": "91368a894cbd3634",
  "error": {
    "message": "Template error: (unknown path)\n  TypeError: str.replace is not a function",
    "type": "invalid_request_error",
    "param": "messages",
    "code": null
  }
}

@threewebcode
Copy link
Contributor Author

Still doesn't work.

I had a thought: since the openai::Message struct now has the tool_calls field in it, maybe TogetherAI doesn't like it and is spitting the error back out? Their API reference doesn't mention the tool_calls field anywhere in their message input.

To fix this you'll probably need to write your own message struct that implements TryFrom<completion::Message> and then implement TryFrom<T> for the other way around.

Ref docs

The resulting API error can be found below:

Error: CompletionError: ProviderError: {
  "id": "91368a894cbd3634",
  "error": {
    "message": "Template error: (unknown path)\n  TypeError: str.replace is not a function",
    "type": "invalid_request_error",
    "param": "messages",
    "code": null
  }
}

I merged the latest codes from main branch and rerun the examples code. There is no error here.

 git clone -b feat/together https://github.com/threewebcode/rig.git
 cargo run --example agent_with_together
 cargo run --example together_embeddings --features="derive"

By the way, how to reproduce your error?

@threewebcode
Copy link
Contributor Author

I added tool example and you can have a try.

@joshua-mo-143 joshua-mo-143 self-requested a review February 19, 2025 10:06
Copy link
Contributor

@joshua-mo-143 joshua-mo-143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm - thanks for your hard work on this PR!

@joshua-mo-143 joshua-mo-143 removed their request for review February 20, 2025 22:11
@joshua-mo-143 joshua-mo-143 merged commit f3529ac into 0xPlaygrounds:main Feb 20, 2025
5 checks passed
@github-actions github-actions bot mentioned this pull request Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants