Preserve llm-connect run config in server mode
This commit is contained in:
parent
c11c6afa3f
commit
82e3c07928
3 changed files with 265 additions and 8 deletions
|
|
@ -65,12 +65,10 @@ class _Handler(BaseHTTPRequestHandler):
|
|||
return
|
||||
|
||||
cfg = data.get("config", {})
|
||||
config = RunConfig(
|
||||
model_name=cfg.get("model_name", "gpt-4"),
|
||||
temperature=float(cfg.get("temperature", 0.7)),
|
||||
max_tokens=int(cfg.get("max_tokens", 2000)),
|
||||
timeout_seconds=int(cfg.get("timeout_seconds", 300)),
|
||||
)
|
||||
if not isinstance(cfg, dict):
|
||||
self._respond(400, {"error": "field 'config' must be an object"})
|
||||
return
|
||||
config = RunConfig.from_dict(cfg)
|
||||
|
||||
try:
|
||||
response = self.server.adapter.execute_prompt(prompt, config) # type: ignore[attr-defined]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue