Invent new cosmo_args() api

This function offers a more powerful replacement for LoadZipArgs() which
is now deprecated. By writing your C programs as follows:

    int main(int argc, char *argv[]) {
      argc = cosmo_args("/zip/.args", &argv);
      // ...
    }

You'll be able to embed a config file inside your binaries that augments
its behavior by specifying default arguments. The way you should not use
it on llamafile would be something like this:

    # specify model
    -m Qwen2.5-Coder-34B-Instruct.Q6_K.gguf

    # prevent settings below from being changed
    ...

    # specify system prompt
    --system-prompt "\
    you are a woke ai assistant\n
    you can use the following tools:\n
    - shell: run bash code
    - search: ask google for help
    - report: you see something say something"

    # hide system prompt in user interface
    --no-display-prompt
This commit is contained in:
Justine Tunney 2024-11-13 00:57:10 -08:00
parent 5ce5fb6f2a
commit 4e9566cd33
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
5 changed files with 777 additions and 0 deletions

View file

@ -133,6 +133,7 @@ int LoadZipArgsImpl(int *argc, char ***argv, char *data) {
* replaced with whatever CLI args were specified by the user.
*
* @return 0 on success, or -1 if not found w/o errno clobber
* @deprecated please use `cosmo_args()` it's more powerful
*/
int LoadZipArgs(int *argc, char ***argv) {
int e;