|
| 1 | + |
| 2 | +# Sophia III |
| 3 | + |
| 4 | +## Quick Start Guide |
| 5 | + |
| 6 | +### Operating System Prerequisites |
| 7 | + |
| 8 | +Provide the following prerequisites based on the Operating System you use. |
| 9 | + |
| 10 | +#### Windows and Mac Prerequisites |
| 11 | + |
| 12 | +- [Git](https://git-scm.com/downloads) |
| 13 | +- [Docker Desktop](https://docs.docker.com/docker-for-windows/install/) |
| 14 | +- [Python 3.10.x](https://www.python.org/downloads/) |
| 15 | + |
| 16 | +#### Linux Prerequisites |
| 17 | + |
| 18 | +- [Git](https://git-scm.com/downloads) |
| 19 | +- [Docker](https://docs.docker.com/get-docker/) |
| 20 | +- [Docker Compose](https://docs.docker.com/compose/install/) |
| 21 | +- [Python 3.10.x](https://www.python.org/downloads/) |
| 22 | +- [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) (if using local models on GPU) |
| 23 | + |
| 24 | +## Installation |
| 25 | + |
| 26 | +If you're using Linux, you may need to prefix the `python` command with `sudo` depending on your system configuration. |
| 27 | + |
| 28 | +```bash |
| 29 | +git clone https://github.com/Nora-MA-01/Sophia-III |
| 30 | +cd Sophia-III |
| 31 | +python start.py |
| 32 | +``` |
| 33 | + |
| 34 | +The script will check for Docker and Docker Compose installation: |
| 35 | + |
| 36 | +- On Linux, it will attempt to install them if missing (requires sudo privileges). |
| 37 | +- On macOS and Windows, it will provide instructions to download and install Docker Desktop. |
| 38 | + |
| 39 | +## Usage |
| 40 | + |
| 41 | +Run the script with Python: |
| 42 | + |
| 43 | +```bash |
| 44 | +python start.py |
| 45 | +``` |
| 46 | + |
| 47 | +To run Sophia III with ezLocalai, use the `--with-ezlocalai` flag: |
| 48 | + |
| 49 | +```bash |
| 50 | +python start.py --with-ezlocalai |
| 51 | +``` |
| 52 | + |
| 53 | +You can also use command-line arguments to set specific environment variables to run in different ways. For example, to use the development branch and enable auto-updates, run: |
| 54 | + |
| 55 | +```bash |
| 56 | +python start.py --sophia-iii-branch dev --sophia-iii-auto-update true --with-ezlocalai |
| 57 | +``` |
| 58 | + |
| 59 | +- Access the Sophia III Management interface at <http://localhost:8501> to create and manage your agents, prompts, chains, and configurations. |
| 60 | +- Access the Sophia III Interactive interface at <http://localhost:3437> to interact with your configured agents. |
| 61 | +- Access the Sophia III API documentation at <http://localhost:7437> |
| 62 | + |
| 63 | +### Command-line Options |
| 64 | + |
| 65 | +The script supports setting any of the environment variables via command-line arguments. Here's a detailed list of available options: |
| 66 | + |
| 67 | +1. `--sophia-iii-api-key`: Set the Sophia III API key (automatically generated if not provided) |
| 68 | +2. `--sophia-iii-uri`: Set the Sophia III URI (default: `http://localhost:7437`) |
| 69 | +3. `--sophia-iii-agent`: Set the default Sophia III agent (default: `Sophia III`) |
| 70 | +4. `--sophia-iii-branch`: Choose between `stable` and `dev` branches |
| 71 | +5. `--sophia-iii-file-upload-enabled`: Enable or disable file uploads (default: `true`) |
| 72 | +6. `--sophia-iii-voice-input-enabled`: Enable or disable voice input (default: `true`) |
| 73 | +7. `--sophia-iii-footer-message`: Set the footer message (default: `Powered by Sophia III`) |
| 74 | +8. `--sophia-iii-require-api-key`: Require API key for access (default: `false`) |
| 75 | +9. `--sophia-iii-rlhf`: Enable or disable reinforcement learning from human feedback (default: `true`) |
| 76 | +10. `--sophia-iii-show-selection`: Set which selectors to show in the UI (default: `conversation,agent`) |
| 77 | +11. `--sophia-iii-show-agent-bar`: Show or hide the agent bar in the UI (default: `true`) |
| 78 | +12. `--sophia-iii-show-app-bar`: Show or hide the app bar in the UI (default: `true`) |
| 79 | +13. `--sophia-iii-conversation-mode`: Set the conversation mode (default: `select`) |
| 80 | +14. `--allowed-domains`: Set allowed domains for API access (default: `*`) |
| 81 | +15. `--app-description`: Set the application description |
| 82 | +16. `--app-name`: Set the application name (default: `Sophia III Chat`) |
| 83 | +17. `--app-uri`: Set the application URI (default: `http://localhost:3437`) |
| 84 | +18. `--auth-web`: Set the authentication web URI (default: `http://localhost:3437/user`) |
| 85 | +19. `--auth-provider`: Set the authentication provider (options: `none`, `magicalauth`) |
| 86 | +20. `--disabled-providers`: Set disabled providers (comma-separated list) |
| 87 | +21. `--disabled-extensions`: Set disabled extensions (comma-separated list) |
| 88 | +22. `--working-directory`: Set the working directory (default: `./WORKSPACE`) |
| 89 | +23. `--github-client-id`: Set GitHub client ID for authentication |
| 90 | +24. `--github-client-secret`: Set GitHub client secret for authentication |
| 91 | +25. `--google-client-id`: Set Google client ID for authentication |
| 92 | +26. `--google-client-secret`: Set Google client secret for authentication |
| 93 | +27. `--microsoft-client-id`: Set Microsoft client ID for authentication |
| 94 | +28. `--microsoft-client-secret`: Set Microsoft client secret for authentication |
| 95 | +29. `--tz`: Set the timezone (default: system timezone) |
| 96 | +30. `--interactive-mode`: Set the interactive mode (default: `chat`) |
| 97 | +31. `--theme-name`: Set the UI theme (options: `default`, `christmas`, `conspiracy`, `doom`, `easter`, `halloween`, `valentines`) |
| 98 | +32. `--allow-email-sign-in`: Allow email sign-in (default: `true`) |
| 99 | +33. `--database-type`: Set the database type (options: `sqlite`, `postgres`) |
| 100 | +34. `--database-name`: Set the database name (default: `models/sophia-iii`) |
| 101 | +35. `--log-level`: Set the logging level (default: `INFO`) |
| 102 | +36. `--log-format`: Set the log format (default: `%(asctime)s | %(levelname)s | %(message)s`) |
| 103 | +38. `--uvicorn-workers`: Set the number of Uvicorn workers (default: `10`) |
| 104 | +39. `--sophia-iii-auto-update`: Enable or disable auto-updates (default: `true`) |
| 105 | + |
| 106 | +Options specific to ezLocalai: |
| 107 | + |
| 108 | +1. `--with-ezlocalai`: Start Sophia III with ezLocalai integration. |
| 109 | +2. `--ezlocalai-uri`: Set the ezLocalai URI (default: `http://{local_ip}:8091`) |
| 110 | +3. `--default-model`: Set the default language model for ezLocalai (default: `QuantFactory/dolphin-2.9.2-qwen2-7b-GGUF`) |
| 111 | +4. `--vision-model`: Set the vision model for ezLocalai (default: `deepseek-ai/deepseek-vl-1.3b-chat`) |
| 112 | +5. `--llm-max-tokens`: Set the maximum number of tokens for language models (default: `32768`) |
| 113 | +6. `--whisper-model`: Set the Whisper model for speech recognition (default: `base.en`) |
| 114 | +7. `--gpu-layers`: Set the number of GPU layers to use (automatically determined based on available VRAM but can be modified.) (default: `-1` for all) |
| 115 | + |
| 116 | +For a full list of options with their current values, run: |
| 117 | + |
| 118 | +```bash |
| 119 | +python start.py --help |
| 120 | +``` |
| 121 | + |
| 122 | +## Docker Deployment |
| 123 | + |
| 124 | +After setting up the environment variables and ensuring Docker and Docker Compose are installed, the script will: |
| 125 | + |
| 126 | +1. Stop any running Sophia III Docker containers |
| 127 | +2. Pull the latest Docker images (if auto-update is enabled) |
| 128 | +3. Start the Sophia III services using Docker Compose |
| 129 | + |
| 130 | +## Troubleshooting |
| 131 | + |
| 132 | +- If the script fails to run on Linux, run it with `sudo`. |
| 133 | +- If you encounter any issues with Docker installation: |
| 134 | + - On Linux, ensure you have sudo privileges and that your system is up to date. |
| 135 | + - On macOS and Windows, follow the instructions to install Docker Desktop manually if the script cannot install it automatically. |
| 136 | +- Check the Docker logs for any error messages if the containers fail to start. |
| 137 | +- Verify that all required ports are available and not in use by other services. |
| 138 | +- If the `python` command is not recognized, try using `python3` instead. |
| 139 | + |
| 140 | +## Security Considerations |
| 141 | + |
| 142 | +- The `SOPHIA_III_API_KEY` is automatically generated if not provided. Ensure to keep this key secure and do not share it publicly. |
| 143 | +- When using authentication providers (GitHub, Google, Microsoft), ensure that the client IDs and secrets are kept confidential. |
| 144 | +- Be cautious when enabling file uploads and voice input, as these features may introduce potential security risks if not properly managed. |
0 commit comments