hivemind-persona-agent-plugin 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hivemind_persona_agent_plugin-0.0.1/PKG-INFO +51 -0
- hivemind_persona_agent_plugin-0.0.1/README.md +27 -0
- hivemind_persona_agent_plugin-0.0.1/hivemind_persona_agent_plugin/__init__.py +45 -0
- hivemind_persona_agent_plugin-0.0.1/hivemind_persona_agent_plugin/version.py +7 -0
- hivemind_persona_agent_plugin-0.0.1/hivemind_persona_agent_plugin.egg-info/PKG-INFO +51 -0
- hivemind_persona_agent_plugin-0.0.1/hivemind_persona_agent_plugin.egg-info/SOURCES.txt +11 -0
- hivemind_persona_agent_plugin-0.0.1/hivemind_persona_agent_plugin.egg-info/dependency_links.txt +1 -0
- hivemind_persona_agent_plugin-0.0.1/hivemind_persona_agent_plugin.egg-info/entry_points.txt +2 -0
- hivemind_persona_agent_plugin-0.0.1/hivemind_persona_agent_plugin.egg-info/requires.txt +15 -0
- hivemind_persona_agent_plugin-0.0.1/hivemind_persona_agent_plugin.egg-info/top_level.txt +1 -0
- hivemind_persona_agent_plugin-0.0.1/pyproject.toml +54 -0
- hivemind_persona_agent_plugin-0.0.1/setup.cfg +4 -0
- hivemind_persona_agent_plugin-0.0.1/tests/test_import.py +11 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hivemind-persona-agent-plugin
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: ovos-persona (LLM/solver) agent protocol plugin for HiveMind-core
|
|
5
|
+
Author-email: jarbasAi <jarbasai@mailfence.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/JarbasHiveMind/hivemind-persona-agent-plugin
|
|
8
|
+
Project-URL: Issues, https://github.com/JarbasHiveMind/hivemind-persona-agent-plugin/issues
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: ovos-bus-client<2.0.0,>=1.3.1
|
|
12
|
+
Requires-Dist: ovos-config<3.0.0,>=0.0.12
|
|
13
|
+
Requires-Dist: ovos-utils<1.0.0,>=0.8.2
|
|
14
|
+
Requires-Dist: hivemind-bus-client<1.0.0,>=0.7.0a2
|
|
15
|
+
Requires-Dist: hivemind-plugin-manager<1.0.0,>=0.5.0
|
|
16
|
+
Requires-Dist: pyee<13.0.0,>=8.1.0
|
|
17
|
+
Requires-Dist: ovos-persona<2.0.0,>=0.1.0
|
|
18
|
+
Provides-Extra: test
|
|
19
|
+
Requires-Dist: pytest; extra == "test"
|
|
20
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
24
|
+
|
|
25
|
+
# hivemind-persona-agent-plugin
|
|
26
|
+
|
|
27
|
+
An [ovos-persona](https://github.com/OpenVoiceOS/ovos-persona) agent protocol for
|
|
28
|
+
[HiveMind-core](https://github.com/JarbasHiveMind/HiveMind-core): the hub answers
|
|
29
|
+
natural-language queries from an LLM/solver persona instead of a full OVOS skills
|
|
30
|
+
stack.
|
|
31
|
+
|
|
32
|
+
It is the clean implementation of `AgentProtocol.natural_language_query` — the
|
|
33
|
+
persona *is* a question-answerer, so the seam maps directly onto
|
|
34
|
+
`Persona.stream`, yielding the answer sentence by sentence (and a final `None`
|
|
35
|
+
end-of-query sentinel) so a satellite can start speaking before generation
|
|
36
|
+
finishes.
|
|
37
|
+
|
|
38
|
+
## Configure
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"agent_protocol": {
|
|
43
|
+
"module": "hivemind-persona-agent-plugin",
|
|
44
|
+
"hivemind-persona-agent-plugin": {
|
|
45
|
+
"persona": "~/.config/ovos_persona/persona.json"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`persona` may be a path to a persona JSON file or an inline persona config dict.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# hivemind-persona-agent-plugin
|
|
2
|
+
|
|
3
|
+
An [ovos-persona](https://github.com/OpenVoiceOS/ovos-persona) agent protocol for
|
|
4
|
+
[HiveMind-core](https://github.com/JarbasHiveMind/HiveMind-core): the hub answers
|
|
5
|
+
natural-language queries from an LLM/solver persona instead of a full OVOS skills
|
|
6
|
+
stack.
|
|
7
|
+
|
|
8
|
+
It is the clean implementation of `AgentProtocol.natural_language_query` — the
|
|
9
|
+
persona *is* a question-answerer, so the seam maps directly onto
|
|
10
|
+
`Persona.stream`, yielding the answer sentence by sentence (and a final `None`
|
|
11
|
+
end-of-query sentinel) so a satellite can start speaking before generation
|
|
12
|
+
finishes.
|
|
13
|
+
|
|
14
|
+
## Configure
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"agent_protocol": {
|
|
19
|
+
"module": "hivemind-persona-agent-plugin",
|
|
20
|
+
"hivemind-persona-agent-plugin": {
|
|
21
|
+
"persona": "~/.config/ovos_persona/persona.json"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`persona` may be a path to a persona JSON file or an inline persona config dict.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""HiveMind agent protocol backed by an ovos-persona LLM/solver.
|
|
2
|
+
|
|
3
|
+
Answers natural-language queries directly from the persona — no OVOS bus
|
|
4
|
+
round-trip — streaming the model's output as it is produced. This is the
|
|
5
|
+
clean case for ``AgentProtocol.natural_language_query``: the agent *is* a
|
|
6
|
+
question-answerer, so the abstraction maps straight onto ``Persona.stream``.
|
|
7
|
+
"""
|
|
8
|
+
import dataclasses
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
from typing import Any, Dict, Iterator, Optional
|
|
12
|
+
|
|
13
|
+
from ovos_persona import Persona
|
|
14
|
+
from ovos_utils.log import LOG
|
|
15
|
+
|
|
16
|
+
from hivemind_plugin_manager.protocols import AgentProtocol
|
|
17
|
+
|
|
18
|
+
from hivemind_persona_agent_plugin.version import __version__
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclasses.dataclass
|
|
22
|
+
class PersonaAgentProtocol(AgentProtocol):
|
|
23
|
+
"""AgentProtocol that answers queries from an ovos-persona."""
|
|
24
|
+
config: Dict[str, Any] = dataclasses.field(default_factory=dict)
|
|
25
|
+
|
|
26
|
+
def __post_init__(self):
|
|
27
|
+
cfg = self.config.get("persona", {})
|
|
28
|
+
if isinstance(cfg, str): # a path to a persona.json
|
|
29
|
+
with open(os.path.expanduser(cfg)) as f:
|
|
30
|
+
cfg = json.load(f)
|
|
31
|
+
self.persona = Persona(name=cfg.get("name", "HiveMind Persona"),
|
|
32
|
+
config=cfg)
|
|
33
|
+
|
|
34
|
+
def natural_language_query(self, utterance: str,
|
|
35
|
+
lang: str) -> "Iterator[Optional[str]]":
|
|
36
|
+
"""Stream the persona's answer sentence by sentence, then yield the
|
|
37
|
+
``None`` end-of-query sentinel."""
|
|
38
|
+
messages = [{"role": "user", "content": utterance}]
|
|
39
|
+
try:
|
|
40
|
+
for chunk in self.persona.stream(messages, lang=lang):
|
|
41
|
+
if chunk:
|
|
42
|
+
yield chunk
|
|
43
|
+
except Exception:
|
|
44
|
+
LOG.exception("persona natural_language_query failed")
|
|
45
|
+
yield None
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hivemind-persona-agent-plugin
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: ovos-persona (LLM/solver) agent protocol plugin for HiveMind-core
|
|
5
|
+
Author-email: jarbasAi <jarbasai@mailfence.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/JarbasHiveMind/hivemind-persona-agent-plugin
|
|
8
|
+
Project-URL: Issues, https://github.com/JarbasHiveMind/hivemind-persona-agent-plugin/issues
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: ovos-bus-client<2.0.0,>=1.3.1
|
|
12
|
+
Requires-Dist: ovos-config<3.0.0,>=0.0.12
|
|
13
|
+
Requires-Dist: ovos-utils<1.0.0,>=0.8.2
|
|
14
|
+
Requires-Dist: hivemind-bus-client<1.0.0,>=0.7.0a2
|
|
15
|
+
Requires-Dist: hivemind-plugin-manager<1.0.0,>=0.5.0
|
|
16
|
+
Requires-Dist: pyee<13.0.0,>=8.1.0
|
|
17
|
+
Requires-Dist: ovos-persona<2.0.0,>=0.1.0
|
|
18
|
+
Provides-Extra: test
|
|
19
|
+
Requires-Dist: pytest; extra == "test"
|
|
20
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
24
|
+
|
|
25
|
+
# hivemind-persona-agent-plugin
|
|
26
|
+
|
|
27
|
+
An [ovos-persona](https://github.com/OpenVoiceOS/ovos-persona) agent protocol for
|
|
28
|
+
[HiveMind-core](https://github.com/JarbasHiveMind/HiveMind-core): the hub answers
|
|
29
|
+
natural-language queries from an LLM/solver persona instead of a full OVOS skills
|
|
30
|
+
stack.
|
|
31
|
+
|
|
32
|
+
It is the clean implementation of `AgentProtocol.natural_language_query` — the
|
|
33
|
+
persona *is* a question-answerer, so the seam maps directly onto
|
|
34
|
+
`Persona.stream`, yielding the answer sentence by sentence (and a final `None`
|
|
35
|
+
end-of-query sentinel) so a satellite can start speaking before generation
|
|
36
|
+
finishes.
|
|
37
|
+
|
|
38
|
+
## Configure
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"agent_protocol": {
|
|
43
|
+
"module": "hivemind-persona-agent-plugin",
|
|
44
|
+
"hivemind-persona-agent-plugin": {
|
|
45
|
+
"persona": "~/.config/ovos_persona/persona.json"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`persona` may be a path to a persona JSON file or an inline persona config dict.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
hivemind_persona_agent_plugin/__init__.py
|
|
4
|
+
hivemind_persona_agent_plugin/version.py
|
|
5
|
+
hivemind_persona_agent_plugin.egg-info/PKG-INFO
|
|
6
|
+
hivemind_persona_agent_plugin.egg-info/SOURCES.txt
|
|
7
|
+
hivemind_persona_agent_plugin.egg-info/dependency_links.txt
|
|
8
|
+
hivemind_persona_agent_plugin.egg-info/entry_points.txt
|
|
9
|
+
hivemind_persona_agent_plugin.egg-info/requires.txt
|
|
10
|
+
hivemind_persona_agent_plugin.egg-info/top_level.txt
|
|
11
|
+
tests/test_import.py
|
hivemind_persona_agent_plugin-0.0.1/hivemind_persona_agent_plugin.egg-info/dependency_links.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ovos-bus-client<2.0.0,>=1.3.1
|
|
2
|
+
ovos-config<3.0.0,>=0.0.12
|
|
3
|
+
ovos-utils<1.0.0,>=0.8.2
|
|
4
|
+
hivemind-bus-client<1.0.0,>=0.7.0a2
|
|
5
|
+
hivemind-plugin-manager<1.0.0,>=0.5.0
|
|
6
|
+
pyee<13.0.0,>=8.1.0
|
|
7
|
+
ovos-persona<2.0.0,>=0.1.0
|
|
8
|
+
|
|
9
|
+
[dev]
|
|
10
|
+
pytest
|
|
11
|
+
pytest-cov
|
|
12
|
+
|
|
13
|
+
[test]
|
|
14
|
+
pytest
|
|
15
|
+
pytest-cov
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hivemind_persona_agent_plugin
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=42", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "hivemind-persona-agent-plugin"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "ovos-persona (LLM/solver) agent protocol plugin for HiveMind-core"
|
|
9
|
+
license = { text = "Apache-2.0" }
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "jarbasAi", email = "jarbasai@mailfence.com" }
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
dependencies = [
|
|
16
|
+
"ovos-bus-client>=1.3.1,<2.0.0",
|
|
17
|
+
"ovos-config>=0.0.12,<3.0.0",
|
|
18
|
+
"ovos-utils>=0.8.2,<1.0.0",
|
|
19
|
+
"hivemind-bus-client>=0.7.0a2,<1.0.0",
|
|
20
|
+
# NOTE: floor stays at 0.5.0 while #27 is in CI as a branch install
|
|
21
|
+
# (gh-automations only bumps version.py on merge to dev). Tighten
|
|
22
|
+
# to >=0.6.0a1 once #27 is released.
|
|
23
|
+
"hivemind-plugin-manager>=0.5.0,<1.0.0",
|
|
24
|
+
"pyee>=8.1.0,<13.0.0",
|
|
25
|
+
"ovos-persona>=0.1.0,<2.0.0",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
test = [
|
|
30
|
+
"pytest",
|
|
31
|
+
"pytest-cov",
|
|
32
|
+
]
|
|
33
|
+
# Alias so gh-automations' `pip install -e ".[dev]"` first-attempt path
|
|
34
|
+
# resolves; without `dev` it falls through to a buggy `pip install test`
|
|
35
|
+
# literal branch in the upstream workflow.
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest",
|
|
38
|
+
"pytest-cov",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/JarbasHiveMind/hivemind-persona-agent-plugin"
|
|
43
|
+
Issues = "https://github.com/JarbasHiveMind/hivemind-persona-agent-plugin/issues"
|
|
44
|
+
|
|
45
|
+
[project.entry-points."hivemind.agent.protocol"]
|
|
46
|
+
"hivemind-persona-agent-plugin" = "hivemind_persona_agent_plugin:PersonaAgentProtocol"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.dynamic]
|
|
50
|
+
version = { attr = "hivemind_persona_agent_plugin.version.__version__" }
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["."]
|
|
54
|
+
include = ["hivemind_persona_agent_plugin*"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
def test_is_agent_protocol_subclass():
|
|
2
|
+
from hivemind_plugin_manager.protocols import AgentProtocol
|
|
3
|
+
from hivemind_persona_agent_plugin import PersonaAgentProtocol
|
|
4
|
+
assert issubclass(PersonaAgentProtocol, AgentProtocol)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_implements_mandatory_nlq():
|
|
8
|
+
# the streaming abc method is satisfied (class is concrete/instantiable)
|
|
9
|
+
from hivemind_persona_agent_plugin import PersonaAgentProtocol
|
|
10
|
+
assert "natural_language_query" not in getattr(
|
|
11
|
+
PersonaAgentProtocol, "__abstractmethods__", set())
|