diff options
-rw-r--r-- | README.md | 152 |
1 files changed, 118 insertions, 34 deletions
@@ -8,22 +8,28 @@ _Image artificially created by Midjourney through a prompt generated by a Nano B https://user-images.githubusercontent.com/113217272/238141567-c58a240c-7b67-4b3b-864a-0f49bbf6e22f.mp4 - [Setup](#setup) - - [Docker](#docker) + - [OpenAI ChatGPT](#openai-chatgpt) + - [Google Gemini](#google-gemini) + - [Docker](#docker) + - [OpenAI ChatGPT](#openai-chatgpt-1) + - [Google Gemini](#google-gemini-1) - [Usage](#usage) - - [Command Line](#command-line) - - [Library](#library) + - [Command Line](#command-line) + - [Library](#library) - [Cartridges](#cartridges) - - [Tools (Functions)](#tools-functions) - - [Experimental Clojure Support](#experimental-clojure-support) - - [Marketplace](#marketplace) + - [OpenAI ChatGPT](#openai-chatgpt-2) + - [Google Gemini](#google-gemini-2) + - [Tools (Functions)](#tools-functions) + - [Experimental Clojure Support](#experimental-clojure-support) + - [Marketplace](#marketplace) - [Security and Privacy](#security-and-privacy) - - [Cryptography](#cryptography) - - [End-user IDs](#end-user-ids) - - [Decrypting](#decrypting) + - [Cryptography](#cryptography) + - [End-user IDs](#end-user-ids) + - [Decrypting](#decrypting) - [Providers](#providers) - [Debugging](#debugging) - [Development](#development) - - [Publish to RubyGems](#publish-to-rubygems) + - [Publish to RubyGems](#publish-to-rubygems) ## Setup @@ -45,6 +51,8 @@ bundle install For credentials and configurations, relevant environment variables can be set in your `.bashrc`, `.zshrc`, or equivalent files, as well as in your Docker Container or System Environment. Example: +### OpenAI ChatGPT + ```sh export OPENAI_API_ADDRESS=https://api.openai.com export OPENAI_API_KEY=your-access-token @@ -69,6 +77,36 @@ NANO_BOTS_END_USER=your-user # NANO_BOTS_CARTRIDGES_DIRECTORY=/home/user/.local/share/nano-bots/cartridges ``` +### Google Gemini + +Click [here](https://github.com/gbaptista/gemini-ai#credentials) to learn how to obtain your credentials. + +```sh +export GOOGLE_CREDENTIALS_FILE_PATH=google-credentials.json +export GOOGLE_PROJECT_ID=your-project-id +export GOOGLE_REGION=us-east4 + +export NANO_BOTS_ENCRYPTION_PASSWORD=UNSAFE +export NANO_BOTS_END_USER=your-user + +# export NANO_BOTS_STATE_DIRECTORY=/home/user/.local/state/nano-bots +# export NANO_BOTS_CARTRIDGES_DIRECTORY=/home/user/.local/share/nano-bots/cartridges +``` + +Alternatively, if your current directory has a `.env` file with the environment variables, they will be automatically loaded: + +```sh +GOOGLE_CREDENTIALS_FILE_PATH=google-credentials.json +GOOGLE_PROJECT_ID=your-project-id +GOOGLE_REGION=us-east4 + +NANO_BOTS_ENCRYPTION_PASSWORD=UNSAFE +NANO_BOTS_END_USER=your-user + +# NANO_BOTS_STATE_DIRECTORY=/home/user/.local/state/nano-bots +# NANO_BOTS_CARTRIDGES_DIRECTORY=/home/user/.local/share/nano-bots/cartridges +``` + ## Docker Clone the repository and copy the Docker Compose template: @@ -81,6 +119,8 @@ cp docker-compose.example.yml docker-compose.yml Set your provider credentials and choose your desired directory for the cartridges files: +### OpenAI ChatGPT + ```yaml --- services: @@ -97,6 +137,28 @@ services: - ./your-state-path:/root/.local/state/nano-bots ``` +### Google Gemini + +```yaml +--- +services: + nano-bots: + image: ruby:3.2.2-slim-bookworm + command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 1.1.2 && bash" + environment: + GOOGLE_CREDENTIALS_FILE_PATH: /root/.config/google-credentials.json + GOOGLE_PROJECT_ID: your-project-id + GOOGLE_REGION: us-east4 + NANO_BOTS_ENCRYPTION_PASSWORD: UNSAFE + NANO_BOTS_END_USER: your-user + volumes: + - ./google-credentials.json:/root/.config/google-credentials.json + - ./your-cartridges:/root/.local/share/nano-bots/cartridges + - ./your-state-path:/root/.local/state/nano-bots +``` + +### Container + Enter the container: ```sh docker compose run nano-bots @@ -246,8 +308,16 @@ end ## Cartridges +Check the Nano Bots specification to learn more about [how to build cartridges](https://spec.nbots.io/#/README?id=cartridges). + +Try the [Nano Bots Clinic (Live Editor)](https://clinic.nbots.io) to learn about creating Cartridges. + Here's what a Nano Bot Cartridge looks like: +### OpenAI ChatGPT + +Read the [full specification](https://spec.nbots.io/#/README?id=open-ai-chatgpt) for OpenAI ChatGPT. + ```yaml --- meta: @@ -269,12 +339,36 @@ provider: access-token: ENV/OPENAI_API_KEY settings: user: ENV/NANO_BOTS_END_USER - model: gpt-3.5-turbo + model: gpt-4-1106-preview ``` -Check the Nano Bots specification to learn more about [how to build cartridges](https://spec.nbots.io/#/README?id=cartridges). +### Google Gemini -Try the [Nano Bots Clinic (Live Editor)](https://clinic.nbots.io) to learn about creating Cartridges. +Read the [full specification](https://spec.nbots.io/#/README?id=google-gemini) for Google Gemini. + +```yaml +--- +meta: + symbol: 🤖 + name: Nano Bot Name + author: Your Name + version: 1.0.0 + license: CC0-1.0 + description: A helpful assistant. + +behaviors: + interaction: + directive: You are a helpful assistant. + +provider: + id: google + credentials: + project-id: ENV/GOOGLE_PROJECT_ID + file-path: ENV/GOOGLE_CREDENTIALS_FILE_PATH + region: ENV/GOOGLE_REGION + options: + model: gemini-pro +``` ### Tools (Functions) @@ -301,22 +395,9 @@ The randomly generated number is 59. 🤖> | ``` +To successfully use Tools (Functions), you need to specify a provider and a model that supports them. As of the writing of this README, the provider that supports them is [OpenAI](https://platform.openai.com/docs/models), with models `gpt-3.5-turbo-1106` and `gpt-4-1106-preview`, and [Google](https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/function-calling#supported_models), with the model `gemini-pro`. -To successfully use Tools (Functions), you need to specify a provider and a model that support them. As of the writing of this README, the provider that supports them is [OpenAI](https://platform.openai.com/docs/models), with models `gpt-3.5-turbo-1106` and `gpt-4-1106-preview`: - -```yaml ---- -provider: - id: openai - credentials: - address: ENV/OPENAI_API_ADDRESS - access-token: ENV/OPENAI_API_KEY - settings: - user: ENV/NANO_BOTS_END_USER - model: gpt-4-1106-preview -``` - -Check the [Nano Bots specification](https://spec.nbots.io/#/README?id=tools-functions-2) to learn more about them. +Check the [Nano Bots specification](https://spec.nbots.io/#/README?id=tools-functions-2) to learn more about Tools (Functions). #### Experimental Clojure Support @@ -469,13 +550,16 @@ If you lose your password, you lose your data. It is not possible to recover it Currently supported providers: -- [x] [FastChat (Vicuna)](https://github.com/lm-sys/FastChat) -- [x] [Open AI](https://platform.openai.com/docs/api-reference) -- [ ] [Google PaLM](https://developers.generativeai.google/) -- [ ] [Alpaca](https://github.com/tatsu-lab/stanford_alpaca) -- [ ] [LLaMA](https://github.com/facebookresearch/llama) +- [x] [Open AI ChatGPT](https://platform.openai.com/docs/api-reference) +- [x] [Google Gemini](https://cloud.google.com/vertex-ai/docs/generative-ai/model-reference/gemini) +- [ ] [Anthropic Claude](https://www.anthropic.com) +- [ ] [Cohere Command](https://cohere.com) +- [ ] [Meta Llama](https://ai.meta.com/llama/) +- [ ] [01.AI Yi](https://01.ai) +- [ ] [WizardLM](https://wizardlm.github.io) +- [ ] [LMSYS Org FastChat Vicuna](https://github.com/lm-sys/FastChat) -Although only OpenAI has been officially tested, some of the open-source providers offer APIs that are compatible with OpenAI, such as [FastChat](https://github.com/lm-sys/FastChat#openai-compatible-restful-apis--sdk). Therefore, it is highly probable that they will work just fine. +Although only OpenAI ChatGPT and Google Gemini have been officially tested, some alternative providers offer APIs that are compatible with, for example, OpenAI, such as [FastChat](https://github.com/lm-sys/FastChat#openai-compatible-restful-apis--sdk). Therefore, it is highly probable that they will work just fine. ## Development |