Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
56c25bfb
Unverified
Commit
56c25bfb
authored
Feb 05, 2024
by
Yeuoly
Committed by
GitHub
Feb 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: bad xinference error (#2384)
parent
b814f0b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
llm.py
api/core/model_runtime/model_providers/xinference/llm/llm.py
+1
-1
text_embedding.py
...del_providers/xinference/text_embedding/text_embedding.py
+4
-2
No files found.
api/core/model_runtime/model_providers/xinference/llm/llm.py
View file @
56c25bfb
...
@@ -70,7 +70,7 @@ class XinferenceAILargeLanguageModel(LargeLanguageModel):
...
@@ -70,7 +70,7 @@ class XinferenceAILargeLanguageModel(LargeLanguageModel):
elif
'generate'
in
extra_param
.
model_ability
:
elif
'generate'
in
extra_param
.
model_ability
:
credentials
[
'completion_type'
]
=
'completion'
credentials
[
'completion_type'
]
=
'completion'
else
:
else
:
raise
ValueError
(
f
'xinference model ability {extra_param.model_ability} is not supported'
)
raise
ValueError
(
f
'xinference model ability {extra_param.model_ability} is not supported
, check if you have the right model type
'
)
if
extra_param
.
support_function_call
:
if
extra_param
.
support_function_call
:
credentials
[
'support_function_call'
]
=
True
credentials
[
'support_function_call'
]
=
True
...
...
api/core/model_runtime/model_providers/xinference/text_embedding/text_embedding.py
View file @
56c25bfb
...
@@ -114,8 +114,10 @@ class XinferenceTextEmbeddingModel(TextEmbeddingModel):
...
@@ -114,8 +114,10 @@ class XinferenceTextEmbeddingModel(TextEmbeddingModel):
credentials
[
'max_tokens'
]
=
extra_args
.
max_tokens
credentials
[
'max_tokens'
]
=
extra_args
.
max_tokens
self
.
_invoke
(
model
=
model
,
credentials
=
credentials
,
texts
=
[
'ping'
])
self
.
_invoke
(
model
=
model
,
credentials
=
credentials
,
texts
=
[
'ping'
])
except
(
InvokeAuthorizationError
,
RuntimeError
):
except
InvokeAuthorizationError
as
e
:
raise
CredentialsValidateFailedError
(
'Invalid api key'
)
raise
CredentialsValidateFailedError
(
f
'Failed to validate credentials for model {model}: {e}'
)
except
RuntimeError
as
e
:
raise
CredentialsValidateFailedError
(
e
)
@
property
@
property
def
_invoke_error_mapping
(
self
)
->
dict
[
type
[
InvokeError
],
list
[
type
[
Exception
]]]:
def
_invoke_error_mapping
(
self
)
->
dict
[
type
[
InvokeError
],
list
[
type
[
Exception
]]]:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment