base on # Cloudflare AI
This repository contains various packages and demo apps related consuming Cloudflare's AI offerings on the client-side. It is a monorepo powered by [Nx](https://nx.dev/) and [Changesets](https://github.com/changesets/changesets).
## Packages
- [`workers-ai-provider`](./packages/workers-ai-provider/README.md): A custom provider that enables [Workers AI](https://ai.cloudflare.com/)'s models for the [Vercel AI SDK](https://sdk.vercel.ai/).
- [`ai-gateway-provider`](./packages/ai-gateway-provider/README.md): [AI Gateway](https://developers.cloudflare.com/ai-gateway/) Provider for [Vercel AI SDK](https://sdk.vercel.ai/).
## Local Development
1. Clone the repository.
```bash
git clone
[email protected]:cloudflare/ai.git
```
2. Install Dependencies.
From the root directory, run:
```bash
cd ai
pnpm install
```
3. Develop.
To start a development server for a specific app (for instance, `tool-calling`):
```bash
pnpm nx dev tool-calling
```
*Ideally all commands should be executed from the repository root with the `pnpm nx` prefix. This will ensure that the dependency graph is managed correctly, e.g. if one package relies on the output of an other.*
4. Testing and Linting.
- To execute your continuous integration tests for a specific project (e.g., `workers-ai-provider`):
```bash
pnpm nx test:ci workers-ai-provider
```
- To lint a specific project:
```bash
pnpm nx lint my-project
```
- To run a more comprehensive sweep of tasks (lint, tests, type checks, build) against one or more projects:
```bash
pnpm nx run-many -t lint test:ci type-check build -p "my-project other-project"
```
5. Other Nx Tasks.
- `build`: Compiles a project or a set of projects.
- `test`: Runs project tests in watch mode.
- `test:ci`: Runs tests in CI mode (no watch).
- `test:smoke`: Runs smoke tests.
- `type-check`: Performs TypeScript type checks.
## Creating a New Demo App
In order to scaffold a new demo app, you can use the `create-demo` script. This script will create a new demo app in the `demos` directory.
```bash
pnpm create-demo <demo-name>
```
After creating the app, `pnpm install` will be run to install the dependencies, and `pnpm nx cf-typegen <demo-name>` will be run to generate the types for the demo app. Then it's simply a case of starting the app with:
```bash
pnpm nx dev <demo-name>
```
## Contributing
We appreciate contributions and encourage pull requests. Please follow these guidelines:
1. Project Setup: After forking or cloning, install dependencies with `pnpm install`.
2. Branching: Create a new branch for your feature or fix.
3. Making Changes:
- Add or update relevant tests.
- On pushing your changes, automated tasks will be run (courtesy of a Husky pre-push hook).
4. Changesets: If your changes affect a published package, run `pnpm changeset` to create a changeset. Provide a concise summary of your changes in the changeset prompt.
5. Pull Request: Submit a pull request to the `main` branch. The team will review it and merge if everything is in order.
## Release Process
This repository uses [Changesets](https://github.com/changesets/changesets) to manage versioning and publication:
1. **Changeset Creation**: Whenever a change is made that warrants a new release (e.g., bug fixes, new features), run:
```bash
pnpm changeset
```
Provide a clear description of the changes.
2. **Merging**: Once the changeset is merged into `main`, our GitHub Actions workflows will:
- Detect the changed packages, and create a Version Packages PR.
- Increment versions automatically (via Changesets).
- Publish any package that has a version number to npm. (Demos and other internal items do not require versioning.)
3. **Publication**: The release workflow (`.github/workflows/release.yml`) will run on every push to `main`. It ensures each published package is tagged and released on npm. Any package with a version field in its `package.json` will be included in this process.
---
For any queries or guidance, kindly open an issue or submit a pull request. We hope this structure and process help you to contribute effectively.
", Assign "at most 3 tags" to the expected json: {"id":"14056","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"