Merge branch 'master' into v2-exp

This commit is contained in:
Himadri Bhattacharjee
2025-06-21 11:48:12 +05:30
committed by GitHub

View File

@@ -20,30 +20,30 @@ cd silos
### Setup
Add your code snippets in the `./snippets/v1/LANGUAGE/` directory as JSON files, where LANGUAGE is some programming language.
Add your code snippets as KDL files in the `./snippets/v1/LANGUAGE/` directory, Take a look at the example snippet for golang in `./snippets/v1/go/simple_worker.kdl`.
The snippets must conform to the following structure:
``` json
{
"desc": "a well articulated description of the snippet",
"body": "fn main() { println!(\"The body of the snippet\") }"
}
``` kdl
desc "a well articulated description of the snippet",
body #"fn main() { println!("The body of the snippet") }"#
```
KDL supports arbitrary raw strings with as many `#`s before and after the quotes to disambiguate them from the string contents.
After adding your snippets, run the server
> [!NOTE]
>
> Embedding defaults to using the CPU. You may use the `--gpu` with a GPU number flag if you wish to use a dedicated GPU.
```
``` sh
cargo r
```
> [!NOTE]
>
> Embedding defaults to using the CPU. You may use the `--gpu` flag with a GPU number to use a dedicated GPU.
### Usage
An HTTP REST API listens on port 8000 and can be queried for code snippet.
An HTTP REST API listens on port 8000 and can be queried for code snippets.
#### Query a snippet
@@ -60,6 +60,12 @@ curl http://localhost:8000/api/v1/add --json \
'{ "desc": "Build an asynchronous shared mutable state", "lang": "rust", "body": "let object = Arc::new(Mutex::new(old));" }'
```
## v2 API
Language grammar parsing with abstract syntax tree manipulation support.
Coming soon
## TODOs
- [ ] Create an LSP to add the suffix based on filetype.