fix: improve error handling and update base URL for SecureCompletionClient
Enhanced error message handling in SecureCompletionClient to provide more detailed information when unexpected status codes occur. The base URL for SecureChatCompletion has been updated.
This commit is contained in:
parent
5641a746b7
commit
77084737dd
2 changed files with 7 additions and 2 deletions
|
|
@ -754,8 +754,13 @@ class SecureCompletionClient:
|
|||
|
||||
else:
|
||||
# Unexpected status code
|
||||
unexp_detail = response.json()
|
||||
if not isinstance(unexp_detail, dict):
|
||||
unexp_detail = {"detail": "unknown"}
|
||||
if isinstance(unexp_detail, dict) and "detail" not in unexp_detail.keys():
|
||||
unexp_detail["detail"] = "unknown"
|
||||
raise APIError(
|
||||
f"Unexpected status code: {response.status_code}",
|
||||
f"Unexpected status code: {response.status_code} {unexp_detail['detail']}",
|
||||
status_code=response.status_code
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class SecureChatCompletion:
|
|||
```
|
||||
"""
|
||||
|
||||
def __init__(self, base_url: str = "https://api.nomyo.ai:12434", allow_http: bool = False, api_key: Optional[str] = None, secure_memory: bool = True):
|
||||
def __init__(self, base_url: str = "https://api.nomyo.ai", allow_http: bool = False, api_key: Optional[str] = None, secure_memory: bool = True):
|
||||
"""
|
||||
Initialize the secure chat completion client.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue