Skip to content

fix: response rag#12

Merged
Kaiohz merged 1 commit into
mainfrom
feat/fix-response-rag
Apr 26, 2026
Merged

fix: response rag#12
Kaiohz merged 1 commit into
mainfrom
feat/fix-response-rag

Conversation

@Kaiohz
Copy link
Copy Markdown
Contributor

@Kaiohz Kaiohz commented Apr 26, 2026

No description provided.

@Kaiohz
Copy link
Copy Markdown
Contributor Author

Kaiohz commented Apr 26, 2026

🤖 Review automatique SoluBot

Résumé

Refactoring des types de réponse RAG pour utiliser des schemas Zod typés au lieu de l'interface générique RagQueryResponse. Architecture hexagonale respectée.

✅ Points positifs

  • Types spécifiques : ChunkResponse[] pour LightRAG, ClassicalQueryResponse pour Classical - plus précis que le générique
  • Zod validation : Parsing et validation des réponses backend avec schemas
  • Architecture propre : Domain entities + ports + infrastructure bien séparés
  • Tests à jour : Tests unitaires mis à jour avec cas d'erreur Zod
  • Code simplifié : Suppression du mapping snake_case inutile

💡 Suggestions d'amélioration

1. Typage plus strict pour metadata

// Actuel
metadata: z.any().default({})

// Suggéré
metadata: z.record(z.unknown()).default({})

2. Enum pour le champ mode

// Actuel
mode: z.string().default("vector")

// Suggéré
mode: z.enum(["vector", "hybrid", "bm25"]).default("vector")

3. Gestion d'erreur Zod explicite (optionnel)

try {
  const parsed = ChunkResponseSchema.array().parse(response.data);
  return parsed;
} catch (e) {
  if (e instanceof z.ZodError) {
    console.error("Zod validation failed:", e.errors);
    throw new Error("Invalid response format from backend");
  }
  throw e;
}

📊 Score: 8/10

Bonne PR, code propre, architecture respectée, tests présents. Quelques améliorations possibles sur le typage strict.


Review générée automatiquement par SoluBot

@Kaiohz Kaiohz merged commit 9051937 into main Apr 26, 2026
1 check passed
@Kaiohz Kaiohz deleted the feat/fix-response-rag branch April 26, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant