From fbfa5692ae178157291ca3473cb75b296bb83cef Mon Sep 17 00:00:00 2001 From: Toshiaki Takeuchi Date: Wed, 17 Jan 2024 13:47:21 -0500 Subject: [PATCH] Added addToolMessage to openAIMessages AddFunctionMessage was rennamed to addToolMessage, added a new example to the existing MLX and error catalog was also updated. --- +llms/+utils/errorMessageCatalog.m | 3 +- examples/ExampleChatBot.mlx | Bin 4891 -> 5306 bytes examples/ExampleParallelFunctionCalls.mlx | Bin 4387 -> 6313 bytes openAIMessages.m | 59 +++++++++++++++------- papers_to_read.csv | 32 ++++++++++++ startup.m | 2 + 6 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 papers_to_read.csv create mode 100644 startup.m diff --git a/+llms/+utils/errorMessageCatalog.m b/+llms/+utils/errorMessageCatalog.m index 9bddfeb..3791319 100644 --- a/+llms/+utils/errorMessageCatalog.m +++ b/+llms/+utils/errorMessageCatalog.m @@ -38,7 +38,8 @@ catalog("llms:parameterMustBeUnique") = "A parameter name equivalent to '{1}' already exists in Parameters. Redefining a parameter is not allowed."; catalog("llms:mustBeAssistantCall") = "Input struct must contain field 'role' with value 'assistant', and field 'content'."; catalog("llms:mustBeAssistantWithContent") = "Input struct must contain field 'content' containing text with one or more characters."; -catalog("llms:mustBeAssistantWithNameAndArguments") = "Field 'function_call' must be a struct with fields 'name' and 'arguments'."; +catalog("llms:mustBeAssistantWithIdAndFunction") = "Field 'tool_call' must be a struct with fields 'id' and 'function'."; +catalog("llms:mustBeAssistantWithNameAndArguments") = "Field 'function' must be a struct with fields 'name' and 'arguments'."; catalog("llms:assistantMustHaveTextNameAndArguments") = "Fields 'name' and 'arguments' must be text with one or more characters."; catalog("llms:mustBeValidIndex") = "Value is larger than the number of elements in Messages ({1})."; catalog("llms:stopSequencesMustHaveMax4Elements") = "Number of elements must not be larger than 4."; diff --git a/examples/ExampleChatBot.mlx b/examples/ExampleChatBot.mlx index 68d56b93029e8f2d457c845a13e28621cae10a81..e6198935558f5e527e0c55ae614a6458b333945d 100644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jz5?}Qr?OArBGJ&e+{}6ev}Q6uM7vE2oz*M farKS@%n%sNFHHZ(s}=T-m6R|bM8M@*;H%=_;Zl=_ diff --git a/examples/ExampleParallelFunctionCalls.mlx b/examples/ExampleParallelFunctionCalls.mlx index ee1aca3aab475a5fc069d76f2a6fd758052fa2bb..c8d893a08f32efabfbb1b44434a16e8dcaae1979 100644 GIT binary patch delta 4985 zcmZ`-XHXMLv<^j@(tDRCgbsqC_uiW#NReJ7AT5L-M2bKVkWMI~^xjd55HB6125Hiy zNRtwZ7YG>gy!ZXM*Ejd=%JR}4x(`~e1wq3Eate0n`&>_3AoO93LHz;N{ ztxa_K;NSq)mN%?L&JV}rLXBU+=&E}GwjGk>m#K&}rRH!r)V z;R8syLm632O2WbdNQj98yj*jgDT+0;lObfZ%a01acLFREu!Izy{^unA_w+^Qhxprx z6w!BYS`e%Zi3&!-wBQPSo=Y0#G2)CmWVxFhznMv%hc$t|^>W^Txq z5ao_ctWgiqw&rI|j_zEb8nS2|hSNPf- zyp7B=->*BdB)|-eQpo5FNQK*H)t~KSYY-s7@QvPE2iW<=V?dsMY*^dn`<^NFE8Sutso-P zLP)@+e_tO&-r}!)@39c!akBMQoT+fc+N#msG?k8N?{h!%LZGqdrKK@68*-1ly}|rcmZf z^`sQ*zAMc-0UoyEF{aYh^0)X6+Au~m?Fn*90%60zv;mOOO?*&mVDA?@IGwwwX70er z{fe9INU^ao_|SI=pYmC$rJW^fxN-lq!su>gJ*a8;dL4=7Z9Z;lzx8;)P0sj>hdg|H zui}QQeCo7gW+&fw1JPRMFOfqnQ}?pX50En~A(A@h^1_Mgn<^6((=;GQfzO;Ny;9Ak zO^#XgO$;EEFPcSFu2z{2S=nk~F!a-k?~>r_X4)w>)L)nYf+Cop1kCv{d{ zOet4)>&F^02*Ibr_6Y*4-@XZA0UuCNvLz9NCw_%I+aMR=bk36_#ftXi=MEK_s)L3G^-JT;v4d5<0bN%3EgpMj9OVZ1oMJb!)e%1RL~dHi&|>1(u0N7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