Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files1337 unmodified lines1338133913401341134213431344134513461347134813491350135113523 unmodified lines1356135713581350135913601352136113621363136456 unmodified lines1421142214231424142514261427142814291337 unmodified lines kwargs = self._prepare_call_kwargs(dict(kwargs)) return self._validate_message(super().__call__(*args, **kwargs))
# Upewnij się, że poniższy blok jest na poziomie 8 spacji (równo z `def _model_priority`), a NIE wewnątrz `_model_priority`: self.working_models = sorted( dict.fromkeys(candidate_models), key=_model_priority, )
if not self.working_models: raise RuntimeError("No models available for the configured API keys.")
self._model_cls = SafeLiteLLMModel self.model_id = self.working_models[0] print(f"Using primary LLM model: {self.model_id} (fallbacks: {self.working_models[1:]})")3 unmodified lines kwargs = { "model_id": model_name, "api_key": self._get_api_key(model_name), "max_tokens": 2048 if is_openrouter else 8192, "max_tokens": 4096 if is_openrouter else 8192, "num_retries": 0, "timeout": 30, "timeout": 45, } if model_name.startswith("groq/"): kwargs["tool_choice"] = "auto"56 unmodified lines sig = inspect.signature(CodeAgent.__init__) filtered_agent_kwargs = {k: v for k, v in agent_kwargs.items() if k in sig.parameters} self.agent = CodeAgent(**filtered_agent_kwargs)
if not hasattr(self, "_build_model") or not hasattr(self, "agent"): raise RuntimeError("BasicAgent.__init__ failed to bind _build_model or self.agent.") print("CodeAgent initialized with LiteLLMModel.")
def generate(self, messages, stop_sequences=None, grammar=None, tools_to_call_from=None, **kwargs):app.py+14-2