Skip to content

refactor(api): shared chat-completion core + report real version - #28

Merged
ggalancs merged 1 commit into
mainfrom
refactor/shared-chat-core
May 24, 2026
Merged

refactor(api): shared chat-completion core + report real version#28
ggalancs merged 1 commit into
mainfrom
refactor/shared-chat-core

Conversation

@ggalancs

Copy link
Copy Markdown
Owner

Dos follow-ups del análisis arquitectónico.

1. Núcleo de chat compartido (hfl.api.chat_core)

Las rutas OpenAI y Ollama decidían por separado si el modelo emitió una tool call — la duplicación donde la ruta OpenAI se quedó atrás en su día. Ahora resolve_chat_output(...) → ChatOutput centraliza la decisión (forma canónica); cada ruta solo traduce a su wire-format. Comportamiento preservado + 6 tests unitarios.

2. /api/versionhfl.__version__

Devolvía "0.1.0" hardcodeado; ahora reporta la versión real (0.13.0), igual que FastAPI(version=...).

Verificación

Suite 3525 passed, cobertura 89.5%; ruff (incl. C4/PIE/B904) + format + Type Check limpios.

🤖 Generated with Claude Code

Shared chat core (hfl.api.chat_core.resolve_chat_output): the OpenAI and
Ollama chat routes each decided independently whether the model emitted a
tool call (engine tool_calls vs parsing markers vs tool_choice="none"). That
duplication is where the OpenAI route once drifted behind and lost tool
calling. The decision now lives in one tested function returning the
canonical tool-call shape; each route only translates to its wire format.
Behaviour preserved on both paths.

/api/version + the FastAPI app version now report hfl.__version__ instead of
a stale hardcoded "0.1.0".

Full suite green (3525), coverage 89.5%, ruff (C4/PIE/B904) + type-check clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ggalancs
ggalancs merged commit e98da99 into main May 24, 2026
12 checks passed
@ggalancs
ggalancs deleted the refactor/shared-chat-core branch May 24, 2026 21:53
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