MVP 0.93 - stabile, aber Writing Profile ohne erkennbaren Nutzen
This commit is contained in:
1 parent
53b1eff833
commit
f17b3083e8
56 files changed
+5366
-784
No files matched your search
@@ -47,6 +47,7 @@ class ChatResult:
|
||||
model: str | None = None
|
||||
usage: dict = field(default_factory=dict)
|
||||
context_compression: str = "not_applicable"
|
||||
finish_reason: str | None = None
|
||||
|
||||
|
||||
def is_openrouter(config: ProviderConfig) -> bool:
|
||||
@@ -215,9 +216,15 @@ def complete_chat(
|
||||
except (KeyError, IndexError, TypeError) as exc:
|
||||
raise ProviderError("provider_shape", f"Unerwartete {config.role}-Antwort.") from exc
|
||||
usage = data.get("usage") if isinstance(data.get("usage"), dict) else {}
|
||||
finish_reason = None
|
||||
try:
|
||||
finish_reason = data["choices"][0].get("finish_reason")
|
||||
except (KeyError, IndexError, TypeError, AttributeError):
|
||||
finish_reason = None
|
||||
return ChatResult(
|
||||
content=content or "",
|
||||
model=data.get("model") or config.model,
|
||||
usage=usage,
|
||||
context_compression=compression,
|
||||
finish_reason=finish_reason,
|
||||
)
|
||||
Reference in new issue
Block a user