Promoted preference keys use the raw extracted type, so an alias splits one preference
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 66/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python, typescript
Línea de trabajo
Start with _assemble in src/selfgraph/extraction/extractor.py and its counterpart in typescript/src/extraction/extractor.ts; trace how extracted entity types are resolved against the schema and how the fallback type is checked. Reproduce the example with the Python snippet in the issue, then verify that alias and canonical type inputs yield one preference with key food and that fallback matching ignores case.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happens
When an extracted relation such as Ann PREFERS Pizza points at a typed value, extraction turns it into a preference whose key is the value entity's type, lowercased, as the LLM wrote it. The type is not canonicalized first, so a schema alias gives a different key from its type name, and the same fact becomes two preferences with two ids. The entity itself is canonicalized correctly (food:pizza in both cases).
The fallback check is also case-sensitive: a value typed thing is treated as typed and promoted with key thing, while Thing is not promoted.
Reproduce
On main (5a277c9), embedded Kuzu:
import asyncio, tempfile
from selfgraph import KuzuStore, SelfGraph
class LLM:
def __init__(self, food_type):
self.food_type = food_type
async def generate(self, *, system, user, output):
kind = next(iter(output.model_fields))
reply = {
"entities": [{"type": "Person", "name": "Ann"}, {"type": self.food_type, "name": "Pizza"}],
"relations": [{"from_name": "Ann", "type": "PREFERS", "to_name": "Pizza"}],
}
return {kind: reply.get(kind, [])}
SCHEMA = {"entities": [{"name": "Person"}, {"name": "Food", "aliases": ["dish"]}], "relations": []}
async def main():
with tempfile.TemporaryDirectory() as tmp:
llm = LLM("Food")
async with SelfGraph(store=KuzuStore(f"{tmp}/g.kuzu"), llm=llm, schema=SCHEMA) as g:
await g.insert.text("Ann prefers pizza.")
llm.food_type = "dish"
await g.insert.text("Ann prefers pizza.")
print([(p.key, p.value_entity) for p in (await g.preferences.list()).items])
asyncio.run(main())
Prints [('food', 'food:pizza'), ('dish', 'food:pizza')]. Expected one preference with key food.
Cause
_assemble in src/selfgraph/extraction/extractor.py (key = value.type.lower(), value.type != _FALLBACK_TYPE) and the same lines in typescript/src/extraction/extractor.ts. Canonicalizing the type against the schema, and comparing the fallback type case-insensitively, would give one key.
- Lenguaje dominante
- TypeScript
- Estrellas
- 173
- Forks
- 58
- Merge medio
- 6 h
- PR fusionados (30 d)
- 120
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de hydra-db/selfgraph
-
approved-for-pr area: cli-mcp area: errors bug effort: S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
hydra-db/selfgraph#401 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
approved-for-pr area: errors area: store bug effort: S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
hydra-db/selfgraph#398 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
approved-for-pr area: errors area: write bug effort: S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
hydra-db/selfgraph#392 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
approved-for-pr area: parity area: write bug effort: S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
hydra-db/selfgraph#391 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
Todos los issues de hydra-db/selfgraph
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
code-yeongyu/senpi#7139 ·
Los mantenedores suelen responder en 1 día
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
lingdojo/kana-dojo#34395 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
bug status: needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
mastra-ai/mastra#31093 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area:web p2 product:business triage:active type:bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 89/100
cuadrao-ai/argus#2328 ·
Los mantenedores suelen responder en 1 día
-
bug frontend good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
nikhilb2/simple_invoicing#907 ·