Skip to content

feat(integrations): backend NLP seleccionable remoto/local (E5-01)#59

Merged
g-garciac2022 merged 2 commits into
mainfrom
feat/e5-01-nlp-local
Jun 16, 2026
Merged

feat(integrations): backend NLP seleccionable remoto/local (E5-01)#59
g-garciac2022 merged 2 commits into
mainfrom
feat/e5-01-nlp-local

Conversation

@g-garciac2022

Copy link
Copy Markdown
Collaborator

Parte de la Épica 5. Desacopla el NLP del proveedor concreto para poder ejecutarlo en local, mitigando el dilema HF (fiabilidad/disponibilidad del backend remoto).

Qué incluye

  • NLPBackend (ABC): contrato común classify / zero_shot -> ToolResult.ok({label, score}).
  • HFClient(BaseAPI, NLPBackend) — backend remoto existente, ahora declara el contrato (herencia múltiple: cliente HTTP + backend NLP).
  • LocalNLPClient(NLPBackend) — backend local con transformers.pipeline: carga perezosa + cache por (task, model), inferencia en asyncio.to_thread (no bloquea el event loop).
  • get_nlp_backend() — factoría que elige remoto/local segun settings.nlp_backend (default remote).
  • Las tools usan la factoria; sus cuerpos no cambian (polimorfismo).

Pendiente en esta rama (antes de mergear)

  • Tests de LocalNLPClient + factoria (mockeando pipeline, sin descargar modelos ni red).
  • Nota sobre torch (dependencia del backend local; install segun hardware CPU/CUDA).

Closes #54

@g-garciac2022 g-garciac2022 merged commit 1382a53 into main Jun 16, 2026
1 check passed
@g-garciac2022 g-garciac2022 deleted the feat/e5-01-nlp-local branch June 16, 2026 15:19
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.

[E5-01] Backend NLP local (remoto -> local)

1 participant