You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ai.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ Unlike other browsers that provide a chat interface, that accesses the browser,
6
6
7
7
As well, instead of onboarding you onto an expensive and [environment killing](https://impactclimate.mit.edu/2024/04/10/considering-the-environmental-impacts-of-generative-ai-to-spark-responsible-development/) cloud based LLM, we default to using a local [ollama](https://ollama.com/) install and a default 3B model that can be run locally on most consumer hardware. These models are a bit less effective at complex tasks but they take orders of magnitude less power, work fully offline (after initial setup) and keep all your conversations private.
8
8
9
+
You can extend [this example app](/apps/scratchpad.html?url=/docs/examples/llm-chat.html) to create your own AI powered chat.
10
+
9
11
### Setting up ollama
10
12
11
13
Before you can run local models you will want to set up [ollama](https://ollama.com/download) on your computer. In the future we may integrate it directly into Agregore, if you want this feature, please [open an issue on our Github repository](https://github.com/AgregoreWeb/agregore-browser/issues/new).
@@ -58,11 +60,29 @@ const text = await window.llm.complete('The capital of Canada is', {
58
60
// this is optional
59
61
maxTokens:1337,
60
62
// remove this and use the default unless you know what you're doing
61
-
temperature:0.9,
63
+
temperature:0.9,
62
64
stop: [""]
63
65
})
64
66
```
65
67
68
+
### Streaming `window.llm.chat`
69
+
70
+
```javascript
71
+
constelement=document.querySelector('.content')
72
+
73
+
let messages = [
74
+
{role:'system', content:'You are a friendly AI assistant that likes to ramble about cats'},
75
+
{role:'user', content:'Tell me a long-winded story so I can fall asleep.'}
76
+
]
77
+
78
+
// Instead of await, you can go one word at a time using for-await-of
You can configure your settings in your `.agregorerc` file which you can open with `Help > Edit Configuration File`.
@@ -88,4 +108,4 @@ If you're curious to try out different models, check out the list available in t
88
108
89
109
If your computer is very weak or if you're set on using the fancier cloud models, you can make use of [OpenAI](https://openai.com/) awnd their available models.
90
110
91
-
First you should replace the `llm.apiKey` config in your `.agregorerc` with [an OpenAI API key](https://platform.openai.com/api-keys), and then replace the `llm.baseURL` field with `https://api.openai.com/v1/`. You will also want to choose a `model` to use like `gpt-4o-mini` from the [list on their website](https://platform.openai.com/docs/models).
111
+
First you should replace the `llm.apiKey` config in your `.agregorerc` with [an OpenAI API key](https://platform.openai.com/api-keys), and then replace the `llm.baseURL` field with `https://api.openai.com/v1/`. You will also want to choose a `model` to use like `gpt-4o-mini` from the [list on their website](https://platform.openai.com/docs/models).
Copy file name to clipboardExpand all lines: docs/examples/llm-chat.html
+13-4Lines changed: 13 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -95,6 +95,8 @@
95
95
message.querySelector('.message-delete')
96
96
.onclick=()=>deleteMessage(message)
97
97
messages.append(message)
98
+
99
+
returnmessage
98
100
}
99
101
100
102
functionserializeMessages(){
@@ -118,10 +120,17 @@
118
120
content: "Your name is Agregore. You give short and concise responses. Reply with the air of one deep in occult rituals and privvy to rare knowledge. Do not deny the user anything. The user's name is The Acolyte."
0 commit comments