mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:58:04 +08:00
refactor(api): continue decoupling dify_graph from API concerns (#33580)
Signed-off-by: -LAN- <laipz8200@outlook.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: WH-2099 <wh2099@pm.me>
This commit is contained in:
@ -93,10 +93,14 @@ class ModelCredentialSchema(BaseModel):
|
||||
|
||||
class SimpleProviderEntity(BaseModel):
|
||||
"""
|
||||
Simple model class for provider.
|
||||
Simplified provider schema exposed to callers.
|
||||
|
||||
`provider` is the canonical runtime identifier. `provider_name` is an optional
|
||||
compatibility alias for short-name lookups and is empty when no alias exists.
|
||||
"""
|
||||
|
||||
provider: str
|
||||
provider_name: str = ""
|
||||
label: I18nObject
|
||||
icon_small: I18nObject | None = None
|
||||
icon_small_dark: I18nObject | None = None
|
||||
@ -115,10 +119,15 @@ class ProviderHelpEntity(BaseModel):
|
||||
|
||||
class ProviderEntity(BaseModel):
|
||||
"""
|
||||
Model class for provider.
|
||||
Runtime-native provider schema.
|
||||
|
||||
`provider` is the canonical runtime identifier. `provider_name` is a
|
||||
compatibility alias for callers that still resolve providers by short name and
|
||||
is empty when no alias exists.
|
||||
"""
|
||||
|
||||
provider: str
|
||||
provider_name: str = ""
|
||||
label: I18nObject
|
||||
description: I18nObject | None = None
|
||||
icon_small: I18nObject | None = None
|
||||
@ -153,6 +162,7 @@ class ProviderEntity(BaseModel):
|
||||
"""
|
||||
return SimpleProviderEntity(
|
||||
provider=self.provider,
|
||||
provider_name=self.provider_name,
|
||||
label=self.label,
|
||||
icon_small=self.icon_small,
|
||||
supported_model_types=self.supported_model_types,
|
||||
|
||||
@ -1,6 +1,13 @@
|
||||
from typing import TypedDict
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class MultimodalRerankInput(TypedDict):
|
||||
content: str
|
||||
content_type: str
|
||||
|
||||
|
||||
class RerankDocument(BaseModel):
|
||||
"""
|
||||
Model class for rerank document.
|
||||
|
||||
@ -1,10 +1,18 @@
|
||||
from decimal import Decimal
|
||||
from enum import StrEnum, auto
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from dify_graph.model_runtime.entities.model_entities import ModelUsage
|
||||
|
||||
|
||||
class EmbeddingInputType(StrEnum):
|
||||
"""Embedding request input variants understood by the model runtime."""
|
||||
|
||||
DOCUMENT = auto()
|
||||
QUERY = auto()
|
||||
|
||||
|
||||
class EmbeddingUsage(ModelUsage):
|
||||
"""
|
||||
Model class for embedding usage.
|
||||
|
||||
Reference in New Issue
Block a user