Skip to content

Commit 9147da7

Browse files
committed
fix: Model addition, error log printing
1 parent 83d51ea commit 9147da7

File tree

65 files changed

+131
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+131
-9
lines changed

apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/embedding.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@date:2024/10/16 17:01
77
@desc:
88
"""
9+
import traceback
910
from typing import Dict
1011

1112
from django.utils.translation import gettext as _
@@ -35,6 +36,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
3536
model: AliyunBaiLianEmbedding = provider.get_model(model_type, model_name, model_credential)
3637
model.embed_query(_('Hello'))
3738
except Exception as e:
39+
traceback.print_exc()
3840
if isinstance(e, AppApiException):
3941
raise e
4042
if raise_exception:

apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/image.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@date:2024/7/11 18:41
77
@desc:
88
"""
9+
import traceback
910
from typing import Dict
1011

1112
from django.utils.translation import gettext_lazy as _, gettext
@@ -56,6 +57,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
5657
for chunk in res:
5758
print(chunk)
5859
except Exception as e:
60+
traceback.print_exc()
5961
if isinstance(e, AppApiException):
6062
raise e
6163
if raise_exception:

apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/llm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# coding=utf-8
2+
import traceback
23
from typing import Dict
34

45
from langchain_core.messages import HumanMessage
@@ -48,6 +49,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
4849
model = provider.get_model(model_type, model_name, model_credential, **model_params)
4950
model.invoke([HumanMessage(content=gettext('Hello'))])
5051
except Exception as e:
52+
traceback.print_exc()
5153
if isinstance(e, AppApiException):
5254
raise e
5355
if raise_exception:

apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/reranker.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@date:2024/9/9 17:51
77
@desc:
88
"""
9+
import traceback
910
from typing import Dict
1011

1112
from django.utils.translation import gettext as _
@@ -35,6 +36,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
3536
model: AliyunBaiLianReranker = provider.get_model(model_type, model_name, model_credential)
3637
model.compress_documents([Document(page_content=_('Hello'))], _('Hello'))
3738
except Exception as e:
39+
traceback.print_exc()
3840
if isinstance(e, AppApiException):
3941
raise e
4042
if raise_exception:

apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/stt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding=utf-8
2-
2+
import traceback
33
from typing import Dict
44

55
from django.utils.translation import gettext as _
@@ -30,6 +30,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
3030
model = provider.get_model(model_type, model_name, model_credential)
3131
model.check_auth()
3232
except Exception as e:
33+
traceback.print_exc()
3334
if isinstance(e, AppApiException):
3435
raise e
3536
if raise_exception:

apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/tti.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@date:2024/7/11 18:41
77
@desc:
88
"""
9+
import traceback
910
from typing import Dict
1011

1112
from django.utils.translation import gettext_lazy as _, gettext
@@ -76,6 +77,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
7677
res = model.check_auth()
7778
print(res)
7879
except Exception as e:
80+
traceback.print_exc()
7981
if isinstance(e, AppApiException):
8082
raise e
8183
if raise_exception:

apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/tts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding=utf-8
2-
2+
import traceback
33
from typing import Dict
44

55
from django.utils.translation import gettext_lazy as _, gettext
@@ -64,6 +64,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
6464
model = provider.get_model(model_type, model_name, model_credential, **model_params)
6565
model.check_auth()
6666
except Exception as e:
67+
traceback.print_exc()
6768
if isinstance(e, AppApiException):
6869
raise e
6970
if raise_exception:

apps/setting/models_provider/impl/anthropic_model_provider/credential/image.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# coding=utf-8
2+
import traceback
23
from typing import Dict
34

45
from django.utils.translation import gettext_lazy as _, gettext
@@ -52,6 +53,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
5253
for chunk in res:
5354
print(chunk)
5455
except Exception as e:
56+
traceback.print_exc()
5557
if isinstance(e, AppApiException):
5658
raise e
5759
if raise_exception:

apps/setting/models_provider/impl/anthropic_model_provider/credential/llm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@date:2024/7/11 18:32
77
@desc:
88
"""
9+
import traceback
910
from typing import Dict
1011

1112
from langchain_core.messages import HumanMessage
@@ -55,6 +56,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
5556
model = provider.get_model(model_type, model_name, model_credential)
5657
model.invoke([HumanMessage(content=gettext('Hello'))])
5758
except Exception as e:
59+
traceback.print_exc()
5860
if isinstance(e, AppApiException):
5961
raise e
6062
if raise_exception:

apps/setting/models_provider/impl/aws_bedrock_model_provider/credential/embedding.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import traceback
12
from typing import Dict
23

34
from django.utils.translation import gettext as _
@@ -35,6 +36,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
3536
except AppApiException:
3637
raise
3738
except Exception as e:
39+
traceback.print_exc()
3840
if raise_exception:
3941
raise AppApiException(ValidCode.valid_error.value,
4042
_('Verification failed, please check whether the parameters are correct: {error}').format(

0 commit comments

Comments
 (0)