ollama-bot

command module
v0.0.0-...-a0ba5c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: GPL-2.0 Imports: 20 Imported by: 0

README

ollama-bot

This is a rudimentary IRC bot that communicates with a local instance of ollama.

Installation

You'll need to have ollama installed in order to actually use the bot. Instructions for doing that are out of scope for this document. Then, build the bot from source:

git clone 'https://git.2mb.codes/~cmb/ollama-bot
cd ollama-bot
go build

Put the ollama-bot binary on your $PATH. We run this on a Void Linux host. Runit services for both the bot and ollama itself are included in the ollama-bot repository, along with some instructions for getting it running under runit. If you use something else, you're on your own, but of course, patches are welcome.

Configuration

The program searches for its configuration file in one of several places, in the following order, and uses the first file it finds:

~/.config/ollama-bot/ollama-bot.toml
/usr/local/etc/ollama-bot/ollama-bot.toml
/etc/ollama-bot/ollama-bot.toml

The configuration file should contain one or more network definitions. I.E., it is an array of tables using toml notation. Look at the file config.toml.sample for a sample configuration.

Usage

Once the bot is connected to one or more IRC networks, you can converse with it, either by highlighting it in a channel, or by sending it a private message. For the most part, you just send it free-form text, and it will respond with free-form text. However, it also accepts various commands, preceded by an exclamation mark !. Send !help for a list of commands. Use of the commands is best demonstrated by an example chat transcript.

Chat Transcript
<chris> ai-bot: !help
<ai-bot> 
<ai-bot> This bot supports the following commands:
<ai-bot> !describe URL [model] -- Describe image at URL, optionally choosing model
<ai-bot> !switch-text-model -- Start a conversation using a different text model
<ai-bot> !list-text-models -- List models usable for text conversation
<ai-bot> !list-image-models -- List models usable for image description
<ai-bot> !help -- This command.
<chris> ai-bot: !list-image-models
<ai-bot> This bot supports the following image models: llava, llava:13b, bakllava
<chris> ai-bot: !list-text-models
<ai-bot> This bot supports the following text models: mistral:instruct, llama2, llama2-uncensored
<chris> ai-bot: !describe https://the-brannons.com/chris-and-bird.jpg llava:13b
<ai-bot>  The image features a bearded man with a bird perched on his shoulder. The bird is small, likely a parrot or a similar type of pet bird. The man appears to be in a relaxed setting, possibly sitting down while enjoying the company with his feathered companion.
<chris> ai-bot: What kind of beard does he have?
<ai-bot>  While I cannot precisely describe the man's beard style without more specific information, it is safe to say that he has some form of facial hair on his face. This could range from a full beard to a goatee or even just a five o'clock shadow.
# Use the default model, bakllava.  This resets conversation state.
<chris> ai-bot: !describe https://the-brannons.com/chris-and-bird.jpg
<ai-bot> 
<ai-bot> The image features a bearded man with a bird perched on his shoulder. The man has an odd facial expression, almost as if he is looking into the camera. The bird appears to be a parrot and is sitting close to the man's ear.
<ai-bot> 
<ai-bot> The scene takes place in a room furnished with a couch and a chair. The couch is positioned in the background, while the chair occupies a smaller portion of the frame on the left side.
<chris> ai-bot: Tell me about his beard?
<ai-bot> 
<ai-bot> The bearded man in the image has an odd facial expression, making his appearance quite distinctive. His beard seems to be well-groomed and likely represents a fashionable or stylish choice in his personal grooming.
<chris> ai-bot: What do you mean by odd facial expression?
<ai-bot> 
<ai-bot> By odd facial expression, I refer to the man's facial features looking unnatural, exaggerated, or distorted. This may include an awkward smile, squinting, or an unusual or contorted countenance. The phrase "what the heck" implies that the person's appearance seems out of the ordinary or unexpected, which adds a humorous and quirky touch to the image.
# Switch back to text chat, selecting a model and resetting conversation state:
<chris> ai-bot: !switch-text-model llama2-uncensored
<ai-bot> Text model switched.
<chris> ai-bot: Somebody on the Internet told me that I can believe everything I read on the Internet?  Were they full of shit?
<ai-bot> Unfortunately, no. This statement is not true. There are many websites and sources on the internet that provide incorrect or misleading information. It's important to be careful when using any online source for information and to verify it by checking multiple sources or contacting a reliable expert.
<chris> ai-bot: But Wikipedia is always reliable!
<ai-bot> Wikipedia is an excellent resource, but it's not infallible. Like any encyclopedia, it can be edited and updated by anyone with access to the website. While most of the information on Wikipedia is accurate, there are some inaccuracies and errors that may exist due to human error or deliberate vandalism. It's always a good idea to cross-reference information from different sources before relying solely on any one source.
<chris> ai-bot: Could you tell me about some known examples of errors in Wikipedia?  Otherwise, I'm just gonna assume you're full of it.
<ai-bot> Sure! One well-known example of an error in Wikipedia is the article on Abraham Lincoln. The entry stated that Lincoln was the first president to receive a patent for his invention - which was actually issued after he left office. Another example is the article on the Apollo 11 mission, which claimed that Neil Armstrong's quote "One small step" was misquoted from an interview with President John F. Kennedy. However, NASA confirmed that the quote used in Wikipedia w
<ai-bot> as
<ai-bot> accurate and had been recorded during the mission.

Why?

Because most of the people in the group behind this are hard-core free software people to some degree or other. We want to see access to AI liberated and democratized, I.E., free as in freedom. And almost as importantly, it sounded like fun when we were bored on a Friday afternoon.

Licensed as GPL-2 to match the license of irc-go.

Thanks

The group behind ollama-bot consists of Kirk, Tyler, Mike, and Chris, plus the peanut gallery on IRC.

We use the irc-go package from Jason Donenfeld. This seems to have been an excellent choice.

This project would not be possible without ollama.

Code hosting is graciously provided by the fine people at 2MB Solutions.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL