Skip to content

Commit

Permalink
fix: using absolute importing
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeuoly committed Dec 17, 2024
1 parent f408642 commit d450c94
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 41 deletions.
38 changes: 19 additions & 19 deletions python/dify_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
# patch all the blocking calls
monkey.patch_all(sys=True)

from .config.config import DifyPluginEnv
from .interfaces.endpoint import Endpoint
from .interfaces.model import ModelProvider
from .interfaces.model.large_language_model import LargeLanguageModel
from .interfaces.model.moderation_model import ModerationModel
from .interfaces.model.openai_compatible.llm import OAICompatLargeLanguageModel
from .interfaces.model.openai_compatible.provider import OAICompatProvider
from .interfaces.model.openai_compatible.rerank import OAICompatRerankModel
from .interfaces.model.openai_compatible.speech2text import OAICompatSpeech2TextModel
from .interfaces.model.openai_compatible.text_embedding import OAICompatEmbeddingModel
from .interfaces.model.openai_compatible.tts import OAICompatText2SpeechModel
from .interfaces.model.rerank_model import RerankModel
from .interfaces.model.speech2text_model import Speech2TextModel
from .interfaces.model.text_embedding_model import TextEmbeddingModel
from .interfaces.model.tts_model import TTSModel
from .interfaces.tool import Tool, ToolProvider
from .interfaces.agent import AgentProvider, AgentStrategy
from .invocations.file import File
from .plugin import Plugin
from dify_plugin.config.config import DifyPluginEnv
from dify_plugin.interfaces.endpoint import Endpoint
from dify_plugin.interfaces.model import ModelProvider
from dify_plugin.interfaces.model.large_language_model import LargeLanguageModel
from dify_plugin.interfaces.model.moderation_model import ModerationModel
from dify_plugin.interfaces.model.openai_compatible.llm import OAICompatLargeLanguageModel
from dify_plugin.interfaces.model.openai_compatible.provider import OAICompatProvider
from dify_plugin.interfaces.model.openai_compatible.rerank import OAICompatRerankModel
from dify_plugin.interfaces.model.openai_compatible.speech2text import OAICompatSpeech2TextModel
from dify_plugin.interfaces.model.openai_compatible.text_embedding import OAICompatEmbeddingModel
from dify_plugin.interfaces.model.openai_compatible.tts import OAICompatText2SpeechModel
from dify_plugin.interfaces.model.rerank_model import RerankModel
from dify_plugin.interfaces.model.speech2text_model import Speech2TextModel
from dify_plugin.interfaces.model.text_embedding_model import TextEmbeddingModel
from dify_plugin.interfaces.model.tts_model import TTSModel
from dify_plugin.interfaces.tool import Tool, ToolProvider
from dify_plugin.interfaces.agent import AgentProvider, AgentStrategy
from dify_plugin.invocations.file import File
from dify_plugin.plugin import Plugin

__all__ = [
"Plugin",
Expand Down
2 changes: 1 addition & 1 deletion python/dify_plugin/core/utils/position_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections.abc import Callable
from typing import Any

from .yaml_loader import load_yaml_file
from dify_plugin.core.utils.yaml_loader import load_yaml_file


def get_position_map(folder_path: str, *, file_name: str = "_position.yaml") -> dict[str, int]:
Expand Down
2 changes: 1 addition & 1 deletion python/dify_plugin/core/utils/yaml_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import yaml

from ...config.logger_format import plugin_logger_handler
from dify_plugin.config.logger_format import plugin_logger_handler

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
Expand Down
4 changes: 2 additions & 2 deletions python/dify_plugin/entities/endpoint.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pydantic import BaseModel, Field, field_validator

from ..core.utils.yaml_loader import load_yaml_file
from ..entities.tool import ProviderConfig
from dify_plugin.core.utils.yaml_loader import load_yaml_file
from dify_plugin.entities.tool import ProviderConfig


class EndpointConfigurationExtra(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
SystemPromptMessage,
UserPromptMessage,
)
from .ai_model import AIModel
from dify_plugin.interfaces.model.ai_model import AIModel

logger = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions python/dify_plugin/interfaces/model/openai_compatible/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
InvokeBadRequestError,
)
from dify_plugin.interfaces.model.tts_model import TTSModel

from .common import _CommonOaiApiCompat
from dify_plugin.interfaces.model.openai_compatible.common import _CommonOaiApiCompat


class OAICompatText2SpeechModel(_CommonOaiApiCompat, TTSModel):
Expand Down
28 changes: 14 additions & 14 deletions python/dify_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@
from dify_plugin.core.entities.message import InitializeMessage
from dify_plugin.entities.tool import ToolInvokeMessage

from .config.config import DifyPluginEnv, InstallMethod
from .config.logger_format import plugin_logger_handler
from .core.entities.plugin.request import (
from dify_plugin.config.config import DifyPluginEnv, InstallMethod
from dify_plugin.config.logger_format import plugin_logger_handler
from dify_plugin.core.entities.plugin.request import (
AgentActions,
EndpointActions,
ModelActions,
PluginInvokeType,
ToolActions,
)
from .core.plugin_executor import PluginExecutor
from .core.plugin_registration import PluginRegistration
from .core.runtime import Session
from .core.server.__base.request_reader import RequestReader
from .core.server.__base.response_writer import ResponseWriter
from .core.server.aws.request_reader import AWSLambdaRequestReader
from .core.server.io_server import IOServer
from .core.server.router import Router
from .core.server.stdio.request_reader import StdioRequestReader
from .core.server.stdio.response_writer import StdioResponseWriter
from .core.server.tcp.request_reader import TCPReaderWriter
from dify_plugin.core.plugin_executor import PluginExecutor
from dify_plugin.core.plugin_registration import PluginRegistration
from dify_plugin.core.runtime import Session
from dify_plugin.core.server.__base.request_reader import RequestReader
from dify_plugin.core.server.__base.response_writer import ResponseWriter
from dify_plugin.core.server.aws.request_reader import AWSLambdaRequestReader
from dify_plugin.core.server.io_server import IOServer
from dify_plugin.core.server.router import Router
from dify_plugin.core.server.stdio.request_reader import StdioRequestReader
from dify_plugin.core.server.stdio.response_writer import StdioResponseWriter
from dify_plugin.core.server.tcp.request_reader import TCPReaderWriter

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
Expand Down
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "dify_plugin"
version = "0.0.1-beta51"
version = "0.0.1-beta52"
description = "Dify Plugin SDK"
authors = [
{name = "langgenius", email = "hello@dify.ai"},
Expand Down

0 comments on commit d450c94

Please sign in to comment.