Skip to content

Commit df2c7ab

Browse files
authored
Merge pull request #22 from OpenVoiceOS/rename
refactor!:rename package
1 parent a8be121 commit df2c7ab

File tree

5 files changed

+64
-26
lines changed

5 files changed

+64
-26
lines changed

.github/workflows/downstream.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch: # Allows manual triggering
99

1010
env:
11-
TARGET_PACKAGE: "ovos-solver-openai-persona-plugin" # Set the package to track here
11+
TARGET_PACKAGE: "ovos-openai-plugin" # Set the package to track here
1212

1313
jobs:
1414
check-dependencies:

.github/workflows/license_tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
requirements: 'requirements-all.txt'
3838
fail: 'Copyleft,Other,Error'
3939
fails-only: true
40-
exclude: '^(ovos-solver-openai-persona-plugin).*'
40+
exclude: '^(ovos-openai-plugin).*'
4141
exclude-license: '^(Mozilla).*$'
4242
- name: Print report
4343
if: ${{ always() }}

README.md

+57-19
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,60 @@
1-
# <img src='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
1+
# <img src='https://raw.githack.com/FortAwesome/Font-Awesome/master/svgs/solid/robot.svg' card_color='#40DBB0' width='50' height='50' style='vertical-align:bottom'/> OVOS OpenAI Plugin
22

3-
Give OpenVoiceOS some sass with OpenAI!
3+
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
47

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
69

10+
`pip install ovos-openai-plugin`
711

8-
## Usage
12+
## Persona Usage
913

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
1158

1259
```python
1360
from ovos_solver_openai_persona import OpenAIPersonaSolver
@@ -16,25 +63,16 @@ bot = OpenAIPersonaSolver({"key": "sk-XXX",
1663
"persona": "helpful, creative, clever, and very friendly"})
1764
print(bot.get_spoken_answer("describe quantum mechanics in simple terms"))
1865
# 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"))
2067
# Explorador português Pedro Álvares Cabral é creditado com a descoberta do Brasil em 1500
2168

2269
```
2370

24-
This plugin will work with [ovos-persona-server](https://github.com/OpenVoiceOS/ovos-persona-server)
71+
## Remote Persona / Proxies
2572

26-
## Configuration
73+
You can run any persona behind a OpenAI compatible server via [ovos-persona-server](https://github.com/OpenVoiceOS/ovos-persona-server).
2774

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.
2976

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
3978

40-
When using LocalAI, the `"key"` can be anything, but it has to exist.

ovos_solver_openai_persona/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ def get_spoken_answer(self, query: str,
4343
LLAMA_DEMO = {
4444
"name": "Remote LLama",
4545
"solvers": [
46-
"ovos-solver-openai-persona-plugin"
46+
"ovos-solver-openai-plugin"
4747
],
48-
"ovos-solver-openai-persona-plugin": {
48+
"ovos-solver-openai-plugin": {
4949
"api_url": "https://llama.smartgic.io/v1",
5050
"key": "sk-xxxx"
5151
}
5252
}
5353

5454

5555
if __name__ == "__main__":
56-
bot = OpenAIPersonaSolver(LLAMA_DEMO["ovos-solver-openai-persona-plugin"])
56+
bot = OpenAIPersonaSolver(LLAMA_DEMO["ovos-solver-openai-plugin"])
5757
#for utt in bot.stream_utterances("describe quantum mechanics in simple terms"):
5858
# print(utt)
5959
# Quantum mechanics is a branch of physics that studies the behavior of atoms and particles at the smallest scales.

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ def get_version():
4848

4949

5050
PERSONA_ENTRY_POINT = 'Remote Llama=ovos_solver_openai_persona:LLAMA_DEMO'
51-
PLUGIN_ENTRY_POINT = 'ovos-solver-openai-persona-plugin=ovos_solver_openai_persona:OpenAIPersonaSolver'
51+
PLUGIN_ENTRY_POINT = 'ovos-solver-openai-plugin=ovos_solver_openai_persona:OpenAIPersonaSolver'
5252
DIALOG_PLUGIN_ENTRY_POINT = 'ovos-dialog-transformer-openai-plugin=ovos_solver_openai_persona.dialog_transformers:OpenAIDialogTransformer'
5353
SUMMARIZER_ENTRY_POINT = 'ovos-summarizer-openai-plugin=ovos_solver_openai_persona.summarizer:OpenAISummarizer'
5454

5555

5656
setup(
57-
name='ovos-solver-openai-persona-plugin',
57+
name='ovos-openai-plugin',
5858
version=get_version(),
5959
description='A question solver plugin for ovos',
6060
url='https://github.com/OpenVoiceOS/ovos-solver-plugin-openai-persona',

0 commit comments

Comments
 (0)