mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 15:38:55 +01:00
Add documentation for python code execution capability
This commit is contained in:
parent
ffa7f95559
commit
23a49b6b95
2 changed files with 33 additions and 0 deletions
|
@ -43,3 +43,6 @@ Slash commands allows you to change what Khoj uses to respond to your query
|
|||
- **/image**: Generate an image in response to your query.
|
||||
- **/help**: Use /help to get all available commands and general information about Khoj
|
||||
- **/summarize**: Can be used to summarize 1 selected file filter for that conversation. Refer to [File Summarization](summarization) for details.
|
||||
- **/diagram**: Generate a diagram in response to your query. This is built on [Excalidraw](https://excalidraw.com/).
|
||||
- **/code**: Generate and run very simple Python code snippets. Refer to [Code Generation](code_generation) for details.
|
||||
- **/research**: Go deeper in a topic for more accurate, in-depth responses.
|
||||
|
|
30
documentation/docs/features/code_execution.md
Normal file
30
documentation/docs/features/code_execution.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
---
|
||||
|
||||
# Code Execution
|
||||
|
||||
Khoj can generate and run very simple Python code snippets as well. This is useful if you want to generate a plot, run a simple calculation, or do some basic data manipulation. LLMs by default aren't skilled at complex quantitative tasks. Code generation & execution can come in handy for such tasks.
|
||||
|
||||
Just use `/code` in your chat command.
|
||||
|
||||
### Setup (Self-Hosting)
|
||||
Run [Cohere's Terrarium](https://github.com/cohere-ai/cohere-terrarium) on your machine to enable code generation and execution.
|
||||
|
||||
Check the [instructions](https://github.com/cohere-ai/cohere-terrarium?tab=readme-ov-file#development) for running from source.
|
||||
|
||||
For running with Docker, you can use our [docker-compose.yml](https://github.com/khoj-ai/khoj/blob/master/docker-compose.yml), or start it manually like this:
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/khoj-ai/terrarium:latest
|
||||
docker run -d -p 8080:8080 ghcr.io/khoj-ai/terrarium:latest
|
||||
```
|
||||
|
||||
#### Verify
|
||||
Verify that it's running, by evaluating a simple Python expression:
|
||||
|
||||
```bash
|
||||
curl -X POST -H "Content-Type: application/json" \
|
||||
--url http://localhost:8080 \
|
||||
--data-raw '{"code": "1 + 1"}' \
|
||||
--no-buffer
|
||||
```
|
Loading…
Reference in a new issue