Enrichment¶
Opt-in deep-parse enrichment: structured overlays from freeform vgmdb text.
AlbumEnrichment
¶
Bases: VgmdbModel
Per-track credits extracted from an album's freeform notes, keyed by track number.
A separate overlay: it does not modify the M1 Album/Track models. is_empty is true
when no track carries any credit (e.g. when no backend was configured).
Source code in src/vgmdb_client/enrich/models.py
11 12 13 14 15 16 17 18 19 20 21 22 23 | |
EnrichmentBackend
¶
Bases: Protocol
A source of enrichment for an album's freeform text.
Implementations (an LLM endpoint now, an embedded model later) are interchangeable.
Source code in src/vgmdb_client/enrich/backend.py
11 12 13 14 15 16 17 18 19 | |
enrich(album, raw_text)
¶
Return the enrichment for album derived from its freeform raw_text.
Source code in src/vgmdb_client/enrich/backend.py
17 18 19 | |
EnrichmentError
¶
Bases: VgmdbClientError
Raised when a configured enrichment backend fails to produce a valid result.
Source code in src/vgmdb_client/enrich/errors.py
8 9 10 11 12 | |
OpenAICompatibleBackend
¶
Enrichment via an OpenAI-compatible /chat/completions endpoint.
The prompt is customizable (system_prompt / user_template), the output can be requested as
free JSON, a JSON schema, or a forced tool call (output_mode), every reply is validated against
an internal response model, and an invalid reply is retried with a corrective message.
Source code in src/vgmdb_client/enrich/llm.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
RuleBasedBackend
¶
Extract per-track credits from notes with conservative deterministic rules.
Source code in src/vgmdb_client/enrich/rules.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
backend_from_env()
¶
Build a backend from LLM_URL/LLM_MODEL/LLM_API_KEY/LLM_OUTPUT_MODE, else None.
Source code in src/vgmdb_client/enrich/llm.py
187 188 189 190 191 192 193 194 195 196 197 198 199 | |
enrich_album(album, backend=None)
¶
Enrich an album's per-track credits from its notes via backend.
With no backend this degrades gracefully to an empty :class:AlbumEnrichment (the M3 album is
fully usable); a configured backend that fails raises :class:EnrichmentError.
Source code in src/vgmdb_client/enrich/__init__.py
23 24 25 26 27 28 29 30 31 | |