|
| 1 | +### dev-ai-chat |
| 2 | + |
| 3 | +----- |
| 4 | + |
| 5 | +#### For development: |
| 6 | + |
| 7 | +Do the following to build the ci.common `99.0.0-SNAPSHOT` |
| 8 | +``` |
| 9 | +git clone git@github.com:OpenLiberty/ci.common.git -b dev-ai-chat |
| 10 | +cd ci.common |
| 11 | +./mvnw clean install |
| 12 | +``` |
| 13 | +and do the following to build the ci.maven `99.0.0-SNAPSHOT` |
| 14 | +``` |
| 15 | +git clone git@github.com:OpenLiberty/ci.maven.git -b dev-ai-chat |
| 16 | +cd ci.maven |
| 17 | +./mvnw clean install |
| 18 | +``` |
| 19 | + |
| 20 | + |
| 21 | +#### Prerequisites |
| 22 | + |
| 23 | +- Download and install [Ollama](https://ollama.com/download). |
| 24 | + - see the [README.md](https://github.com/ollama/ollama/blob/main/README.md#ollama). |
| 25 | +- Pull the following model. |
| 26 | + - `ollama pull gpt-oss` |
| 27 | +- Update the Liberty Maven Plugin version to `99.0.0-SNAPSHOT` in your Maven `pom.xml` project file. |
| 28 | + |
| 29 | +#### Usages |
| 30 | + |
| 31 | +After you start dev mode, you will see |
| 32 | +``` |
| 33 | +[INFO] ************************************************************************ |
| 34 | +[INFO] * Liberty is running in dev mode. |
| 35 | +[INFO] * Automatic generation of features: [ Off ] |
| 36 | +[INFO] * a - toggle the AI mode, type 'a' and press Enter. |
| 37 | +[INFO] * h - see the help menu for available actions, type 'h' and press Enter. |
| 38 | +[INFO] * q - stop the server and quit dev mode, press Ctrl-C or type 'q' and press Enter. |
| 39 | +[INFO] * Liberty server port information: |
| 40 | +[INFO] * Liberty server HTTP port: [ 9080 ] |
| 41 | +[INFO] * Liberty server HTTPS port: [ 9443 ] |
| 42 | +[INFO] * Liberty debug port: [ 7777 ] |
| 43 | +[INFO] ************************************************************************ |
| 44 | +``` |
| 45 | + |
| 46 | +Press `a` and `Enter` keys to toggle the AI mode on or off. |
| 47 | + |
| 48 | +When you turn it on, by default, the Ollama base URL `http://localhost:11434` and the `gpt-oss` model will be connected. |
| 49 | + |
| 50 | +When the connection is established, you will see the following help: |
| 51 | +``` |
| 52 | +[INFO] ************************************************************************ |
| 53 | +[INFO] * |
| 54 | +[INFO] * AI information: |
| 55 | +[INFO] * model: gpt-oss |
| 56 | +[INFO] * |
| 57 | +[INFO] * To start a multi-line message, type in [ and press Enter. |
| 58 | +[INFO] * To end the multi-line message, type in ] and press Enter. |
| 59 | +[INFO] * To clear the multi-line message, press Ctrl+X followed by Ctrl+K. |
| 60 | +[INFO] * Reset chat session - type in reset chat and press Enter. |
| 61 | +[INFO] * View a previous message - press Up/Down arrow key. |
| 62 | +[INFO] * |
| 63 | +[INFO] ************************************************************************ |
| 64 | +``` |
| 65 | + |
| 66 | +When you type in any message that is not any hotkey such as `a`, `g`, `h`, `q`, or `r` ...etc., the message will be chatted with the Ollama model. For example: |
| 67 | +``` |
| 68 | +What is LLM? |
| 69 | + |
| 70 | +┌─────────────────────────────────────────────────────────────────────────────── |
| 71 | +
|
| 72 | +LLM stands for Large Language Model—a type of artificial‑intelligence model trained on vast amounts of text to generate, interpret, or manipulate natural language. |
| 73 | +
|
| 74 | +Source: Wikipedia – Large language model (https://en.wikipedia.org/wiki/Large\_language\_model) |
| 75 | +
|
| 76 | +└─────────────────────────────────────────────────────────────────────────────── |
| 77 | +``` |
| 78 | + |
| 79 | +#### Override the Ollama setting |
| 80 | + |
| 81 | +To override the Ollama base URL, start the dev mode with the `ollama.base.url` system property: |
| 82 | +``` |
| 83 | +./mvnw -Dollama.base.url=<an Ollama URL> liberty:dev |
| 84 | +``` |
| 85 | + |
| 86 | +To override the Ollama model, start the dev mode with the `chat.model.id` system property: |
| 87 | +``` |
| 88 | +./mvnw -Dchat.model.id=devstral:latest liberty:dev |
| 89 | +``` |
0 commit comments