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