open-index/open-npm huggingface dataset:
npm package: @mlc-ai/web-agent-interface
Description: A tool library for LLM agent in browsers to interact with the web.
Latest version: 0.0.3

# Web-Agent-Interface Library

## Overview

The `web-agent-interface` library provides tools to LLM agents in browsers to interact with different websites.

**Note**: The project is still in development phase. It has limited coverage and its APIs may change.

## Supported Tools

- **General DOM Operations**: Get page content and user selection.
- **Overleaf**: Edit Overleaf documents.
- **Google Calendar (GCal)**: Read and create events on Google Calendar.
<!-- - **Google Docs (GDoc)**: Interact with text selections and modifications in Google Docs. -->

## Installation

To install and build the library, follow these steps:

1. Clone the repository:

   ```bash
   git clone https://github.com/mlc-ai/web-agent-interface.git
   cd web-agent-interface
   ```

2. Install dependencies and build the project:

   ```bash
   npm install
   npm run build
   ```

## Usage

### 1. Initialize State

  ```javascript
  import { State } from '@mlc-ai/web-agent-interface';

  const state = new State();
  ```


### 2. Import Tools

  ```javascript
  import { tool, retriever, action } from '@mlc-ai/web-agent-interface';
  ```

### 3. Give Tool Description to Prompt

  ```javascript
  const system_prompt = `
  You are a helpful AI agent.

  You have the following tools to use:

  ${tools.map((t) => JSON.stringify(t.schema)).join(",\n")}
  `
  ```

### 3. Call Tool Function to Get Observation

  ```javascript
  const { tool_name, parameters } = extractToolCall(llm_response);
  const observation = tool[tool_name].implementation(state, parameters);
  console.log("Got observation:", observation);
  ```
npm package: @mlc-ai/web-tokenizers
Description: | [NPM Package](https://www.npmjs.com/package/@mlc-ai/web-tokenizers) | [WebLLM](https://github.com/mlc-ai/web-llm) |
Latest version: 0.1.6

# WebTokenizers

| [NPM Package](https://www.npmjs.com/package/@mlc-ai/web-tokenizers) | [WebLLM](https://github.com/mlc-ai/web-llm) |

WebTokenizers is a javascript binding library that can be universally deployed.
It wraps and binds the [HuggingFace tokenizers library](https://github.com/huggingface/tokenizers)
and [sentencepiece](https://github.com/google/sentencepiece) and provides a minimum common interface
in havascript.

## Build from Srouce

```bash
source /path/to/emsdk_env.sh
npm install
npm run build
```

To try out the test webpage
```bash
cd tests
npm start
```
npm package: @mlc-ai/web-xgrammar
Description: This folder contains the source code and emcc bindings for compiling XGrammar to Javascript/Typescript via [emscripten](https://emscripten.org/).
Latest version: 0.1.27

# web-xgrammar

This folder contains the source code and emcc bindings for compiling XGrammar to Javascript/Typescript via [emscripten](https://emscripten.org/).

### Build from source
1. Install [emscripten](https://emscripten.org). It is an LLVM-based compiler that compiles C/C++ source code to WebAssembly.
    - Follow the [installation instruction](https://emscripten.org/docs/getting_started/downloads.html#installation-instructions-using-the-emsdk-recommended) to install the latest emsdk.
    - Source `emsdk_env.sh` by `source /path/to/emsdk_env.sh`, so that `emcc` is reachable from PATH and the command `emcc` works.
    - We can verify the successful installation by trying out `emcc` in the terminal.

2. Modify the content of `cmake/config.cmake` to be `web/config.cmake`.

3. Run the following

    ```bash
    source /path/to/emsdk_env.sh
    npm install
    npm run build
    ```

### Example
To try out the test webpage, run the following
```bash
cd example
npm install
npm start
```

### Testing
For testing in `node` environment, run:
```bash
npm test
```