diff options
author | ben | 2025-01-15 21:32:06 +0100 |
---|---|---|
committer | ben | 2025-01-15 21:35:00 +0100 |
commit | 683b1689b9acdb722cdb83e9759f6b2e0d0f5231 (patch) | |
tree | 6a6e7b4cacb7ffb9e3682e62637640ec9a8aa88e | |
parent | bdbad23c2d7b4a8a38b57d58602f9e4c816a9c0e (diff) | |
download | ai_env-683b1689b9acdb722cdb83e9759f6b2e0d0f5231.tar.gz ai_env-683b1689b9acdb722cdb83e9759f6b2e0d0f5231.tar.bz2 ai_env-683b1689b9acdb722cdb83e9759f6b2e0d0f5231.tar.xz |
Fix and improve the documentation by providing more relevant and illustrative examples.
-rw-r--r-- | README.md | 58 |
1 files changed, 34 insertions, 24 deletions
@@ -34,12 +34,21 @@ Note that it is probably possible to run the project on other GPUs or modern Mac ## How to launch the server -Choose the models you wish to use in the docker-compose.yaml file and change the API token in the .env file as follows: +Choose the models you wish to use in the docker-compose.yaml file. + +``` +environment: + - MODELS=.... +``` + +Add an API key to secure server access by adding a `.env` file like this: + ``` LLM_API_KEY=1234567890 ``` Next, start the servers and their configuration with Docker Compose: + ```bash docker compose up --build -d ``` @@ -50,54 +59,55 @@ The `setup_desktop.sh` script allows for copying a compiled static version of [A ### AIChat essentials -To launch a chatbot while maintaining context: +A request to populate a demo database: ```bash -aichat -m ollama:qwen2.5 -s +aichat "10 fictitious identities with username, firstname, lastname and email then display in json format. The data must be realistic, especially from known email domains." +``` + +Request a snippet of code: +``` +aichat -m ollama:qwen2.5-coder:32b -c "if a docker image exist in bash" ``` -With a prompt: +To launch a chatbot while maintaining context: ```bash -aichat -m ollama:qwen2.5 --prompt "I want you to act as an English translator, spelling corrector and improver. I will speak to you in any language and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. I want you to only reply the correction, the improvements and nothing else, do not write explanations." +aichat -s ``` Pipe a command and transform the result with the LLM: ``` -ls | aichat -m ollama:qwen2.5 --prompt "transform to json" +ps aux | aichat 'which process use the most memory' ``` -Go to the [AIChat](https://github.com/sigoden/aichat) website for other possible use cases. - -### Text To Speech - -To use text-to-speech, use the script in the `tools/tts.sh` file. - -Example: +Using roles: ``` -./tools/tts.sh -l french -v pierre --play "Aujourd'hui, nous sommes le $(date +%A\ %d\ %B\ %Y)." +aichat -r short "tcp port of mysql" ``` -### Speech To Text +Go to the [AIChat](https://github.com/sigoden/aichat) website for other possible use cases. -For the Speech to Text functionality, use `tools/stt.sh`. -The function record allows you to use PulseAudio to record the computer's audio (for example, a video in the browser). -The transcription function converts the audio file into text. +### Text To Speech & Speech To Text -Example: -```bash -./tools/stt.sh record -s alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__Speaker__sink.monitor -./tools/stt.sh transcription -f record_20250112_125726.wav -l fr +For these two features, use the speech.sh script like this: + +``` +./speech.sh synthesize --play --lang fr --voice pierre "Bonjour, aujourd'hui nous somme le $(date +%A\ %d\ %B\ %Y)." +./speech.sh transcript --lang fr --filename speech.wav ``` ## How to Use Remotely The API authentication via Nginx allows you to open the API on the internet and use it remotely. + By adding a reverse proxy like Caddy in front of it, you can also add TLS encryption. + This way, you can securely use this environment remotely. To use script tools in a remote context, use the environment variables TTS_API_HOST and STT_API_HOST and modify AIChat config (~/.config/aichat/config.yaml) . Example: ``` -TTS_API_HOST="https://your-remote-domain" ./tools/tts.sh -l french -v pierre --play "Aujourd'hui, nous sommes le $(date +%A\ %d\ %B\ %Y)." -STT_API_HOST="https://your-remote-domain" ./tools/stt.sh transcription -f speech_20250112_124805.wav -l fr +export TTS_API_HOST="https://your-remote-domain" +export STT_API_HOST="https://your-remote-domain" +./tools/speech.sh ... ``` |