feat: Implement moderadora preferences management and enhance CSV cleaning rules for COP/MOD separation. Introduce new GUI components for moderadora settings, including default values and user input handling. Update application preferences to support new extraction models and improve overall user experience in data processing.
This commit is contained in:
@@ -223,6 +223,7 @@ class LLMClient:
|
||||
response_format: str = "json_object",
|
||||
timeout_s: Optional[float] = None,
|
||||
component: str = "llm_client",
|
||||
max_completion_tokens: Optional[int] = None,
|
||||
) -> Tuple[Dict[str, Any], Optional[Dict[str, Any]]]:
|
||||
"""Devuelve (objeto JSON parseado, usage)."""
|
||||
import json
|
||||
@@ -231,11 +232,16 @@ class LLMClient:
|
||||
self._log_start(component=component, model=eff_model, timeout_s=eff_timeout, messages_count=len(messages or []))
|
||||
start = time.time()
|
||||
try:
|
||||
completion_kwargs: Dict[str, Any] = {
|
||||
"response_format": {"type": response_format},
|
||||
}
|
||||
if max_completion_tokens is not None:
|
||||
completion_kwargs["max_completion_tokens"] = max_completion_tokens
|
||||
chat_completion = self._create_completion(
|
||||
messages=messages,
|
||||
model=eff_model,
|
||||
timeout_s=eff_timeout,
|
||||
response_format={"type": response_format},
|
||||
**completion_kwargs,
|
||||
)
|
||||
elapsed_ms = int((time.time() - start) * 1000)
|
||||
usage = self._extract_usage(chat_completion)
|
||||
@@ -256,6 +262,7 @@ class LLMClient:
|
||||
response_format: str = "json_object",
|
||||
timeout_s: Optional[float] = None,
|
||||
component: str = "llm_client",
|
||||
max_completion_tokens: Optional[int] = None,
|
||||
) -> Tuple[Dict[str, Any], Optional[Dict[str, Any]]]:
|
||||
"""Devuelve (objeto JSON parseado, usage) de forma asíncrona."""
|
||||
import json
|
||||
@@ -264,11 +271,16 @@ class LLMClient:
|
||||
self._log_start(component=component, model=eff_model, timeout_s=eff_timeout, messages_count=len(messages or []))
|
||||
start = time.time()
|
||||
try:
|
||||
completion_kwargs: Dict[str, Any] = {
|
||||
"response_format": {"type": response_format},
|
||||
}
|
||||
if max_completion_tokens is not None:
|
||||
completion_kwargs["max_completion_tokens"] = max_completion_tokens
|
||||
chat_completion = await self._create_completion_async(
|
||||
messages=messages,
|
||||
model=eff_model,
|
||||
timeout_s=eff_timeout,
|
||||
response_format={"type": response_format},
|
||||
**completion_kwargs,
|
||||
)
|
||||
elapsed_ms = int((time.time() - start) * 1000)
|
||||
usage = self._extract_usage(chat_completion)
|
||||
|
||||
Reference in New Issue
Block a user