mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 16:39:13 +08:00
fix
This commit is contained in:
parent
cfa7c89dfe
commit
e63ae36665
@ -235,7 +235,7 @@ class ModelInstance:
|
||||
model=self.model,
|
||||
credentials=self.credentials,
|
||||
texts=texts,
|
||||
)
|
||||
)[0] # TODO: fix this, this is only for temporary compatibility with old
|
||||
|
||||
def invoke_rerank(
|
||||
self,
|
||||
|
@ -71,7 +71,7 @@ class PluginModelProviderEntity(BaseModel):
|
||||
declaration: ProviderEntity = Field(description="The declaration of the model provider.")
|
||||
|
||||
|
||||
class PluginNumTokensResponse(BaseModel):
|
||||
class PluginTextEmbeddingNumTokensResponse(BaseModel):
|
||||
"""
|
||||
Response for number of tokens.
|
||||
"""
|
||||
@ -79,6 +79,14 @@ class PluginNumTokensResponse(BaseModel):
|
||||
num_tokens: list[int] = Field(description="The number of tokens.")
|
||||
|
||||
|
||||
class PluginLLMNumTokensResponse(BaseModel):
|
||||
"""
|
||||
Response for number of tokens.
|
||||
"""
|
||||
|
||||
num_tokens: int = Field(description="The number of tokens.")
|
||||
|
||||
|
||||
class PluginStringResultResponse(BaseModel):
|
||||
result: str = Field(description="The result of the string.")
|
||||
|
||||
|
@ -11,10 +11,11 @@ from core.model_runtime.utils.encoders import jsonable_encoder
|
||||
from core.plugin.entities.plugin_daemon import (
|
||||
PluginBasicBooleanResponse,
|
||||
PluginDaemonInnerError,
|
||||
PluginLLMNumTokensResponse,
|
||||
PluginModelProviderEntity,
|
||||
PluginModelSchemaEntity,
|
||||
PluginNumTokensResponse,
|
||||
PluginStringResultResponse,
|
||||
PluginTextEmbeddingNumTokensResponse,
|
||||
PluginVoicesResponse,
|
||||
)
|
||||
from core.plugin.manager.base import BasePluginManager
|
||||
@ -201,7 +202,7 @@ class PluginModelManager(BasePluginManager):
|
||||
response = self._request_with_plugin_daemon_response_stream(
|
||||
method="POST",
|
||||
path=f"plugin/{tenant_id}/dispatch/llm/num_tokens",
|
||||
type=PluginNumTokensResponse,
|
||||
type=PluginLLMNumTokensResponse,
|
||||
data=jsonable_encoder(
|
||||
{
|
||||
"user_id": user_id,
|
||||
@ -284,7 +285,7 @@ class PluginModelManager(BasePluginManager):
|
||||
response = self._request_with_plugin_daemon_response_stream(
|
||||
method="POST",
|
||||
path=f"plugin/{tenant_id}/dispatch/text_embedding/num_tokens",
|
||||
type=PluginNumTokensResponse,
|
||||
type=PluginTextEmbeddingNumTokensResponse,
|
||||
data=jsonable_encoder(
|
||||
{
|
||||
"user_id": user_id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user