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: README.md
+57-19
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,60 @@
1
-
# <imgsrc='https://raw.githack.com/FortAwesome/Font-Awesome/master/svgs/solid/robot.svg'card_color='#40DBB0'width='50'height='50'style='vertical-align:bottom'/> OpenAI Persona
Leverages [OpenAI Completions API](https://platform.openai.com/docs/api-reference/completions/create) to provide the following ovos plugins:
4
+
-`ovos-solver-openai-plugin` for usage with [ovos-persona](https://github.com/OpenVoiceOS/ovos-persona) (and in older ovos releases with [ovos-skill-fallback-chatgpt]())
5
+
-`ovos-dialog-transformer-openai-plugin` to rewrite OVOS dialogs just before TTS executes in [ovos-audio](https://github.com/OpenVoiceOS/ovos-audio)
6
+
-`ovos-summarizer-openai-plugin` to summarize text, not used directly but provided for consumption by other plugins/skills
4
7
5
-
Leverages [OpenAI Completions API](https://platform.openai.com/docs/api-reference/completions/create) to create some fun interactions. Phrases not explicitly handled by other skills will be run by a LLM, so nearly every interaction will have _some_ response. But be warned, Mycroft might become a bit obnoxious...
8
+
## Install
6
9
10
+
`pip install ovos-openai-plugin`
7
11
8
-
## Usage
12
+
## Persona Usage
9
13
10
-
Spoken answers api with OpenAI or [LocalAI](https://github.com/go-skynet/LocalAI) completions backend, prompt engineering is used to behave like a voice assistant
14
+
To create your own persona using a OpenAI compatible server create a .json in `~/.config/ovos_persona/llm.json`:
15
+
```json
16
+
{
17
+
"name": "My Local LLM",
18
+
"solvers": [
19
+
"ovos-solver-openai-plugin"
20
+
],
21
+
"ovos-openai-plugin": {
22
+
"api_url": "https://llama.smartgic.io/v1",
23
+
"key": "sk-xxxx",
24
+
"persona": "helpful, creative, clever, and very friendly."
25
+
}
26
+
}
27
+
```
28
+
29
+
Then say "Chat with {name_from_json}" to enable it, more details can be found in [ovos-persona](https://github.com/OpenVoiceOS/ovos-persona) README
30
+
31
+
This plugins also provides a default "Remote LLama" demo persona, it points to a public server hosted by @goldyfruit.
32
+
33
+
## Dialog Transformer
34
+
35
+
you can rewrite text dynamically based on specific personas, such as simplifying explanations or mimicking a specific tone.
36
+
37
+
#### Example Usage:
38
+
-**Persona:**`"rewrite the text as if you were explaining it to a 5-year-old"`
39
+
-**Input:**`"Quantum mechanics is a branch of physics that describes the behavior of particles at the smallest scales."`
40
+
-**Output:**`"Quantum mechanics is like a special kind of science that helps us understand really tiny things."`
41
+
42
+
Examples of `persona` Values:
43
+
-`"rewrite the text as if it was an angry old man speaking"`
44
+
-`"Add more 'dude'ness to it"`
45
+
-`"Explain it like you're teaching a child"`
46
+
47
+
To enable this plugin, add the following to your `mycroft.conf`:
48
+
49
+
```json
50
+
"dialog_transformers": {
51
+
"ovos-dialog-transformer-openai-plugin": {
52
+
"rewrite_prompt": "rewrite the text as if you were explaining it to a 5-year-old"
53
+
}
54
+
}
55
+
```
56
+
57
+
## Direct Usage
11
58
12
59
```python
13
60
from ovos_solver_openai_persona import OpenAIPersonaSolver
"persona": "helpful, creative, clever, and very friendly"})
17
64
print(bot.get_spoken_answer("describe quantum mechanics in simple terms"))
18
65
# Quantum mechanics is a branch of physics that deals with the behavior of particles on a very small scale, such as atoms and subatomic particles. It explores the idea that particles can exist in multiple states at once and that their behavior is not predictable in the traditional sense.
19
-
print(bot.spoken_answer("Quem encontrou o caminho maritimo para o Brazil", {"lang": "pt-pt"}))
66
+
print(bot.spoken_answer("Quem encontrou o caminho maritimo para o Brazil", lang="pt-pt"))
20
67
# Explorador português Pedro Álvares Cabral é creditado com a descoberta do Brasil em 1500
21
68
22
69
```
23
70
24
-
This plugin will work with [ovos-persona-server](https://github.com/OpenVoiceOS/ovos-persona-server)
71
+
## Remote Persona / Proxies
25
72
26
-
## Configuration
73
+
You can run any persona behind a OpenAI compatible server via [ovos-persona-server](https://github.com/OpenVoiceOS/ovos-persona-server).
27
74
28
-
This plugin can be configured to use a LocalAI server instead of OpenAI.
75
+
This allows you to offload the workload to a standalone server, either for performance reasons or to keep api keys in a single safe place.
29
76
30
-
```json
31
-
{
32
-
"api_url": <your_local_LocalAI_server_url>,
33
-
"key": <your_OpenAI_key>,
34
-
"enable_memory": true,
35
-
"memory_size": 15,
36
-
"initial_prompt": "You are a helpful assistant."
37
-
}
38
-
```
77
+
Then just configure this plugin to point to your persona server like it was OpenAI
39
78
40
-
When using LocalAI, the `"key"` can be anything, but it has to exist.
0 commit comments