Skip to content

Comments

Update Server Instructions For Web Front End#2103

Merged
SlyEcho merged 1 commit intoggml-org:masterfrom
jessejohnson:update-server-instructions
Jul 5, 2023
Merged

Update Server Instructions For Web Front End#2103
SlyEcho merged 1 commit intoggml-org:masterfrom
jessejohnson:update-server-instructions

Conversation

@jessejohnson
Copy link
Contributor

Minor update to add instructions for how to access @tobi's web front end (#1998) to the server example now that it's been merged.

@tobi
Copy link
Collaborator

tobi commented Jul 5, 2023

This is a good point, i didn't touch the readme. I think what's worth documenting there is that you can now make a new frontend or tool very easily by pointing server --path ./your-directory and simply importing /completion.js to get access to the llamaComplete() method. Here is a super simple example of a full index.html:

<html>
  <body>
    <pre>
      <script type="module">
        import { llamaComplete } from '/completion.js'

        llamaComplete({
            prompt: "### Instruction:\nWrite dad jokes, each one paragraph. You can use html formatting if needed.\n\n### Response:",
            n_predict: 1024,
          },
          null,
          (chunk) => document.write(chunk.data.content)
        )
      </script>
    </pre>
  </body>
</html>
image

seeing this, i could probably improve the api of completion.js a bit. It should probably return an EventEmitter at the very least.

@SlyEcho SlyEcho self-assigned this Jul 5, 2023
@SlyEcho SlyEcho merged commit 8567c76 into ggml-org:master Jul 5, 2023
- `-to N`, `--timeout N`: Server read/write timeout in seconds. Default `600`.
- `--host`: Set the hostname or ip address to listen. Default `127.0.0.1`.
- `--port`: Set the port to listen. Default: `8080`.
- `--public`: path from which to serve static files (default examples/server/public)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is actually --path not --public

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wow, how did I miss that? I'll fix it in a bit. 👍🏾

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