https://github.com/davidwrossiter/unsalad
Worker to manage the chunking and embedding of a codebase.
https://github.com/davidwrossiter/unsalad
ai cloudflare cloudflare-workers ml serverless
Last synced: 9 months ago
JSON representation
Worker to manage the chunking and embedding of a codebase.
- Host: GitHub
- URL: https://github.com/davidwrossiter/unsalad
- Owner: davidwrossiter
- Created: 2024-06-19T13:04:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-20T09:46:54.000Z (almost 2 years ago)
- Last Synced: 2025-07-25T09:03:14.013Z (9 months ago)
- Topics: ai, cloudflare, cloudflare-workers, ml, serverless
- Language: TypeScript
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Unsalad Documentation
## Overview
This document provides details about our API. The base domain is https://unsalad.rossiter.dev
## Endpoint
### POST /
#### Description
This endpoint accepts a JSON body containing a context and a query. It returns a JSON response with the requested code snippet formatted in markdown.
#### Request Format
- **Method:** POST
- **Content-Type:** application/json
- **Body:**
```json
{
"context": "CONTEXT: You are a helpful assistant and must return code only do not respond with anything but the code everything must be in markdown format only. Your task is to",
"query": "write a bubble sort algorithm in javascript"
}
```
#### Response Format
- **Content-Type:** application/json
- **Body:**
```json
{
"response": "```javascript\nfunction bubbleSort(arr) {\n let swapped;\n do {\n swapped = false;\n for (let i = 0; i < arr.length - 1; i++) {\n if (arr[i] > arr[i + 1]) {\n [arr[i], arr[i + 1]] = [arr[i + 1], arr[i]];\n swapped = true;\n }\n }\n } while (swapped);\n return arr;\n}\n```"
}
```
## Example Usage
### Request
```bash
curl -X POST https://api.example.com/generate-code \
-H "Content-Type: application/json" \
-d '{
"context": "CONTEXT: You are a helpful assistant and must return code only do not respond with anything but the code everything must be in markdown format only. Your task is to",
"query": "write a bubble sort algorithm in javascript"
}'
```
### Response
```json
{
"response": "```javascript\nfunction bubbleSort(arr) {\n let swapped;\n do {\n swapped = false;\n for (let i = 0; i < arr.length - 1; i++) {\n if (arr[i] > arr[i + 1]) {\n [arr[i], arr[i + 1]] = [arr[i + 1], arr[i]];\n swapped = true;\n }\n }\n } while (swapped);\n return arr;\n}\n```"
}
```
## Error Handling
In case of an error, the API will return a JSON response with the appropriate HTTP status code and a message describing the error.
### Example Error Response
- **Status Code:** 400 Bad Request
- **Content-Type:** application/json
- **Body:**
```json
{
"error": "Invalid request format. Please ensure your request matches the expected JSON structure."
}
```
## Contact
For further assistance, please contact me on [𝕏](https://x.com/davidwrossiter).
---
End of Documentation.