diff --git a/Makefile b/Makefile index 1aea3651..8526872c 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,10 @@ BINARY_NAME=local-ai GOLLAMA_VERSION?=fbec625895ba0c458f783b62c8569135c5e80d79 GPT4ALL_REPO?=https://github.com/nomic-ai/gpt4all GPT4ALL_VERSION?=73db20ba85fbbdc66a56e2619394c0eea40dc72b -GOGGMLTRANSFORMERS_VERSION?=c4c581f1853cf1b66276501c7c0dbea1e3e564b7 +GOGGMLTRANSFORMERS_VERSION?=4f18e5eb75089dc1fc8f1c955bb8f73d18520a46 RWKV_REPO?=https://github.com/donomii/go-rwkv.cpp RWKV_VERSION?=07166da10cb2a9e8854395a4f210464dcea76e47 -WHISPER_CPP_VERSION?=5e2b3407ef46eccebe55a64c100401ab37cc0374 +WHISPER_CPP_VERSION?=9b926844e3ae0ca6a0d13573b2e0349be1a4b573 BERT_VERSION?=cea1ed76a7f48ef386a8e369f6c82c48cdf2d551 BLOOMZ_VERSION?=e9366e82abdfe70565644fbfae9651976714efd1 BUILD_TYPE?= diff --git a/README.md b/README.md index 5b8017e4..60f2ca65 100644 --- a/README.md +++ b/README.md @@ -1025,7 +1025,7 @@ There is the availability of localai-webui and chatbot-ui in the examples sectio
-AutoGPT currently doesn't allow to set a different API URL, but there is a PR open for it, so this should be possible soon! +Yes, see the [examples](https://github.com/go-skynet/LocalAI/tree/master/examples/)!
diff --git a/examples/README.md b/examples/README.md index 44525178..0229441b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -4,6 +4,13 @@ Here is a list of projects that can easily be integrated with the LocalAI backen ### Projects +### AutoGPT + +_by [@mudler](https://github.com/mudler)_ + +This example shows how to use AutoGPT with LocalAI. + +[Check it out here](https://github.com/go-skynet/LocalAI/tree/master/examples/autoGPT/) ### Chatbot-UI diff --git a/examples/autoGPT/.env b/examples/autoGPT/.env new file mode 100644 index 00000000..ca0e93e3 --- /dev/null +++ b/examples/autoGPT/.env @@ -0,0 +1,5 @@ +OPENAI_API_KEY=sk---anystringhere +OPENAI_API_BASE=http://api:8080/v1 +# Models to preload at start +# Here we configure gpt4all as gpt-3.5-turbo and bert as embeddings +PRELOAD_MODELS=[{"url": "github:go-skynet/model-gallery/gpt4all-j.yaml", "name": "gpt-3.5-turbo"}, { "url": "github:go-skynet/model-gallery/bert-embeddings.yaml", "name": "text-embedding-ada-002"}] \ No newline at end of file diff --git a/examples/autoGPT/README.md b/examples/autoGPT/README.md new file mode 100644 index 00000000..f5269a3a --- /dev/null +++ b/examples/autoGPT/README.md @@ -0,0 +1,32 @@ +# AutoGPT + +Example of integration with [AutoGPT](https://github.com/Significant-Gravitas/Auto-GPT). + +## Run + +```bash +# Clone LocalAI +git clone https://github.com/go-skynet/LocalAI + +cd LocalAI/examples/autoGPT + +docker-compose run --rm auto-gpt +``` + +Note: The example automatically downloads the `gpt4all` model as it is under a permissive license. The GPT4All model does not seem to be enough to run AutoGPT. WizardLM-7b-uncensored seems to perform better (with `f16: true`). + +See the `.env` configuration file to set a different model with the [model-gallery](https://github.com/go-skynet/model-gallery) by editing `PRELOAD_MODELS`. + +## Without docker + +Run AutoGPT with `OPENAI_API_BASE` pointing to the LocalAI endpoint. If you run it locally for instance: + +``` +OPENAI_API_BASE=http://localhost:8080 python ... +``` + +Note: you need a model named `gpt-3.5-turbo` and `text-embedding-ada-002`. You can preload those in LocalAI at start by setting in the env: + +``` +PRELOAD_MODELS=[{"url": "github:go-skynet/model-gallery/gpt4all-j.yaml", "name": "gpt-3.5-turbo"}, { "url": "github:go-skynet/model-gallery/bert-embeddings.yaml", "name": "text-embedding-ada-002"}] +``` \ No newline at end of file diff --git a/examples/autoGPT/docker-compose.yaml b/examples/autoGPT/docker-compose.yaml new file mode 100644 index 00000000..c3220ad1 --- /dev/null +++ b/examples/autoGPT/docker-compose.yaml @@ -0,0 +1,42 @@ +version: "3.9" +services: + api: + image: quay.io/go-skynet/local-ai:latest + ports: + - 8080:8080 + env_file: + - .env + environment: + - DEBUG=true + - MODELS_PATH=/models + volumes: + - ./models:/models:cached + command: ["/usr/bin/local-ai" ] + auto-gpt: + image: significantgravitas/auto-gpt + depends_on: + api: + condition: service_healthy + redis: + condition: service_started + env_file: + - .env + environment: + MEMORY_BACKEND: ${MEMORY_BACKEND:-redis} + REDIS_HOST: ${REDIS_HOST:-redis} + profiles: ["exclude-from-up"] + volumes: + - ./auto_gpt_workspace:/app/autogpt/auto_gpt_workspace + - ./data:/app/data + ## allow auto-gpt to write logs to disk + - ./logs:/app/logs + ## uncomment following lines if you want to make use of these files + ## you must have them existing in the same folder as this docker-compose.yml + #- type: bind + # source: ./azure.yaml + # target: /app/azure.yaml + #- type: bind + # source: ./ai_settings.yaml + # target: /app/ai_settings.yaml + redis: + image: "redis/redis-stack-server:latest" diff --git a/go.mod b/go.mod index 50cb2c7e..756931b1 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/donomii/go-rwkv.cpp v0.0.0-20230515123100-6fdd0c338e56 - github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230524181101-5e2b3407ef46 + github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230527074028-9b926844e3ae github.com/go-audio/wav v1.1.0 github.com/go-skynet/bloomz.cpp v0.0.0-20230510223001-e9366e82abdf github.com/go-skynet/go-bert.cpp v0.0.0-20230516063724-cea1ed76a7f4 @@ -13,14 +13,14 @@ require ( github.com/gofiber/fiber/v2 v2.46.0 github.com/google/uuid v1.3.0 github.com/hashicorp/go-multierror v1.1.1 - github.com/imdario/mergo v0.3.15 + github.com/imdario/mergo v0.3.16 github.com/mudler/go-stable-diffusion v0.0.0-20230516152536-c0748eca3642 github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20230526132403-a6f3e94458e2 github.com/onsi/ginkgo/v2 v2.9.5 github.com/onsi/gomega v1.27.7 github.com/otiai10/openaigo v1.1.0 github.com/rs/zerolog v1.29.1 - github.com/sashabaranov/go-openai v1.9.4 + github.com/sashabaranov/go-openai v1.9.5 github.com/swaggo/swag v1.16.1 github.com/urfave/cli/v2 v2.25.3 github.com/valyala/fasthttp v1.47.0 diff --git a/go.sum b/go.sum index fbb2816b..0071e7b8 100644 --- a/go.sum +++ b/go.sum @@ -24,6 +24,8 @@ github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230523110439-77eab3fbfe5e github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230523110439-77eab3fbfe5e/go.mod h1:QIjZ9OktHFG7p+/m3sMvrAJKKdWrr1fZIK0rM6HZlyo= github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230524181101-5e2b3407ef46 h1:+STJWsBFikYC90LnR8I9gcBdysQn7Jv9Jb44+5WBi68= github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230524181101-5e2b3407ef46/go.mod h1:QIjZ9OktHFG7p+/m3sMvrAJKKdWrr1fZIK0rM6HZlyo= +github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230527074028-9b926844e3ae h1:uzi5myq/qNX9xiKMRF/fW3HfxuEo2WcnTalwg9fe2hM= +github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230527074028-9b926844e3ae/go.mod h1:QIjZ9OktHFG7p+/m3sMvrAJKKdWrr1fZIK0rM6HZlyo= github.com/go-audio/audio v1.0.0 h1:zS9vebldgbQqktK4H0lUqWrG8P0NxCJVqcj7ZpNnwd4= github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs= github.com/go-audio/riff v1.0.0 h1:d8iCGbDvox9BfLagY94fBynxSPHO80LmZCaOsmKxokA= @@ -79,6 +81,8 @@ github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9 github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= @@ -140,6 +144,8 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sashabaranov/go-openai v1.9.4 h1:KanoCEoowAI45jVXlenMCckutSRr39qOmSi9MyPBfZM= github.com/sashabaranov/go-openai v1.9.4/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= +github.com/sashabaranov/go-openai v1.9.5 h1:z1VCMXsfnug+U0ceTTIXr/L26AYl9jafqA9lptlSX0c= +github.com/sashabaranov/go-openai v1.9.5/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 h1:rmMl4fXJhKMNWl+K+r/fq4FbbKI+Ia2m9hYBLm2h4G4= github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3D/WJsDd1iXHT96alCoN2KJo6/4x1DZC3wZs8= github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4=