OVOS OpenAI Plugin
Leverages OpenAI Completions API to provide the following ovos plugins:
ovos-solver-openai-pluginfor usage with ovos-persona (and in older ovos releases with ovos-skill-fallback-chatgpt)ovos-dialog-transformer-openai-pluginto rewrite OVOS dialogs just before TTS executes in ovos-audioovos-summarizer-openai-pluginto summarize text, not used directly but provided for consumption by other plugins/skills
Install
pip install ovos-openai-plugin
Persona Usage
To create your own persona using a OpenAI compatible server create a .json in ~/.config/ovos_persona/llm.json:
{
"name": "My Local LLM",
"solvers": [
"ovos-solver-openai-plugin"
],
"ovos-solver-openai-plugin": {
"api_url": "https://llama.smartgic.io/v1",
"key": "sk-xxxx",
"system_prompt": "You are helping assistant who gives very short and factual answers in maximum twenty words and you don't use emojis",
"model": "llama3.1:8b"
}
}
Then say "Chat with {name_from_json}" to enable it, more details can be found in ovos-persona README
This plugins also provides a default "Remote LLama" demo persona, it points to a public server hosted by @goldyfruit.
Dialog Transformer
you can rewrite text dynamically based on specific personas, such as simplifying explanations or mimicking a specific tone.
Example Usage:
rewrite_prompt:"rewrite the text as if you were explaining it to a 5-year-old"- Input:
"Quantum mechanics is a branch of physics that describes the behavior of particles at the smallest scales." - Output:
"Quantum mechanics is like a special kind of science that helps us understand really tiny things."
Examples of rewrite_prompt Values:
"rewrite the text as if it was an angry old man speaking""Add more 'dude'ness to it""Explain it like you're teaching a child"
To enable this plugin, add the following to your mycroft.conf:
"dialog_transformers": {
"ovos-dialog-transformer-openai-plugin": {
"system_prompt": "Your task is to rewrite text as if it was spoken by a different character",
"rewrite_prompt": "rewrite the text as if you were explaining it to a 5-year-old"
}
}
💡 the user utterance will be appended after
rewrite_promptfor the actual query
Direct Usage
from ovos_solver_openai_persona import OpenAIPersonaSolver
bot = OpenAIPersonaSolver({"key": "sk-XXX",
"persona": "helpful, creative, clever, and very friendly"})
print(bot.get_spoken_answer("describe quantum mechanics in simple terms"))
# 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.
print(bot.spoken_answer("Quem encontrou o caminho maritimo para o Brazil", lang="pt-pt"))
# Explorador português Pedro Álvares Cabral é creditado com a descoberta do Brasil em 1500
Remote Persona / Proxies
You can run any persona behind a OpenAI compatible server via ovos-persona-server.
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.
Then just configure this plugin to point to your persona server like it was OpenAI
Metadata
Release files for ovos-openai-plugin 2.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ovos_openai_plugin-2.0.6.tar.gz | 13.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ovos_openai_plugin-2.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.4 kB
Release files / ovos_openai_plugin-2.0.6.tar.gz
| Download URL | ovos_openai_plugin-2.0.6.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0165fa1798b21b69700e9fe976b960f8ac624d06c52ac961c32eff64501b147b
|
|
BLAKE2b-256 checksum How to use checksums |
be0ea399ddbf1cca3e716100a01b401b352b268cab16c32a0b1628bf8227a099
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / ovos_openai_plugin-2.0.6-py3-none-any.whl
| Download URL | ovos_openai_plugin-2.0.6-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
730b0730b79fe71800a05749c519fe2d5c88d8a5ceabb1d9a408f08b4d073eeb
|
|
BLAKE2b-256 checksum How to use checksums |
2ddd060a54ca63aedf64b52701f93c6450701971a55e7d736bf303f38a2fa561
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|