Skip to content

Commit

Permalink
Update .env and README.md files
Browse files Browse the repository at this point in the history
  • Loading branch information
CoMfUcIoS committed Mar 14, 2024
1 parent 324e843 commit 14187b9
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 36 deletions.
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
THREADS=4
ADDRESS=0.0.0.0:8085
GALLERIES=[{"name":"model-gallery", "url":"github:go-skynet/model-gallery/index.yaml"}, {"url": "github:go-skynet/model-gallery/huggingface.yaml","name":"huggingface"}]
DEBUG=true
DEBUG=false
MODELS_PATH=/models
# BUILD_TYPE=openblas
#BUILD_TYPE=openblas
#REBUILD=true
155 changes: 121 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
# Use AI models in terminal locally, free and without a connection.
# Use AI models in terminal locally, free and without a connection

![Usage](cli_ai.gif)

## Table of contents

- [Use AI models in terminal locally, free and without a connection.](#use-ai-models-in-terminal-locally-free-and-without-a-connection)
- [Use AI models in terminal locally, free and without a connection](#use-ai-models-in-terminal-locally-free-and-without-a-connection)
- [Table of contents](#table-of-contents)
- [What is this?](#what-is-this)
- [Requirements](#requirements)
- [In your terminal](#in-your-terminal)
- [Install](#install)
- [Install zsh\_local\_ai plugin](#install-zsh_local_ai-plugin)
- [Using oh-my-zsh edit ~/.zshrc](#using-oh-my-zsh-edit-zshrc)
- [Reload zsh](#reload-zsh)
- [Run local api in docker](#run-local-api-in-docker)
- [Fetch the models](#fetch-the-models)
- [Installation](#installation)
- [Run local api in docker](#run-local-api-in-docker)
- [Fetch the models](#fetch-the-models)
- [Restart the api](#restart-the-api)
- [Make your first request](#make-your-first-request)
- [Usage](#usage)
- [In your terminal](#in-your-terminal)
- [Terminal Requirements](#terminal-requirements)
- [Install zsh\_local\_ai plugin](#install-zsh_local_ai-plugin)
- [Using oh-my-zsh edit ~/.zshrc](#using-oh-my-zsh-edit-zshrc)
- [Reload zsh](#reload-zsh)
- [In VS Code](#in-vs-code)
- [VS Code Requirements](#vs-code-requirements)
- [Install Vscode and Continue Plugin](#install-vscode-and-continue-plugin)
- [Configure extension](#configure-extension)
- [In your notes or markdown files](#in-your-notes-or-markdown-files)
- [Notes Requirements](#notes-requirements)
- [Install obsidian and text generator plugin](#install-obsidian-and-text-generator-plugin)
- [Setup text generator](#setup-text-generator)
- [License](#license)

## What is this?
Expand All @@ -29,14 +38,51 @@ This is a simple api that runs locally and can be used to run ai models locally
- Docker
- Docker-compose
- Make

## Installation

### Run local api in docker

Wont demonize the process, so you can see the logs (Also debug mode is on)

```bash
make start
```

### Fetch the models

This will take a while to download the models for the first time. Wait until this is done before making a request.

```bash
make get_models
```

### Restart the api

Give it a few seconds to stop the container and start it again.

```bash
make restart
```

### Make your first request

That will take a while to load the model for the first time

```bash
make test
```

## Usage

### In your terminal

#### Terminal Requirements

- Zsh
- Oh-my-zsh
- Python3

## In your terminal

### Install

#### Install zsh_local_ai plugin

```bash
Expand All @@ -61,43 +107,84 @@ bindkey '^X' create_completion
source ~/.zshrc
```

#### Run local api in docker
Start typing the command or a comment and press ctrl+x to get the completion. Then press enter to run the command.

Wont demonize the process, so you can see the logs (Also debug mode is on)
### In VS Code

```bash
make start
```
#### VS Code Requirements

#### Fetch the models
- VS Code
- Continue - Claude, CodeLlama, GPT-4, and more extension

This will take a while to download the models for the first time. Wait until this is done before making a request.
#### Install Vscode and Continue Plugin

```bash
make get_models
```
Download and install VSCode, then from the extensions search and install the Continue plugin.

### Restart the api
#### Configure extension

Give it a few seconds to stop the container and start it again.
- At you vscode Toolbar click on the new Continue icon, then click on the gear icon at the bottom right to open the settings.

```bash
make restart
- In the models array add the following first
```
{
"title": "Monday AI",
"provider": "openai",
"model": "gpt4all-j",
"apiBase": "http://localhost:8085/v1/"
},
```

### Make your first request
- Replace the "tabAutocompleteModel" Object with the following

That will take a while to load the model for the first time
```
"tabAutocompleteModel": {
"title": "Tab Autocomplete Model",
"provider": "openai",
"model": "gpt4all-j",
"apiBase": "http://localhost:8085/v1/"
},
"tabAutocompleteOptions": {
"useCopyBuffer": false,
"maxPromptTokens": 400,
"prefixPercentage": 0.5,
"debounceDelay": 2000
},
```

```bash
make test

Save the config and now you can chat with Monday in the continue chat and use it as autocompletion..... it is slow and depends on your setup

### In your notes or markdown files

#### Notes Requirements

- Obsidian
- Text Generator plugin

#### Install obsidian and text generator plugin

You can find obsidian [here](https://obsidian.md/). In the settings, go to community plugins and install text generator.

#### Setup text generator

- In the settings under community plugins settings, select text generator. Then in LLM Providers select Custom and add the url of the local api. This will be
`http://localhost:8085/v1/chat/completions`.

- Toggle advance mode and in Header section remove the bearer token header. Headers should look like that:

```json
{
"Content-Type": "application/json",
}
```

## Usage
- In the Variables section, change the model to be `gpt4all-j`

- Lastly, enable CORS Bypass.

Start typing the command or a comment and press ctrl+x to get the completion. Then press enter to run the command.

Now you can use the text generator plugin to generate text in your notes.

## License

[MIT](LICENSE)
[MIT](LICENSE)

0 comments on commit 14187b9

Please sign in to comment.