From 7492a3ab3becf801d53f9a5cc9e71765ea6daa72 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Wed, 5 Mar 2025 22:19:07 +0100 Subject: [PATCH] Change env vars to be more meaningful --- LICENSE | 21 +++++ README.md | 122 +++++++++++++++++++++++++++--- core/agent/agent_suite_test.go | 2 +- docker-compose.yaml | 4 +- main.go | 14 ++-- services/actions/genimage_test.go | 2 +- 6 files changed, 143 insertions(+), 22 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..65ebf26 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023-2025 Ettore Di Giacinto (mudler@localai.io) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index bd5eb33..392d62c 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,110 @@ +

+ LocalAgent Logo +

-![b644008916041](https://github.com/user-attachments/assets/304ad402-5ddc-441b-a4b9-55ff9eec72be) +
+ +[![Go Report Card](https://goreportcard.com/badge/github.com/mudler/LocalAgent)](https://goreportcard.com/report/github.com/mudler/LocalAgent) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![GitHub stars](https://img.shields.io/github/stars/mudler/LocalAgent)](https://github.com/mudler/LocalAgent/stargazers) +[![GitHub issues](https://img.shields.io/github/issues/mudler/LocalAgent)](https://github.com/mudler/LocalAgent/issues) + +
+**LocalAgent** is an AI Agent platform with the aim to runs 100% locally on your machine. Designed for privacy, efficiency, and flexibility, LocalAgent allows you to build, deploy, and interact with AI agents without sending your data to external services. -Check also: +## Features + +- **100% Local Execution**: All processing happens on your own hardware - no data leaves your machine +- **Multiple Model Support**: Compatible with various local LLM formats (GGUF, GGML, etc.) +- **Extensible Architecture**: Build custom agents with specialized capabilities +- **Web-based GUI**: User-friendly interface for easy interaction with your agents +- **RESTful API**: Comprehensive API for developers to integrate LocalAgent into their applications +- **Works well locally!**: It is well tested and meant to work with [LocalAI](https://github.com/mudler/LocalAI) +- **Cross-platform**: Works on Linux, macOS, and Windows + +LocalAgent is part of a set of open source tools aimed to streamline AI usage locally, see also its sister projects: - [LocalAI](https://github.com/mudler/LocalAI) - [LocalRAG](https://github.com/mudler/LocalRAG) -## Connectors +## Installation -### Github (issues) +### Prerequisites -Create an user and a PAT token: +For building from source: + +- Go 1.20 or later +- Git + +### From Source + +```bash +# Clone the repository +git clone https://github.com/mudler/LocalAgent.git +cd LocalAgent + +# Build the application +go build -o localagent + +# Run LocalAgent +./localagent +``` + +### Using Docker containers + +```bash +docker run -ti -p 3000:3000 -v quay.io/mudler/localagent +``` + +### Pre-built Binaries + +Download the pre-built binaries for your platform from the [Releases](https://github.com/mudler/LocalAgent/releases) page. + +## Getting Started + +After installation, you can start LocalAgent with default settings: + +```bash +./localagent +``` + +This will start both the API server and the web interface. By default, the web interface is accessible at `http://localhost:3000`. + +### Environment Variables + +LocalAgent can be configured using the following environment variables: + +| Variable | Description | +|-------------------------------|--------------------------------------------------| +| `LOCALAGENT_MODEL` | Specifies the test model to use | +| `LOCALAGENT_LLM_API_URL` | URL of the API server | +| `LOCALAGENT_API_KEY` | API key for authentication | +| `LOCALAGENT_TIMEOUT` | Timeout duration for requests | +| `LOCALAGENT_STATE_DIR` | Directory to store state information | +| `LOCALAGENT_LOCALRAG_URL` | LocalRAG URL | +| `LOCALAGENT_ENABLE_CONVERSATIONS_LOGGING`| Enable or disable logging of conversations | + +## Documentation + +### Connectors + +LocalAgent can be connected to a wide range of services. Each service support a set of configuration, examples are provided below for every connector. + +#### Github (issues) + +Create an user and a PAT token, and associate to a repository: ```json { "token": "PAT_TOKEN", - "repository": "testrepo", - "owner": "ci-forks", - "botUserName": "localai-bot" + "repository": "repository-to-watch-issues", + "owner": "repository-owner", + "botUserName": "username" } ``` -### Discord +#### Discord Follow the steps in: https://discordpy.readthedocs.io/en/stable/discord.html to create a discord bot. @@ -35,7 +117,7 @@ The token of the bot is in the "Bot" tab. Also enable " Message Content Intent " } ``` -### Slack +#### Slack See slack.yaml @@ -52,7 +134,7 @@ In the UI, when configuring the connector: } ``` -### Telegram +#### Telegram Ask a token to @botfather @@ -61,3 +143,21 @@ In the UI, when configuring the connector: ```json { "token": "botfathertoken" } ``` + +### REST API + +The LocalAgent API follows RESTful principles and uses JSON for request and response bodies. + + + + + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +--- + +

+ Made with ❤️ by mudler +

\ No newline at end of file diff --git a/core/agent/agent_suite_test.go b/core/agent/agent_suite_test.go index 7db5e21..ca0f602 100644 --- a/core/agent/agent_suite_test.go +++ b/core/agent/agent_suite_test.go @@ -13,7 +13,7 @@ func TestAgent(t *testing.T) { RunSpecs(t, "Agent test suite") } -var testModel = os.Getenv("TEST_MODEL") +var testModel = os.Getenv("LOCALAGENT_MODEL") var apiModel = os.Getenv("API_MODEL") func init() { diff --git a/docker-compose.yaml b/docker-compose.yaml index 61ce167..b641faf 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -38,8 +38,8 @@ services: ports: - 8080:3000 environment: - - TEST_MODEL=marco-o1 + - LOCALAGENT_MODEL=marco-o1 - EMBEDDING_MODEL=bert-embeddings - - API_URL=http://api:8080 + - LOCALAGENT_LLM_API_URL=http://api:8080 volumes: - ./data/:/pool diff --git a/main.go b/main.go index ce1c309..f460dc0 100644 --- a/main.go +++ b/main.go @@ -10,13 +10,13 @@ import ( "github.com/mudler/LocalAgent/webui" ) -var testModel = os.Getenv("TEST_MODEL") -var apiURL = os.Getenv("API_URL") -var apiKey = os.Getenv("API_KEY") -var timeout = os.Getenv("TIMEOUT") -var stateDir = os.Getenv("STATE_DIR") -var localRAG = os.Getenv("LOCAL_RAG") -var withLogs = os.Getenv("ENABLE_CONVERSATIONS_LOGGING") == "true" +var testModel = os.Getenv("LOCALAGENT_MODEL") +var apiURL = os.Getenv("LOCALAGENT_LLM_API_URL") +var apiKey = os.Getenv("LOCALAGENT_API_KEY") +var timeout = os.Getenv("LOCALAGENT_TIMEOUT") +var stateDir = os.Getenv("LOCALAGENT_STATE_DIR") +var localRAG = os.Getenv("LOCALAGENT_LOCALRAG_URL") +var withLogs = os.Getenv("LOCALAGENT_ENABLE_CONVERSATIONS_LOGGING") == "true" func init() { if testModel == "" { diff --git a/services/actions/genimage_test.go b/services/actions/genimage_test.go index f0af8bf..9aef316 100644 --- a/services/actions/genimage_test.go +++ b/services/actions/genimage_test.go @@ -22,7 +22,7 @@ var _ = Describe("GenImageAction", func() { BeforeEach(func() { ctx = context.Background() apiKey := os.Getenv("OPENAI_API_KEY") - apiURL := os.Getenv("OPENAI_API_URL") + apiURL := os.Getenv("OPENAI_LOCALAGENT_API_URL") testModel := os.Getenv("OPENAI_MODEL") if apiURL == "" { Skip("OPENAI_API_URL must be set")