pawagent 0.1.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.
- pawagent-0.1.1/LICENSE +21 -0
- pawagent-0.1.1/PKG-INFO +324 -0
- pawagent-0.1.1/README.md +302 -0
- pawagent-0.1.1/cli/__init__.py +1 -0
- pawagent-0.1.1/cli/main.py +319 -0
- pawagent-0.1.1/pawagent/__init__.py +5 -0
- pawagent-0.1.1/pawagent/agents/__init__.py +15 -0
- pawagent-0.1.1/pawagent/agents/behavior_agent.py +28 -0
- pawagent-0.1.1/pawagent/agents/expression_agent.py +115 -0
- pawagent-0.1.1/pawagent/agents/mood_agent.py +39 -0
- pawagent-0.1.1/pawagent/agents/motivation_agent.py +28 -0
- pawagent-0.1.1/pawagent/agents/personality_agent.py +15 -0
- pawagent-0.1.1/pawagent/agents/translate_agent.py +3 -0
- pawagent-0.1.1/pawagent/audio/__init__.py +1 -0
- pawagent-0.1.1/pawagent/audio/analyzer.py +53 -0
- pawagent-0.1.1/pawagent/audio/preprocess.py +7 -0
- pawagent-0.1.1/pawagent/core/__init__.py +1 -0
- pawagent-0.1.1/pawagent/core/agent.py +14 -0
- pawagent-0.1.1/pawagent/core/content_hash.py +13 -0
- pawagent-0.1.1/pawagent/core/images.py +66 -0
- pawagent-0.1.1/pawagent/core/orchestrator.py +10 -0
- pawagent-0.1.1/pawagent/core/unified_analysis.py +64 -0
- pawagent-0.1.1/pawagent/core/workflow.py +8 -0
- pawagent-0.1.1/pawagent/expression/__init__.py +11 -0
- pawagent-0.1.1/pawagent/expression/store.py +98 -0
- pawagent-0.1.1/pawagent/identity/__init__.py +21 -0
- pawagent-0.1.1/pawagent/identity/cropper.py +147 -0
- pawagent-0.1.1/pawagent/identity/embedder.py +103 -0
- pawagent-0.1.1/pawagent/identity/service.py +65 -0
- pawagent-0.1.1/pawagent/identity/store.py +72 -0
- pawagent-0.1.1/pawagent/memory/__init__.py +3 -0
- pawagent-0.1.1/pawagent/memory/context_builder.py +11 -0
- pawagent-0.1.1/pawagent/memory/history.py +8 -0
- pawagent-0.1.1/pawagent/memory/store.py +83 -0
- pawagent-0.1.1/pawagent/memory/summarizer.py +15 -0
- pawagent-0.1.1/pawagent/models/__init__.py +41 -0
- pawagent-0.1.1/pawagent/models/analysis.py +106 -0
- pawagent-0.1.1/pawagent/models/behavior.py +14 -0
- pawagent-0.1.1/pawagent/models/identity.py +43 -0
- pawagent-0.1.1/pawagent/models/media.py +10 -0
- pawagent-0.1.1/pawagent/models/mood.py +13 -0
- pawagent-0.1.1/pawagent/models/personality.py +19 -0
- pawagent-0.1.1/pawagent/models/pet.py +9 -0
- pawagent-0.1.1/pawagent/personality/__init__.py +4 -0
- pawagent-0.1.1/pawagent/personality/profiler.py +35 -0
- pawagent-0.1.1/pawagent/personality/store.py +69 -0
- pawagent-0.1.1/pawagent/personality/traits.py +6 -0
- pawagent-0.1.1/pawagent/personality/updater.py +22 -0
- pawagent-0.1.1/pawagent/providers/__init__.py +17 -0
- pawagent-0.1.1/pawagent/providers/base.py +27 -0
- pawagent-0.1.1/pawagent/providers/cli_base.py +53 -0
- pawagent-0.1.1/pawagent/providers/codex_provider.py +202 -0
- pawagent-0.1.1/pawagent/providers/errors.py +17 -0
- pawagent-0.1.1/pawagent/providers/factory.py +27 -0
- pawagent-0.1.1/pawagent/providers/gemini_cli_provider.py +103 -0
- pawagent-0.1.1/pawagent/providers/gemini_provider.py +118 -0
- pawagent-0.1.1/pawagent/providers/mock_provider.py +413 -0
- pawagent-0.1.1/pawagent/providers/openai_provider.py +131 -0
- pawagent-0.1.1/pawagent/providers/parsing.py +120 -0
- pawagent-0.1.1/pawagent/video/__init__.py +1 -0
- pawagent-0.1.1/pawagent/video/analyzer.py +77 -0
- pawagent-0.1.1/pawagent/vision/__init__.py +3 -0
- pawagent-0.1.1/pawagent/vision/analyzer.py +79 -0
- pawagent-0.1.1/pawagent/vision/preprocess.py +9 -0
- pawagent-0.1.1/pawagent/vision/prompts.py +151 -0
- pawagent-0.1.1/pawagent.egg-info/PKG-INFO +324 -0
- pawagent-0.1.1/pawagent.egg-info/SOURCES.txt +89 -0
- pawagent-0.1.1/pawagent.egg-info/dependency_links.txt +1 -0
- pawagent-0.1.1/pawagent.egg-info/entry_points.txt +2 -0
- pawagent-0.1.1/pawagent.egg-info/requires.txt +10 -0
- pawagent-0.1.1/pawagent.egg-info/top_level.txt +2 -0
- pawagent-0.1.1/pyproject.toml +55 -0
- pawagent-0.1.1/setup.cfg +4 -0
- pawagent-0.1.1/tests/test_behavior_agent.py +54 -0
- pawagent-0.1.1/tests/test_cli.py +355 -0
- pawagent-0.1.1/tests/test_codex_provider.py +92 -0
- pawagent-0.1.1/tests/test_gemini_cli_provider.py +56 -0
- pawagent-0.1.1/tests/test_gemini_provider.py +112 -0
- pawagent-0.1.1/tests/test_identity_service.py +83 -0
- pawagent-0.1.1/tests/test_identity_store.py +77 -0
- pawagent-0.1.1/tests/test_images.py +69 -0
- pawagent-0.1.1/tests/test_json_memory_store.py +51 -0
- pawagent-0.1.1/tests/test_mood_agent.py +28 -0
- pawagent-0.1.1/tests/test_openai_provider.py +118 -0
- pawagent-0.1.1/tests/test_personality_agent.py +80 -0
- pawagent-0.1.1/tests/test_personality_profile_store.py +23 -0
- pawagent-0.1.1/tests/test_prompts.py +50 -0
- pawagent-0.1.1/tests/test_provider_parsing.py +115 -0
- pawagent-0.1.1/tests/test_translate_agent.py +72 -0
- pawagent-0.1.1/tests/test_unified_analysis_cache.py +92 -0
- pawagent-0.1.1/tests/test_vision_analyzer.py +78 -0
pawagent-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PawAgent-AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pawagent-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pawagent
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A Python library for building AI systems that understand pets.
|
|
5
|
+
Author-email: Jack Fish <okjackfish@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/PawAgent-AI/pawagent
|
|
8
|
+
Project-URL: Repository, https://github.com/PawAgent-AI/pawagent
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: google-genai<2,>=1.30.0
|
|
13
|
+
Requires-Dist: openai<2,>=1.99.0
|
|
14
|
+
Requires-Dist: pillow<12,>=10
|
|
15
|
+
Requires-Dist: pydantic<3,>=2.7
|
|
16
|
+
Provides-Extra: identity
|
|
17
|
+
Requires-Dist: pillow<12,>=10; extra == "identity"
|
|
18
|
+
Requires-Dist: torch<3,>=2.4; extra == "identity"
|
|
19
|
+
Requires-Dist: torchvision<1,>=0.19; extra == "identity"
|
|
20
|
+
Requires-Dist: open-clip-torch<3,>=2.26; extra == "identity"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# PawAgent
|
|
24
|
+
|
|
25
|
+
PawAgent is a Python framework for pet understanding from images and short videos.
|
|
26
|
+
|
|
27
|
+
It provides a reusable analysis stack for:
|
|
28
|
+
|
|
29
|
+
- Emotion analysis
|
|
30
|
+
- Behavior analysis
|
|
31
|
+
- Motivation prediction
|
|
32
|
+
- Expression rendering
|
|
33
|
+
- Pet identity enrollment and verification
|
|
34
|
+
|
|
35
|
+
PawAgent is a library, not a web service. It is intended to sit underneath a separate runtime or application layer.
|
|
36
|
+
|
|
37
|
+
## Status
|
|
38
|
+
|
|
39
|
+
- Core media analysis: implemented
|
|
40
|
+
- Image and short-video task views: implemented
|
|
41
|
+
- Identity verification: implemented
|
|
42
|
+
- Real local identity path (`maskrcnn + openclip`): implemented
|
|
43
|
+
- Audio: internal extension path, not a primary user-facing workflow
|
|
44
|
+
- Live streaming: out of scope for the current product surface
|
|
45
|
+
|
|
46
|
+
## Why This Project
|
|
47
|
+
|
|
48
|
+
Most pet-AI demos collapse everything into one opaque caption. PawAgent instead separates:
|
|
49
|
+
|
|
50
|
+
- direct observations
|
|
51
|
+
- second-layer inference
|
|
52
|
+
- human-readable rendering
|
|
53
|
+
|
|
54
|
+
That makes the results easier to cache, explain, reuse, and evaluate.
|
|
55
|
+
|
|
56
|
+
## Core Model
|
|
57
|
+
|
|
58
|
+
One image or short video produces one unified analysis result:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"emotion": {},
|
|
63
|
+
"behavior": {},
|
|
64
|
+
"motivation": {},
|
|
65
|
+
"expression": {},
|
|
66
|
+
"evidence": []
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Task-specific agents then read from that shared result instead of re-calling the model.
|
|
71
|
+
|
|
72
|
+
Result layering:
|
|
73
|
+
|
|
74
|
+
- First layer: `emotion`, `behavior`
|
|
75
|
+
- Second layer: `motivation`
|
|
76
|
+
- Expression layer: `expression`
|
|
77
|
+
|
|
78
|
+
## Feature Matrix
|
|
79
|
+
|
|
80
|
+
| Capability | Image | Short Video | Notes |
|
|
81
|
+
| --- | --- | --- | --- |
|
|
82
|
+
| Emotion | Yes | Yes | First-layer structured result |
|
|
83
|
+
| Behavior | Yes | Yes | Video usually gives stronger behavior cues |
|
|
84
|
+
| Motivation | Yes | Yes | Second-layer inference from emotion + behavior |
|
|
85
|
+
| Expression | Yes | Yes | Stable rendering over structured analysis |
|
|
86
|
+
| Identity | Yes | No | Separate verification pipeline |
|
|
87
|
+
| Audio | Internal | Internal | Not a primary user-facing workflow |
|
|
88
|
+
|
|
89
|
+
## Quick Start
|
|
90
|
+
|
|
91
|
+
Install for development:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install -e .
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Run the mock provider:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
.venv/bin/python -m cli.main analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
101
|
+
.venv/bin/python -m cli.main analyze-behavior clip.mp4 --pet-id pet-1 --pet-name Milo --modality video
|
|
102
|
+
.venv/bin/python -m cli.main express-pet dog.jpg --pet-id pet-1 --pet-name Milo --locale zh-CN
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Install identity extras:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install -e ".[identity]"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Run real local identity verification:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
.venv/bin/python -m cli.main enroll-identity tests/coconut.jpg --pet-id pet-1 --identity-cropper maskrcnn --identity-embedder openclip
|
|
115
|
+
.venv/bin/python -m cli.main verify-identity tests/coconut.jpg --pet-id pet-1 --identity-cropper maskrcnn --identity-embedder openclip
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## CLI Overview
|
|
119
|
+
|
|
120
|
+
Task-view commands:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pawagent analyze-emotion <source> --modality image|video
|
|
124
|
+
pawagent analyze-behavior <source> --modality image|video
|
|
125
|
+
pawagent analyze-motivation <source> --modality image|video
|
|
126
|
+
pawagent express-pet <source> --modality image|video
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Identity commands:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pawagent enroll-identity <source> --pet-id <pet-id>
|
|
133
|
+
pawagent verify-identity <source> --pet-id <pet-id>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Example Commands
|
|
137
|
+
|
|
138
|
+
Image emotion:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
.venv/bin/python -m cli.main analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Short-video behavior:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
.venv/bin/python -m cli.main analyze-behavior clip.mp4 --pet-id pet-1 --pet-name Milo --modality video
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Localized expression:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
.venv/bin/python -m cli.main express-pet dog.jpg --pet-id pet-1 --pet-name Milo --locale zh-CN
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
HEIC input:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
.venv/bin/python -m cli.main analyze-emotion tests/coconut.heic --pet-id pet-1 --pet-name Coconut
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Image Formats
|
|
163
|
+
|
|
164
|
+
Supported image inputs include:
|
|
165
|
+
|
|
166
|
+
- `JPG`
|
|
167
|
+
- `PNG`
|
|
168
|
+
- `WEBP`
|
|
169
|
+
- `HEIC`
|
|
170
|
+
- `HEIF`
|
|
171
|
+
|
|
172
|
+
`HEIC/HEIF` inputs are decoded locally before provider upload or identity fingerprinting.
|
|
173
|
+
|
|
174
|
+
On macOS, PawAgent can fall back to the system `sips` converter when `pillow-heif` is unavailable.
|
|
175
|
+
|
|
176
|
+
## Providers
|
|
177
|
+
|
|
178
|
+
Built-in provider options:
|
|
179
|
+
|
|
180
|
+
- `mock`
|
|
181
|
+
- `openai`
|
|
182
|
+
- `gemini`
|
|
183
|
+
- `gemini-cli`
|
|
184
|
+
- `codex`
|
|
185
|
+
|
|
186
|
+
### OpenAI
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
export OPENAI_API_KEY=your_api_key
|
|
190
|
+
.venv/bin/python -m cli.main --provider openai --openai-model gpt-4.1-mini analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
OpenAI Platform API integration uses API keys for server-side model calls.
|
|
194
|
+
|
|
195
|
+
### Gemini
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
export GEMINI_API_KEY=your_api_key
|
|
199
|
+
.venv/bin/python -m cli.main --provider gemini --gemini-model gemini-2.5-flash analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Codex CLI
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
codex login
|
|
206
|
+
.venv/bin/python -m cli.main --provider codex --codex-model gpt-5.4 analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
This provider shells out to the local `codex` CLI and reuses its existing login state.
|
|
210
|
+
|
|
211
|
+
### Gemini CLI
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
gemini
|
|
215
|
+
.venv/bin/python -m cli.main --provider gemini-cli --gemini-model gemini-2.5-flash analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Identity
|
|
219
|
+
|
|
220
|
+
Identity is separate from emotion and behavior analysis. It uses its own profile store and should be treated as probabilistic verification, not biometric certainty.
|
|
221
|
+
|
|
222
|
+
Implementation paths:
|
|
223
|
+
|
|
224
|
+
- Fallback path: `noop` cropper + `hash` embedder
|
|
225
|
+
- Intended local path: `maskrcnn` cropper + `openclip` embedder
|
|
226
|
+
|
|
227
|
+
Identity enrollment is append-only. Repeated `enroll-identity` calls for the same `pet-id` add new reference views instead of overwriting the profile.
|
|
228
|
+
|
|
229
|
+
### Real Local Identity Notes
|
|
230
|
+
|
|
231
|
+
- the first `openclip` run may download files into `.pawagent/hf-cache` and `.pawagent/torch-cache`
|
|
232
|
+
- a Hugging Face unauthenticated-request warning during first download is expected
|
|
233
|
+
- `HF_TOKEN` is optional for public models and only improves download rate limits
|
|
234
|
+
- verification compares against all enrolled references for the target `pet-id`
|
|
235
|
+
|
|
236
|
+
## Architecture
|
|
237
|
+
|
|
238
|
+
```text
|
|
239
|
+
Task Views
|
|
240
|
+
-> Unified Analysis
|
|
241
|
+
-> Capability Layer (vision / video)
|
|
242
|
+
-> Provider Layer
|
|
243
|
+
|
|
244
|
+
Supporting layers:
|
|
245
|
+
- Memory / cache
|
|
246
|
+
- Identity
|
|
247
|
+
- Shared models
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Key design rules:
|
|
251
|
+
|
|
252
|
+
- one source item should map to one unified analysis result
|
|
253
|
+
- repeated task-view requests should reuse cached analysis
|
|
254
|
+
- localized expression may use a lightweight second pass and is cached separately
|
|
255
|
+
- identity should never reuse emotion/behavior memory as its source of truth
|
|
256
|
+
|
|
257
|
+
## Repository Layout
|
|
258
|
+
|
|
259
|
+
```text
|
|
260
|
+
pawagent/
|
|
261
|
+
├── cli/
|
|
262
|
+
├── docs/
|
|
263
|
+
├── examples/
|
|
264
|
+
├── pawagent/
|
|
265
|
+
│ ├── agents/
|
|
266
|
+
│ ├── core/
|
|
267
|
+
│ ├── expression/
|
|
268
|
+
│ ├── identity/
|
|
269
|
+
│ ├── memory/
|
|
270
|
+
│ ├── models/
|
|
271
|
+
│ ├── personality/
|
|
272
|
+
│ ├── providers/
|
|
273
|
+
│ ├── video/
|
|
274
|
+
│ └── vision/
|
|
275
|
+
├── tests/
|
|
276
|
+
└── pyproject.toml
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Library Example
|
|
280
|
+
|
|
281
|
+
```python
|
|
282
|
+
from pathlib import Path
|
|
283
|
+
|
|
284
|
+
from pawagent.agents.mood_agent import PetEmotionAgent
|
|
285
|
+
from pawagent.memory.store import InMemoryAnalysisStore
|
|
286
|
+
from pawagent.personality.profiler import PersonalityProfiler
|
|
287
|
+
from pawagent.providers.mock_provider import MockProvider
|
|
288
|
+
|
|
289
|
+
memory = InMemoryAnalysisStore()
|
|
290
|
+
agent = PetEmotionAgent(
|
|
291
|
+
provider=MockProvider(),
|
|
292
|
+
memory_store=memory,
|
|
293
|
+
profiler=PersonalityProfiler(memory),
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
result = agent.analyze_image(
|
|
297
|
+
image_path=Path("dog.jpg"),
|
|
298
|
+
pet_id="pet-1",
|
|
299
|
+
pet_name="Milo",
|
|
300
|
+
species="unknown",
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
print(result.mood.primary)
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Documentation
|
|
307
|
+
|
|
308
|
+
- [Architecture](docs/architecture.md)
|
|
309
|
+
- [Concepts](docs/concepts.md)
|
|
310
|
+
- [Specification](docs/spec.md)
|
|
311
|
+
|
|
312
|
+
## Contributing
|
|
313
|
+
|
|
314
|
+
Useful contribution areas:
|
|
315
|
+
|
|
316
|
+
- vision and video analysis
|
|
317
|
+
- behavior and motivation quality
|
|
318
|
+
- identity verification quality
|
|
319
|
+
- provider integrations
|
|
320
|
+
- documentation and benchmarks
|
|
321
|
+
|
|
322
|
+
## License
|
|
323
|
+
|
|
324
|
+
MIT License. See [LICENSE](LICENSE).
|
pawagent-0.1.1/README.md
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# PawAgent
|
|
2
|
+
|
|
3
|
+
PawAgent is a Python framework for pet understanding from images and short videos.
|
|
4
|
+
|
|
5
|
+
It provides a reusable analysis stack for:
|
|
6
|
+
|
|
7
|
+
- Emotion analysis
|
|
8
|
+
- Behavior analysis
|
|
9
|
+
- Motivation prediction
|
|
10
|
+
- Expression rendering
|
|
11
|
+
- Pet identity enrollment and verification
|
|
12
|
+
|
|
13
|
+
PawAgent is a library, not a web service. It is intended to sit underneath a separate runtime or application layer.
|
|
14
|
+
|
|
15
|
+
## Status
|
|
16
|
+
|
|
17
|
+
- Core media analysis: implemented
|
|
18
|
+
- Image and short-video task views: implemented
|
|
19
|
+
- Identity verification: implemented
|
|
20
|
+
- Real local identity path (`maskrcnn + openclip`): implemented
|
|
21
|
+
- Audio: internal extension path, not a primary user-facing workflow
|
|
22
|
+
- Live streaming: out of scope for the current product surface
|
|
23
|
+
|
|
24
|
+
## Why This Project
|
|
25
|
+
|
|
26
|
+
Most pet-AI demos collapse everything into one opaque caption. PawAgent instead separates:
|
|
27
|
+
|
|
28
|
+
- direct observations
|
|
29
|
+
- second-layer inference
|
|
30
|
+
- human-readable rendering
|
|
31
|
+
|
|
32
|
+
That makes the results easier to cache, explain, reuse, and evaluate.
|
|
33
|
+
|
|
34
|
+
## Core Model
|
|
35
|
+
|
|
36
|
+
One image or short video produces one unified analysis result:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"emotion": {},
|
|
41
|
+
"behavior": {},
|
|
42
|
+
"motivation": {},
|
|
43
|
+
"expression": {},
|
|
44
|
+
"evidence": []
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Task-specific agents then read from that shared result instead of re-calling the model.
|
|
49
|
+
|
|
50
|
+
Result layering:
|
|
51
|
+
|
|
52
|
+
- First layer: `emotion`, `behavior`
|
|
53
|
+
- Second layer: `motivation`
|
|
54
|
+
- Expression layer: `expression`
|
|
55
|
+
|
|
56
|
+
## Feature Matrix
|
|
57
|
+
|
|
58
|
+
| Capability | Image | Short Video | Notes |
|
|
59
|
+
| --- | --- | --- | --- |
|
|
60
|
+
| Emotion | Yes | Yes | First-layer structured result |
|
|
61
|
+
| Behavior | Yes | Yes | Video usually gives stronger behavior cues |
|
|
62
|
+
| Motivation | Yes | Yes | Second-layer inference from emotion + behavior |
|
|
63
|
+
| Expression | Yes | Yes | Stable rendering over structured analysis |
|
|
64
|
+
| Identity | Yes | No | Separate verification pipeline |
|
|
65
|
+
| Audio | Internal | Internal | Not a primary user-facing workflow |
|
|
66
|
+
|
|
67
|
+
## Quick Start
|
|
68
|
+
|
|
69
|
+
Install for development:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install -e .
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Run the mock provider:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
.venv/bin/python -m cli.main analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
79
|
+
.venv/bin/python -m cli.main analyze-behavior clip.mp4 --pet-id pet-1 --pet-name Milo --modality video
|
|
80
|
+
.venv/bin/python -m cli.main express-pet dog.jpg --pet-id pet-1 --pet-name Milo --locale zh-CN
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Install identity extras:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install -e ".[identity]"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Run real local identity verification:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
.venv/bin/python -m cli.main enroll-identity tests/coconut.jpg --pet-id pet-1 --identity-cropper maskrcnn --identity-embedder openclip
|
|
93
|
+
.venv/bin/python -m cli.main verify-identity tests/coconut.jpg --pet-id pet-1 --identity-cropper maskrcnn --identity-embedder openclip
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## CLI Overview
|
|
97
|
+
|
|
98
|
+
Task-view commands:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pawagent analyze-emotion <source> --modality image|video
|
|
102
|
+
pawagent analyze-behavior <source> --modality image|video
|
|
103
|
+
pawagent analyze-motivation <source> --modality image|video
|
|
104
|
+
pawagent express-pet <source> --modality image|video
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Identity commands:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pawagent enroll-identity <source> --pet-id <pet-id>
|
|
111
|
+
pawagent verify-identity <source> --pet-id <pet-id>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Example Commands
|
|
115
|
+
|
|
116
|
+
Image emotion:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
.venv/bin/python -m cli.main analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Short-video behavior:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
.venv/bin/python -m cli.main analyze-behavior clip.mp4 --pet-id pet-1 --pet-name Milo --modality video
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Localized expression:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
.venv/bin/python -m cli.main express-pet dog.jpg --pet-id pet-1 --pet-name Milo --locale zh-CN
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
HEIC input:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
.venv/bin/python -m cli.main analyze-emotion tests/coconut.heic --pet-id pet-1 --pet-name Coconut
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Image Formats
|
|
141
|
+
|
|
142
|
+
Supported image inputs include:
|
|
143
|
+
|
|
144
|
+
- `JPG`
|
|
145
|
+
- `PNG`
|
|
146
|
+
- `WEBP`
|
|
147
|
+
- `HEIC`
|
|
148
|
+
- `HEIF`
|
|
149
|
+
|
|
150
|
+
`HEIC/HEIF` inputs are decoded locally before provider upload or identity fingerprinting.
|
|
151
|
+
|
|
152
|
+
On macOS, PawAgent can fall back to the system `sips` converter when `pillow-heif` is unavailable.
|
|
153
|
+
|
|
154
|
+
## Providers
|
|
155
|
+
|
|
156
|
+
Built-in provider options:
|
|
157
|
+
|
|
158
|
+
- `mock`
|
|
159
|
+
- `openai`
|
|
160
|
+
- `gemini`
|
|
161
|
+
- `gemini-cli`
|
|
162
|
+
- `codex`
|
|
163
|
+
|
|
164
|
+
### OpenAI
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
export OPENAI_API_KEY=your_api_key
|
|
168
|
+
.venv/bin/python -m cli.main --provider openai --openai-model gpt-4.1-mini analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
OpenAI Platform API integration uses API keys for server-side model calls.
|
|
172
|
+
|
|
173
|
+
### Gemini
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
export GEMINI_API_KEY=your_api_key
|
|
177
|
+
.venv/bin/python -m cli.main --provider gemini --gemini-model gemini-2.5-flash analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Codex CLI
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
codex login
|
|
184
|
+
.venv/bin/python -m cli.main --provider codex --codex-model gpt-5.4 analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
This provider shells out to the local `codex` CLI and reuses its existing login state.
|
|
188
|
+
|
|
189
|
+
### Gemini CLI
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
gemini
|
|
193
|
+
.venv/bin/python -m cli.main --provider gemini-cli --gemini-model gemini-2.5-flash analyze-emotion dog.jpg --pet-id pet-1 --pet-name Milo
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Identity
|
|
197
|
+
|
|
198
|
+
Identity is separate from emotion and behavior analysis. It uses its own profile store and should be treated as probabilistic verification, not biometric certainty.
|
|
199
|
+
|
|
200
|
+
Implementation paths:
|
|
201
|
+
|
|
202
|
+
- Fallback path: `noop` cropper + `hash` embedder
|
|
203
|
+
- Intended local path: `maskrcnn` cropper + `openclip` embedder
|
|
204
|
+
|
|
205
|
+
Identity enrollment is append-only. Repeated `enroll-identity` calls for the same `pet-id` add new reference views instead of overwriting the profile.
|
|
206
|
+
|
|
207
|
+
### Real Local Identity Notes
|
|
208
|
+
|
|
209
|
+
- the first `openclip` run may download files into `.pawagent/hf-cache` and `.pawagent/torch-cache`
|
|
210
|
+
- a Hugging Face unauthenticated-request warning during first download is expected
|
|
211
|
+
- `HF_TOKEN` is optional for public models and only improves download rate limits
|
|
212
|
+
- verification compares against all enrolled references for the target `pet-id`
|
|
213
|
+
|
|
214
|
+
## Architecture
|
|
215
|
+
|
|
216
|
+
```text
|
|
217
|
+
Task Views
|
|
218
|
+
-> Unified Analysis
|
|
219
|
+
-> Capability Layer (vision / video)
|
|
220
|
+
-> Provider Layer
|
|
221
|
+
|
|
222
|
+
Supporting layers:
|
|
223
|
+
- Memory / cache
|
|
224
|
+
- Identity
|
|
225
|
+
- Shared models
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Key design rules:
|
|
229
|
+
|
|
230
|
+
- one source item should map to one unified analysis result
|
|
231
|
+
- repeated task-view requests should reuse cached analysis
|
|
232
|
+
- localized expression may use a lightweight second pass and is cached separately
|
|
233
|
+
- identity should never reuse emotion/behavior memory as its source of truth
|
|
234
|
+
|
|
235
|
+
## Repository Layout
|
|
236
|
+
|
|
237
|
+
```text
|
|
238
|
+
pawagent/
|
|
239
|
+
├── cli/
|
|
240
|
+
├── docs/
|
|
241
|
+
├── examples/
|
|
242
|
+
├── pawagent/
|
|
243
|
+
│ ├── agents/
|
|
244
|
+
│ ├── core/
|
|
245
|
+
│ ├── expression/
|
|
246
|
+
│ ├── identity/
|
|
247
|
+
│ ├── memory/
|
|
248
|
+
│ ├── models/
|
|
249
|
+
│ ├── personality/
|
|
250
|
+
│ ├── providers/
|
|
251
|
+
│ ├── video/
|
|
252
|
+
│ └── vision/
|
|
253
|
+
├── tests/
|
|
254
|
+
└── pyproject.toml
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Library Example
|
|
258
|
+
|
|
259
|
+
```python
|
|
260
|
+
from pathlib import Path
|
|
261
|
+
|
|
262
|
+
from pawagent.agents.mood_agent import PetEmotionAgent
|
|
263
|
+
from pawagent.memory.store import InMemoryAnalysisStore
|
|
264
|
+
from pawagent.personality.profiler import PersonalityProfiler
|
|
265
|
+
from pawagent.providers.mock_provider import MockProvider
|
|
266
|
+
|
|
267
|
+
memory = InMemoryAnalysisStore()
|
|
268
|
+
agent = PetEmotionAgent(
|
|
269
|
+
provider=MockProvider(),
|
|
270
|
+
memory_store=memory,
|
|
271
|
+
profiler=PersonalityProfiler(memory),
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
result = agent.analyze_image(
|
|
275
|
+
image_path=Path("dog.jpg"),
|
|
276
|
+
pet_id="pet-1",
|
|
277
|
+
pet_name="Milo",
|
|
278
|
+
species="unknown",
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
print(result.mood.primary)
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Documentation
|
|
285
|
+
|
|
286
|
+
- [Architecture](docs/architecture.md)
|
|
287
|
+
- [Concepts](docs/concepts.md)
|
|
288
|
+
- [Specification](docs/spec.md)
|
|
289
|
+
|
|
290
|
+
## Contributing
|
|
291
|
+
|
|
292
|
+
Useful contribution areas:
|
|
293
|
+
|
|
294
|
+
- vision and video analysis
|
|
295
|
+
- behavior and motivation quality
|
|
296
|
+
- identity verification quality
|
|
297
|
+
- provider integrations
|
|
298
|
+
- documentation and benchmarks
|
|
299
|
+
|
|
300
|
+
## License
|
|
301
|
+
|
|
302
|
+
MIT License. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# CLI package for PawAgent.
|