added ollama

This commit is contained in:
Radnos 2024-04-05 23:41:28 +02:00
parent ad717cdaff
commit 17c0ce3c25
2 changed files with 11 additions and 1 deletions

View file

@ -8,7 +8,7 @@ This project allows an AI model to write/execute code on your computer that may
## Requirements
- [OpenAI API Subscription](https://openai.com/blog/openai-api), [Gemini API Subscription](https://aistudio.google.com/app/apikey), or [Anthropic API Subscription](https://docs.anthropic.com/claude/docs/getting-access-to-claude)
- [OpenAI API Subscription](https://openai.com/blog/openai-api), [Gemini API Subscription](https://aistudio.google.com/app/apikey), [Anthropic API Subscription](https://docs.anthropic.com/claude/docs/getting-access-to-claude), or [Ollama](https://ollama.com/download)
- [Minecraft Java Edition](https://www.minecraft.net/en-us/store/minecraft-java-bedrock-edition-pc)
- [Node.js](https://nodejs.org/) (at least v14)
@ -19,6 +19,10 @@ Add one of these environment variables:
- `GEMINI_API_KEY`
- `ANTHROPIC_API_KEY` (and optionally `OPENAI_API_KEY` for embeddings. not necessary, but without embeddings performance will suffer)
You can also use Ollama instead.
To install the models used by default (generation and embedding), execute the following script:
`ollama pull mistral && ollama pull nomic-embed-text`
Clone/Download this repository
Run `npm install`
@ -33,6 +37,7 @@ Run `node main.js`
You can configure the agent's name, model, and prompts in their profile like `andy.json`.
You can configure ollama in `ollama-config.json`.
You can configure project details in `settings.json`. Here is an example settings for connecting to a non-local server:
```
@ -45,6 +50,8 @@ You can configure project details in `settings.json`. Here is an example setting
}
```
## Patches
Some of the node modules that we depend on have bugs in them. To add a patch, change your local node module file and run `npx patch-package [package-name]`

View file

@ -8,6 +8,7 @@ import { getCommand } from './commands/index.js';
import { Gemini } from '../models/gemini.js';
import { GPT } from '../models/gpt.js';
import { Claude } from '../models/claude.js';
import { Ollama } from '../models/ollama.js';
export class Prompter {
@ -30,6 +31,8 @@ export class Prompter {
this.model = new GPT(model_name);
else if (model_name.includes('claude'))
this.model = new Claude(model_name);
else if (model_name.includes('ollama'))
this.model = new Ollama(model_name);
else
throw new Error('Unknown model ' + model_name);
}